HawkTracer  0.9.0
scoped_tracepoint.h
Go to the documentation of this file.
1 #ifndef HAWKTRACER_SCOPED_TRACEPOINT_H
2 #define HAWKTRACER_SCOPED_TRACEPOINT_H
3 
5 
6 #if defined (__cplusplus)
7 #define HT_SCOPED_TRACEPOINT_MACRO_ENABLED
8 
10 
11 #define HT_TP_SCOPED_GENERIC_(type, c_type, timeline, label) \
12  HawkTracer::ScopedTracepoint<c_type> HT_UNIQUE_VAR_NAME(ht_tp_scoped_tracepoint)(timeline, ht_feature_callstack_start_##type, label)
13 
14 #elif defined(__GNUC__)
15 #define HT_SCOPED_TRACEPOINT_MACRO_ENABLED
16 
18 void _ht_callstack_timeline_scoped_cleanup(HT_Timeline** timeline);
19 HT_Timeline* _ht_callstack_timeline_int_start_and_ret(HT_Timeline* t, HT_CallstackEventLabel l);
20 HT_Timeline* _ht_callstack_timeline_string_start_and_ret(HT_Timeline* t, const char* l);
22 
23 #define HT_TP_SCOPED_GENERIC_(type, c_type, callstack_timeline, label) \
24  HT_Timeline* _ht_callstack_timeline __attribute__ ((__cleanup__(_ht_callstack_timeline_scoped_cleanup))) \
25  = _ht_callstack_timeline_##type##_start_and_ret(callstack_timeline, label)
26 
27 #endif
28 
29 #ifdef HT_SCOPED_TRACEPOINT_MACRO_ENABLED
30 
31 #define HT_TP_SCOPED_INT(timeline, label) HT_TP_SCOPED_GENERIC_(int, HT_CallstackEventLabel, timeline, label)
32 #define HT_TP_SCOPED_STRING(timeline, label) HT_TP_SCOPED_GENERIC_(string, const char*, timeline, label)
33 
34 #endif /* HT_HAS_SCOPED_TRACEPOINT */
35 
36 #endif /* HAWKTRACER_SCOPED_TRACEPOINT_H */
#define HT_DECLS_END
Defines an end of C linkage block.
Definition: macros.h:17
typedefHT_DECLS_BEGIN struct _HT_Timeline HT_Timeline
Definition: timeline.h:22
#define HT_DECLS_BEGIN
Defines a beginning of C linkage block.
Definition: macros.h:16
uint64_t HT_CallstackEventLabel
Definition: core_events.h:27