tracing: Trace Constellation blocked duration (#34536)

Add a trace for the `select!` macro, so
that we can easily identify the amount of
time we are blocked in the trace
A different option might be to just skip
tracing the `handle_request` function entirely,
since it contains almost nothing interesting.

Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
This commit is contained in:
Jonathan Schwender 2024-12-09 16:47:24 +01:00 committed by GitHub
parent dd2fc75b71
commit bb0529d300
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1206,7 +1206,11 @@ where
// produces undefined behaviour, resulting in the destructor // produces undefined behaviour, resulting in the destructor
// being called. If this happens, there's not much we can do // being called. If this happens, there's not much we can do
// other than panic. // other than panic.
let request = select! { let request = {
#[cfg(feature = "tracing")]
let _span =
tracing::trace_span!("handle_request::select", servo_profiling = true).entered();
select! {
recv(self.namespace_receiver) -> msg => { recv(self.namespace_receiver) -> msg => {
msg.expect("Unexpected script channel panic in constellation").map(Request::PipelineNamespace) msg.expect("Unexpected script channel panic in constellation").map(Request::PipelineNamespace)
} }
@ -1238,6 +1242,7 @@ where
// where check_timers will be called. // where check_timers will be called.
return; return;
}, },
}
}; };
let request = match request { let request = match request {