mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Use profiling crate to support more profiler backends (#5150)
Hey! I am not sure if this is something that's been considered before and decided against (I couldn't find any PR's or issues). This change removes the internal profiling macros in library crates and the `puffin` feature and replaces it with similar functions in the [profiling](https://github.com/aclysma/profiling) crate. This crate provides a layer of abstraction over various profiler instrumentation crates and allows library users to pick their favorite (supported) profiler. An additional benefit for puffin users is that dependencies of egui are included in the instrumentation output too (mainly wgpu which uses the profiling crate), so more details might be available when profiling. A breaking change is that instead of using the `puffin` feature on egui, users that want to profile the crate with puffin instead have to enable the `profile-with-puffin` feature on the profiling crate. Similarly they could instead choose to use `profile-with-tracy` etc. I tried to add a 'tracy' feature to egui_demo_app in order to showcase , however the /scripts/check.sh currently breaks on mutually exclusive features (which this introduces), so I decided against including it for the initial PR. I'm happy to iterate more on this if there is interest in taking this PR though. Screenshot showing the additional info for wgpu now available when using puffin 
This commit is contained in:
@@ -71,19 +71,6 @@ persistence = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
## Enable profiling with the [`puffin`](https://docs.rs/puffin) crate.
|
||||
##
|
||||
## `eframe` will call `puffin::GlobalProfiler::lock().new_frame()` for you
|
||||
##
|
||||
## Only enabled on native, because of the low resolution (1ms) of clocks in browsers.
|
||||
puffin = [
|
||||
"dep:puffin",
|
||||
"egui/puffin",
|
||||
"egui_glow?/puffin",
|
||||
"egui-wgpu?/puffin",
|
||||
"egui-winit/puffin",
|
||||
]
|
||||
|
||||
## Enables wayland support and fixes clipboard issue.
|
||||
wayland = ["egui-winit/wayland", "egui-wgpu?/wayland", "egui_glow?/wayland", "glutin?/wayland", "glutin-winit?/wayland"]
|
||||
|
||||
@@ -127,6 +114,7 @@ ahash.workspace = true
|
||||
document-features.workspace = true
|
||||
log.workspace = true
|
||||
parking_lot.workspace = true
|
||||
profiling.workspace = true
|
||||
raw-window-handle.workspace = true
|
||||
static_assertions = "1.1.0"
|
||||
web-time.workspace = true
|
||||
@@ -157,7 +145,6 @@ pollster = { workspace = true, optional = true } # needed for wgpu
|
||||
glutin = { workspace = true, optional = true, default-features = false, features = ["egl", "wgl"] }
|
||||
glutin-winit = { workspace = true, optional = true, default-features = false, features = ["egl", "wgl"] }
|
||||
home = { workspace = true, optional = true }
|
||||
puffin = { workspace = true, optional = true }
|
||||
wgpu = { workspace = true, optional = true, features = [
|
||||
# Let's enable some backends so that users can use `eframe` out-of-the-box
|
||||
# without having to explicitly opt-in to backends
|
||||
|
||||
Reference in New Issue
Block a user