Add a tracing span for run criteria. (#4709)

# Objective

Adds a tracing span for run critieria.

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

Fixes #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)
This commit is contained in:
Mike 2022-05-10 20:18:58 +00:00
parent e503a31048
commit 9a54e2bed6

View file

@ -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 {