18 #ifndef ION_PROFILE_PROFILING_H_
19 #define ION_PROFILE_PROFILING_H_
39 #define ION_PROFILING_PASTE1(x, y) x ## y
40 #define ION_PROFILING_PASTE2(x, y) ION_PROFILING_PASTE1(x, y)
41 #define ION_PROFILING_PASTE3(x) ION_PROFILING_PASTE2(x, __LINE__)
47 #define ION_PROFILE_FUNCTION(func_name) \
49 (void) func_name " must be a literal string."; \
50 ION_DECLARE_SAFE_STATIC_POINTER_WITH_CONSTRUCTOR( \
51 int, ION_PROFILING_PASTE3(scope_event_id_), \
52 new int(::ion::profile::GetCallTraceManager()-> \
53 GetScopeEnterEvent(func_name))); \
54 DCHECK_NE(0, *ION_PROFILING_PASTE3(scope_event_id_)); \
55 ::ion::profile::ScopedTracer ION_PROFILING_PASTE3(scope_tracer_)( \
56 ::ion::profile::GetCallTraceManager()->GetTraceRecorder(), \
57 *ION_PROFILING_PASTE3(scope_event_id_));
65 #define ION_PROFILE_FUNCTION_ANNOTATED(func_name, key, value) \
66 ION_PROFILE_FUNCTION(func_name); \
67 ::ion::profile::GetCallTraceManager()->GetTraceRecorder() \
68 ->AnnotateCurrentScope(key, value);
70 #define ION_PROFILE_FRAME \
71 ION_DECLARE_SAFE_STATIC_POINTER_WITH_CONSTRUCTOR( \
72 int, ION_PROFILING_PASTE3(frame_number_), new int(0)); \
73 DCHECK_NE(0, ION_PROFILING_PASTE3(frame_number_)); \
74 ::ion::profile::ScopedFrameTracer ION_PROFILING_PASTE3(frame_tracer_)( \
75 ::ion::profile::GetCallTraceManager()->GetTraceRecorder(), \
76 ++(*ION_PROFILING_PASTE3(frame_number_)));
78 #endif // ION_PROFILE_PROFILING_H_
CallTraceManager * GetCallTraceManager()
Get the global, static instance of CallTraceManager.