Skip to content

Commit

Permalink
Add a tracing span for run criteria. (bevyengine#4709)
Browse files Browse the repository at this point in the history
# Objective

Adds a tracing span for run critieria.

This change will be invalidated by stageless, but it was a simple change.

Fixes bevyengine#4681.

## Changelog

Shows how long a run criteria takes to run when tracing is enabled.
![image](https://user-images.githubusercontent.com/2180432/167517447-93dba7db-8c85-4686-90e0-30e9636f120f.png)
  • Loading branch information
hymm authored and ItsDoot committed Feb 1, 2023
1 parent c9e3bae commit d1904f3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/bevy_ecs/src/schedule/stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,12 @@ impl Stage for SystemStage {
for index in 0..self.run_criteria.len() {
let (run_criteria, tail) = self.run_criteria.split_at_mut(index);
let mut criteria = &mut tail[0];

#[cfg(feature = "trace")]
let _span =
bevy_utils::tracing::info_span!("run criteria", name = &*criteria.name())
.entered();

match &mut criteria.inner {
RunCriteriaInner::Single(system) => criteria.should_run = system.run((), world),
RunCriteriaInner::Piped {
Expand Down

0 comments on commit d1904f3

Please sign in to comment.