Skip to content

Commit b5f45d9

Browse files
committed
Fix spans for system
1 parent 71adb77 commit b5f45d9

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

crates/bevy_ecs/src/system/commands/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::{
99
world::{EntityWorldMut, FromWorld, World},
1010
};
1111
use bevy_ecs_macros::SystemParam;
12-
use bevy_utils::tracing::{error, info};
12+
use bevy_utils::tracing::{error, info, info_span};
1313
pub use command_queue::CommandQueue;
1414
pub use parallel_scope::*;
1515
use std::marker::PhantomData;
@@ -119,7 +119,7 @@ impl SystemBuffer for CommandQueue {
119119
#[inline]
120120
fn apply(&mut self, _system_meta: &SystemMeta, world: &mut World) {
121121
#[cfg(feature = "trace")]
122-
let _span_guard = _system_meta.commands_span.enter();
122+
let _span_guard = info_span!("system_commands", name = _system_meta.name()).entered();
123123
self.apply(world);
124124
}
125125
}

crates/bevy_ecs/src/system/commands/parallel_scope.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::cell::Cell;
22

3+
use bevy_utils::tracing::info_span;
34
use thread_local::ThreadLocal;
45

56
use crate::{
@@ -52,7 +53,7 @@ impl SystemBuffer for ParallelCommandQueue {
5253
#[inline]
5354
fn apply(&mut self, _system_meta: &SystemMeta, world: &mut World) {
5455
#[cfg(feature = "trace")]
55-
let _system_span = _system_meta.commands_span.enter();
56+
let _system_span = info_span!("system_commands", name = _system_meta.name()).entered();
5657
for cq in &mut self.thread_local_storage {
5758
cq.get_mut().apply(world);
5859
}

crates/bevy_ecs/src/system/exclusive_function_system.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use crate::{
1111
};
1212

1313
use bevy_utils::all_tuples;
14+
use bevy_utils::tracing::info_span;
1415
use std::{any::TypeId, borrow::Cow, marker::PhantomData};
1516

1617
/// A function system that runs with exclusive [`World`] access.
@@ -106,7 +107,7 @@ where
106107

107108
fn run(&mut self, input: Self::In, world: &mut World) -> Self::Out {
108109
#[cfg(feature = "trace")]
109-
let _span_guard = self.system_meta.system_span.enter();
110+
let _span_guard = info_span!("system", name = self.name().as_ref()).entered();
110111

111112
let saved_last_tick = world.last_change_tick;
112113
world.last_change_tick = self.system_meta.last_run;

crates/bevy_ecs/src/system/function_system.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ use crate::{
99
};
1010

1111
use bevy_utils::all_tuples;
12+
use bevy_utils::tracing::info_span;
1213
use std::{any::TypeId, borrow::Cow, marker::PhantomData};
1314

14-
#[cfg(feature = "trace")]
15-
use bevy_utils::tracing::{info_span, Span};
16-
1715
use super::{In, IntoSystem, ReadOnlySystem};
1816

1917
/// The metadata of a [`System`].
@@ -27,10 +25,6 @@ pub struct SystemMeta {
2725
is_send: bool,
2826
has_deferred: bool,
2927
pub(crate) last_run: Tick,
30-
#[cfg(feature = "trace")]
31-
pub(crate) system_span: Span,
32-
#[cfg(feature = "trace")]
33-
pub(crate) commands_span: Span,
3428
}
3529

3630
impl SystemMeta {
@@ -43,10 +37,6 @@ impl SystemMeta {
4337
is_send: true,
4438
has_deferred: false,
4539
last_run: Tick::new(0),
46-
#[cfg(feature = "trace")]
47-
system_span: info_span!("system", name = name),
48-
#[cfg(feature = "trace")]
49-
commands_span: info_span!("system_commands", name = name),
5040
}
5141
}
5242

@@ -486,7 +476,7 @@ where
486476
#[inline]
487477
unsafe fn run_unsafe(&mut self, input: Self::In, world: UnsafeWorldCell) -> Self::Out {
488478
#[cfg(feature = "trace")]
489-
let _span_guard = self.system_meta.system_span.enter();
479+
let _span_guard = info_span!("system", name = self.name().as_ref()).entered();
490480

491481
let change_tick = world.increment_change_tick();
492482

0 commit comments

Comments
 (0)