mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
style: Add Gecko profiler labels for when the style threads are doing work.
Differential Revision: https://phabricator.services.mozilla.com/D30869
This commit is contained in:
parent
8dc7a25893
commit
3a22bb6c49
6 changed files with 112 additions and 0 deletions
|
@ -104,3 +104,33 @@ macro_rules! define_keyword_type {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Place a Gecko profiler label on the stack.
|
||||
///
|
||||
/// The `label_type` argument must be the name of a variant of `ProfilerLabel`.
|
||||
#[cfg(feature = "gecko_profiler")]
|
||||
#[macro_export]
|
||||
macro_rules! profiler_label {
|
||||
($label_type:ident) => {
|
||||
let mut _profiler_label: $crate::gecko_bindings::structs::AutoProfilerLabel = unsafe {
|
||||
::std::mem::uninitialized()
|
||||
};
|
||||
let _profiler_label = if $crate::gecko::profiler::profiler_is_active() {
|
||||
unsafe {
|
||||
Some($crate::gecko::profiler::AutoProfilerLabel::new(
|
||||
&mut _profiler_label,
|
||||
$crate::gecko::profiler::ProfilerLabel::$label_type,
|
||||
))
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// No-op when the Gecko profiler is not available.
|
||||
#[cfg(not(feature = "gecko_profiler"))]
|
||||
#[macro_export]
|
||||
macro_rules! profiler_label {
|
||||
($label_type:ident) => {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue