blob: fef2b255bea57fa6878bb9728ea991e731335690 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//! This module contains APIs for the `profile` crate used generically in the
//! rest of Servo. These APIs are here instead of in `profile` so that these
//! modules won't have to depend on `profile`.
#![deny(unsafe_code)]
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)+)
}};
}
|