| 1 |
/// Opens a scope. Two variants: |
| 2 |
/// - profiling::scope!(name: &str) - Opens a scope with the given name |
| 3 |
/// - profiling::scope!(name: &str, data: &str) - Opens a scope with the given name and an extra |
| 4 |
/// datafield. Details of this depend on the API, but it should be a &str. If the extra data is |
| 5 |
/// named, it will be named "tag". Some APIs support adding more data (for example, `optic::tag!`) |
| 6 |
/// |
| 7 |
/// ``` |
| 8 |
/// profiling::scope!("outer"); |
| 9 |
/// for _ in 0..10 { |
| 10 |
/// profiling::scope!("inner", format!("iteration {}").as_str()); |
| 11 |
/// } |
| 12 |
/// ``` |
| 13 |
#[macro_export] |
| 14 |
macro_rules! scope { |
| 15 |
($name:expr) => {}; |
| 16 |
($name:expr, $data:expr) => {}; |
| 17 |
} |
| 18 |
|
| 19 |
/// Opens a scope automatically named after the current function. |
| 20 |
/// - profiling::function_scope!() - Opens a scope with the current function name |
| 21 |
/// - profiling::function_scope!(data: &str) - Opens a scope with the current function name and an extra data field. |
| 22 |
/// |
| 23 |
/// ``` |
| 24 |
/// fn function_a(){ |
| 25 |
/// profiling::function_scope!(); |
| 26 |
/// } |
| 27 |
/// fn function_b(iteration: u32){ |
| 28 |
/// profiling::function_scope!(format!("iteration {}", iteration).as_str()); |
| 29 |
/// } |
| 30 |
/// ``` |
| 31 |
#[macro_export] |
| 32 |
macro_rules! function_scope { |
| 33 |
() => {}; |
| 34 |
($data:expr) => {}; |
| 35 |
} |
| 36 |
|
| 37 |
/// Registers a thread with the profiler API(s). This is usually setting a name for the thread. |
| 38 |
/// Two variants: |
| 39 |
/// - register_thread!() - Tries to get the name of the thread, or an ID if no name is set |
| 40 |
/// - register_thread!(name: &str) - Registers the thread using the given name |
| 41 |
#[macro_export] |
| 42 |
macro_rules! register_thread { |
| 43 |
() => {}; |
| 44 |
($name:expr) => {}; |
| 45 |
} |
| 46 |
|
| 47 |
/// Finishes the frame. This isn't strictly necessary for some kinds of applications but a pretty |
| 48 |
/// normal thing to track in games. |
| 49 |
#[macro_export] |
| 50 |
macro_rules! finish_frame { |
| 51 |
() => {}; |
| 52 |
} |