HawkTracer  0.8.0
string_scoped_tracepoint.h
Go to the documentation of this file.
1 #ifndef HAWKTRACER_STRING_SCOPED_TRACEPOINT_H
2 #define HAWKTRACER_STRING_SCOPED_TRACEPOINT_H
3 
4 #include <hawktracer/ht_config.h>
7 
8 #ifdef __cplusplus
9 
18 #define HT_TP_STRACEPOINT(timeline, label) \
19  static HT_THREAD_LOCAL uintptr_t HT_UNIQUE_VAR_NAME(fnc_track) = ht_feature_cached_string_add_mapping(timeline, label); \
20  HT_TP_SCOPED_INT(timeline, (uintptr_t)HT_UNIQUE_VAR_NAME(fnc_track));
21 
30 #define HT_TP_DYN_STRACEPOINT(timeline, label) \
31  HT_TP_SCOPED_INT(timeline, (uintptr_t)ht_feature_cached_string_add_mapping_dynamic(timeline, label));
32 
33 #elif defined(HT_USE_PTHREADS) && defined(HT_SCOPED_TRACEPOINT_MACRO_ENABLED)
34 
36 
37 #define HT_TP_STRACEPOINT(timeline, label) \
38  static HT_THREAD_LOCAL pthread_once_t HT_UNIQUE_VAR_NAME(ht_var_once) = PTHREAD_ONCE_INIT; \
39  static HT_THREAD_LOCAL uintptr_t HT_UNIQUE_VAR_NAME(fnc_track) = label; \
40  ht_pthread_mapped_tracepoint_enter(timeline, HT_UNIQUE_VAR_NAME(fnc_track)); \
41  pthread_once(&HT_UNIQUE_VAR_NAME(ht_var_once), ht_pthread_mapped_tracepoint_add_mapping); \
42  ht_pthread_mapped_tracepoint_leave(); \
43  HT_TP_SCOPED_INT(timeline, (uintptr_t)HT_UNIQUE_VAR_NAME(fnc_track));
44 
45 #endif
46 
54 #define HT_TP_FUNCTION(timeline) \
55  HT_TP_STRACEPOINT(timeline, __func__)
56 
57 #endif /* HAWKTRACER_STRING_SCOPED_TRACEPOINT_H */