mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Plumb time profiler output into tracing (#34238)
* Plumb time profiler output into tracing Signed-off-by: Delan Azabani <dazabani@igalia.com> * Enter the span tightly around the callback Signed-off-by: Delan Azabani <dazabani@igalia.com> * Use `info_span!()` shorthand Signed-off-by: Delan Azabani <dazabani@igalia.com> --------- Signed-off-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
parent
495cceb7de
commit
aa7116c75d
16 changed files with 279 additions and 82 deletions
|
@ -11,3 +11,17 @@
|
|||
pub mod ipc;
|
||||
pub mod mem;
|
||||
pub mod time;
|
||||
|
||||
/// Measure the given callback with the time profiler and (if enabled) tracing.
|
||||
///
|
||||
/// `$category` must be const, because we use it to derive the span name.
|
||||
#[macro_export]
|
||||
macro_rules! time_profile {
|
||||
($category:expr, $meta:expr, $profiler_chan:expr, $($callback:tt)+) => {{
|
||||
#[cfg(feature = "tracing")]
|
||||
let span = tracing::info_span!($category.variant_name(), servo_profiling = true);
|
||||
#[cfg(not(feature = "tracing"))]
|
||||
let span = ();
|
||||
$crate::time::profile($category, $meta, $profiler_chan, span, $($callback)+)
|
||||
}};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue