mirror of https://github.com/linebender/xilem
Improve tracing for use of Android GPU Inspector (#534)
- Adds tracing_android_trace - Correct the span for VariableLabel - Make the created apps "debuggable" - Enable spans for `wgpu`'s `profiling` results - Add a span around the Vello rendering to show when that is
This commit is contained in:
parent
dba9742481
commit
455b614769
|
@ -186,6 +186,15 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android_trace"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0d564b0f7a9c9e272c7e43c59f1f09ba04d060774ba7c5fa14c2f966bbd6c4e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
version = "0.3.8"
|
||||
|
@ -1882,6 +1891,7 @@ dependencies = [
|
|||
"once_cell",
|
||||
"parley",
|
||||
"pollster",
|
||||
"profiling",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"smallvec",
|
||||
|
@ -1889,6 +1899,7 @@ dependencies = [
|
|||
"time",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"tracing_android_trace",
|
||||
"unicode-segmentation",
|
||||
"vello",
|
||||
"web-time",
|
||||
|
@ -2596,6 +2607,20 @@ name = "profiling"
|
|||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43d84d1d7a6ac92673717f9f6d1518374ef257669c24ebc5ac25d5033828be58"
|
||||
dependencies = [
|
||||
"profiling-procmacros",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "profiling-procmacros"
|
||||
version = "1.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn 2.0.72",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
|
@ -3357,6 +3382,20 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing_android_trace"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84fae205f9c07bfae3d36d199ab985118c90d225ff70a38e7ff3ecbdb4ef61bc"
|
||||
dependencies = [
|
||||
"android_trace",
|
||||
"smallvec",
|
||||
"thread_local",
|
||||
"tracing",
|
||||
"tracing-core",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ttf-parser"
|
||||
version = "0.24.0"
|
||||
|
@ -4245,6 +4284,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"accesskit",
|
||||
"masonry",
|
||||
"profiling",
|
||||
"smallvec",
|
||||
"time",
|
||||
"tokio",
|
||||
|
|
|
@ -54,6 +54,12 @@ insta = { version = "1.39.0" }
|
|||
assert_matches = "1.5.0"
|
||||
tempfile = "3.10.1"
|
||||
|
||||
# Make wgpu use tracing for its spans.
|
||||
profiling = { version = "1.0.15", features = ["profile-with-tracing"] }
|
||||
|
||||
[[example]]
|
||||
name = "simple_image"
|
||||
#required-features = ["image", "png"]
|
||||
|
||||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
tracing_android_trace = "0.1.0"
|
||||
|
|
|
@ -389,10 +389,13 @@ impl MasonryState<'_> {
|
|||
};
|
||||
// TODO: Run this in-between `submit` and `present`.
|
||||
window.pre_present_notify();
|
||||
self.renderer
|
||||
.get_or_insert_with(|| Renderer::new(device, renderer_options).unwrap())
|
||||
.render_to_surface(device, queue, scene_ref, &surface_texture, &render_params)
|
||||
.expect("failed to render to surface");
|
||||
{
|
||||
let _render_span = tracing::info_span!("Rendering using Vello").entered();
|
||||
self.renderer
|
||||
.get_or_insert_with(|| Renderer::new(device, renderer_options).unwrap())
|
||||
.render_to_surface(device, queue, scene_ref, &surface_texture, &render_params)
|
||||
.expect("failed to render to surface");
|
||||
}
|
||||
surface_texture.present();
|
||||
device.poll(wgpu::Maintain::Wait);
|
||||
}
|
||||
|
|
|
@ -90,10 +90,16 @@ pub(crate) fn try_init_layered_tracing(
|
|||
None
|
||||
};
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
let android_trace_layer = tracing_android_trace::AndroidTraceLayer::new();
|
||||
|
||||
let registry = tracing_subscriber::registry()
|
||||
.with(console_layer)
|
||||
.with(log_file_layer);
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
let registry = registry.with(android_trace_layer);
|
||||
|
||||
tracing::dispatcher::set_global_default(registry.into())?;
|
||||
|
||||
if let Some(err) = env_var_error {
|
||||
|
|
|
@ -401,7 +401,7 @@ impl Widget for VariableLabel {
|
|||
}
|
||||
|
||||
fn make_trace_span(&self) -> Span {
|
||||
trace_span!("Label")
|
||||
trace_span!("VariableLabel")
|
||||
}
|
||||
|
||||
fn get_debug_text(&self) -> Option<String> {
|
||||
|
|
|
@ -71,5 +71,13 @@ tokio = { version = "1.39.1", features = ["rt", "rt-multi-thread", "time"] }
|
|||
# Used for `variable_clock`
|
||||
time = { workspace = true, features = ["local-offset"] }
|
||||
|
||||
# Make wgpu use tracing for its spans.
|
||||
profiling = { version = "1.0.15", features = ["profile-with-tracing"] }
|
||||
|
||||
[target.'cfg(target_os = "android")'.dev-dependencies]
|
||||
winit = { features = ["android-native-activity"], workspace = true }
|
||||
|
||||
# This makes the examples discoverable to (e.g.) Android GPU inspector without needing to provide the full name manually.
|
||||
# Do not use when releasing a production app.
|
||||
[package.metadata.android.application]
|
||||
debuggable = true
|
||||
|
|
Loading…
Reference in New Issue