Debian Codegraph @

.cargo/vendor/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! function_scope {
15 () => {
16 $crate::optick::event!();
17 };
18 ($data:expr) => {
19 $crate::optick::event!();
20 $crate::optick::tag!("tag", $data);
21 };
22 }
23
24 #[macro_export]
25 macro_rules! register_thread {
26 () => {
27 let thread_name = std::thread::current()
28 .name()
29 .map(|x| x.to_string())
30 .unwrap_or_else(|| format!("Thread {:?}", std::thread::current().id()));
31
32 $crate::register_thread!(&thread_name);
33 };
34 ($name:expr) => {
35 $crate::optick::register_thread($name);
36 };
37 }
38
39 /// Finishes the frame. This isn't strictly necessary for some kinds of applications but a pretty
40 /// normal thing to track in games.
41 #[macro_export]
42 macro_rules! finish_frame {
43 () => {
44 $crate::optick::next_frame();
45 };
46 }