Skip to content

Commit

Permalink
use cached spans for exclusive systems
Browse files Browse the repository at this point in the history
  • Loading branch information
hymm committed Aug 15, 2023
1 parent 2859b4d commit 5abf79e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions crates/bevy_ecs/src/schedule/executor/multi_threaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,7 @@ impl MultiThreadedExecutor {
let system = unsafe { &mut *systems[system_index].get() };

#[cfg(feature = "trace")]
let task_span = info_span!("system_task", name = &*system.name());
#[cfg(feature = "trace")]
let system_span = info_span!("system", name = &*system.name());
let system_span = self.system_task_metadata[system_index].system_span.clone();

let sender = self.sender.clone();
let panic_payload = self.panic_payload.clone();
Expand Down Expand Up @@ -597,7 +595,11 @@ impl MultiThreadedExecutor {
};

#[cfg(feature = "trace")]
let task = task.instrument(task_span);
let task = task.instrument(
self.system_task_metadata[system_index]
.system_task_span
.clone(),
);
scope.spawn_on_scope(task);
} else {
let task = async move {
Expand Down Expand Up @@ -627,7 +629,11 @@ impl MultiThreadedExecutor {
};

#[cfg(feature = "trace")]
let task = task.instrument(task_span);
let task = task.instrument(
self.system_task_metadata[system_index]
.system_task_span
.clone(),
);
scope.spawn_on_scope(task);
}

Expand Down

0 comments on commit 5abf79e

Please sign in to comment.