-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23da5a3
commit 7e682e7
Showing
20 changed files
with
357 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "iced_profiling" | ||
authors = ["Bingus <shankern@protonmail.com>"] | ||
version = "0.1.0" | ||
edition = "2021" | ||
description = "Profiling backend implementations for Iced" | ||
|
||
[dependencies] | ||
tracing = { version = "0.1.37", default-features = false, features = ["std"] } | ||
tracing-core = "0.1.30" | ||
tracing-subscriber = { version = "0.3.16", features = ["registry", "env-filter"] } | ||
|
||
[dependencies.tracing-chrome] | ||
version = "0.7.0" | ||
optional = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# `iced_profiling` | ||
[![Documentation](https://docs.rs/iced_profiling/badge.svg)] | ||
[![Crates.io](https://img.shields.io/crates/v/iced_profiling.svg)](https://crates.io/crates/iced_profiling) | ||
[![License](https://img.shields.io/crates/l/iced_profiling.svg)](https://github.com/iced-rs/iced/blob/master/LICENSE) | ||
[![Discord Server](https://img.shields.io/discord/628993209984614400?label=&labelColor=6A7EC2&logo=discord&logoColor=ffffff&color=7389D8)](https://discord.gg/3xZJ65GAhd) | ||
|
||
`iced_profiling` is a crate which implements various tracing backends for Iced. | ||
|
||
It relies on the [tracing](https://crates.io/crates/tracing) crate to collect diagnostics. We currently only support | ||
tracing with `tracing`'s `info_span!` macro, but will consider different logging levels in the future. PRs welcome! | ||
|
||
## Trace backends | ||
|
||
We currently support only Chrome JSON traces using the [tracing-chrome](https://crates.io/crates/tracing-chrome) crate. | ||
|
||
There are plans to add support for [Tracy](https://github.com/wolfpld/tracy) in the near future! | ||
|
||
## Generating a trace file | ||
|
||
### Using Iced's `Application` | ||
|
||
Simply enable your tracing backend of choice (e.g. `trace_chrome`) feature in Iced & run your project. | ||
|
||
```shell | ||
cargo run --features iced/trace_chrome | ||
``` | ||
### Standalone dependency | ||
|
||
You can enable tracing by enabling your tracing backend of choice as a feature of `iced_profiling`. | ||
|
||
```toml | ||
iced_profiling = { version = "0.1.0", features = ["tracing-chrome"]} | ||
``` | ||
|
||
Doing so will require you to initialize the profiler manually like so: | ||
|
||
```rust | ||
let _guard = iced_profiling::init(); | ||
``` | ||
|
||
This reference must be kept alive for the entire duration of your application that you wish to profile. | ||
|
||
## Chrome | ||
|
||
By default, Chrome trace files will be generated in the current working directory: | ||
```shell | ||
path/to/your/project/project_trace_{timestamp}.json | ||
``` | ||
|
||
You also set a specific path by setting the `CHROME_TRACE_FILE` env variable: | ||
```shell | ||
CHROME_TRACE_FILE = ~/Desktop/trace.json cargo run | ||
``` | ||
|
||
If you cannot find your trace file, there may have been a permission issue when trying to generate your file. Be sure to check your cargo manifest directory! | ||
|
||
Once your file is generated, you can view it in Google Chrome at either [ui.perfetto.dev](ui.perfetto.dev) (new) or [chrome://trace](chrome://trace) (old). | ||
|
||
<p align="center"> | ||
<img alt="The native target" src="../docs/images/perfetto.png" width="80%"> | ||
</p> |
Oops, something went wrong.