chore: Simplify tracing with servo_tracing macro (#36661) (#37497)

This pull request refactors existing tracing annotations to leverage the
new `servo_tracing::instrument` macro introduced in #36573.

Specifically, the following transformations were applied:
- Removed `#[cfg_attr(feature = "tracing", ...)]` wrappers.
- Replaced `tracing::instrument` with `servo_tracing::instrument`.
- Removed `level = "trace"`
- Removed `fields(servo_profiling = true)` from tracing attributes
however retained others like `name`. `skip type`

Closes: #36661

---------

Signed-off-by: Bhuwan Pandit <bhuwanpandit109@gmail.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
This commit is contained in:
Bhuwan Pandit 2025-06-18 17:18:04 +01:00 committed by GitHub
parent bdf8c0ebc8
commit 04bcafa140
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 137 additions and 527 deletions

View file

@ -44,6 +44,7 @@ webrender = { workspace = true }
webrender_api = { workspace = true }
webxr = { path = "../webxr", optional = true }
wr_malloc_size_of = { workspace = true }
servo-tracing = { workspace = true }
[dev-dependencies]
surfman = { workspace = true }

View file

@ -1503,10 +1503,7 @@ impl IOCompositor {
}))
}
#[cfg_attr(
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
#[servo_tracing::instrument(skip_all)]
fn render_inner(&mut self) -> Result<(), UnableToComposite> {
if let Err(err) = self.rendering_context.make_current() {
warn!("Failed to make the rendering context current: {:?}", err);
@ -1660,10 +1657,7 @@ impl IOCompositor {
Ref::map(self.global.borrow(), |global| &global.compositor_receiver)
}
#[cfg_attr(
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
#[servo_tracing::instrument(skip_all)]
pub fn handle_messages(&mut self, mut messages: Vec<CompositorMsg>) {
// Check for new messages coming from the other threads in the system.
let mut found_recomposite_msg = false;
@ -1700,10 +1694,7 @@ impl IOCompositor {
}
}
#[cfg_attr(
feature = "tracing",
tracing::instrument(skip_all, fields(servo_profiling = true), level = "trace")
)]
#[servo_tracing::instrument(skip_all)]
pub fn perform_updates(&mut self) -> bool {
if self.global.borrow().shutdown_state() == ShutdownState::FinishedShuttingDown {
return false;