Skip to content

Commit

Permalink
can specify chrome tracing file (bevyengine#4618)
Browse files Browse the repository at this point in the history
# Objective

- I want to have the trace file at a predictable path

## Solution

- Adds an environment variable that is used as the path when it's set
  • Loading branch information
mockersf authored and ItsDoot committed Feb 1, 2023
1 parent 103e65b commit 87767cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ jobs:
for example in .github/example-run/*.ron; do
example_name=`basename $example .ron`
echo "running $example_name - "`date`
time CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --no-default-features --features "bevy_dynamic_plugin,bevy_gilrs,bevy_gltf,bevy_winit,render,png,hdr,x11,bevy_ci_testing,trace,trace_chrome,bevy_audio,vorbis"
time TRACE_CHROME=trace-$example_name.json CI_TESTING_CONFIG=$example xvfb-run cargo run --example $example_name --no-default-features --features "bevy_dynamic_plugin,bevy_gilrs,bevy_gltf,bevy_winit,render,png,hdr,x11,bevy_ci_testing,trace,trace_chrome,bevy_audio,vorbis"
sleep 10
done
zip traces.zip trace*.json
Expand Down
6 changes: 5 additions & 1 deletion crates/bevy_log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ impl Plugin for LogPlugin {
{
#[cfg(feature = "tracing-chrome")]
let chrome_layer = {
let (chrome_layer, guard) = tracing_chrome::ChromeLayerBuilder::new()
let mut layer = tracing_chrome::ChromeLayerBuilder::new();
if let Ok(path) = std::env::var("TRACE_CHROME") {
layer = layer.file(path);
}
let (chrome_layer, guard) = layer
.name_fn(Box::new(|event_or_span| match event_or_span {
tracing_chrome::EventOrSpan::Event(event) => event.metadata().name().into(),
tracing_chrome::EventOrSpan::Span(span) => {
Expand Down

0 comments on commit 87767cb

Please sign in to comment.