Debian Codegraph @

third_party/rust/profiling/src/optick_impl.rs

raw
1 #[macro_export]
2 macro_rules! scope {
3 ($name:expr) => {
4 $crate::optick::event!($name);
5 };
6 // NOTE: I've not been able to get attached data to work with optick
7 ($name:expr, $data:expr) => {
8 $crate::optick::event!($name);
9 $crate::optick::tag!("tag", $data);
10 };
11 }
12
13 #[macro_export]
14 macro_rules! register_thread {
15 () => {
16 let thread_name = std::thread::current()
17 .name()
18 .map(|x| x.to_string())
19 .unwrap_or_else(|| format!("Thread {:?}", std::thread::current().id()));
20
21 $crate::register_thread!(&thread_name);
22 };
23 ($name:expr) => {
24 $crate::optick::register_thread($name);
25 };
26 }
27
28 /// Finishes the frame. This isn't strictly necessary for some kinds of applications but a pretty
29 /// normal thing to track in games.
30 #[macro_export]
31 macro_rules! finish_frame {
32 () => {
33 $crate::optick::next_frame();
34 };
35 }