HawkTracer  0.10.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 
22 #elif defined(HT_USE_PTHREADS) && defined(HT_SCOPED_TRACEPOINT_MACRO_ENABLED)
23 
25 
26 #define HT_TP_STRACEPOINT(timeline, label) \
27  static HT_THREAD_LOCAL pthread_once_t HT_UNIQUE_VAR_NAME(ht_var_once) = PTHREAD_ONCE_INIT; \
28  static HT_THREAD_LOCAL uintptr_t HT_UNIQUE_VAR_NAME(fnc_track) = label; \
29  ht_pthread_mapped_tracepoint_enter(timeline, HT_UNIQUE_VAR_NAME(fnc_track)); \
30  pthread_once(&HT_UNIQUE_VAR_NAME(ht_var_once), ht_pthread_mapped_tracepoint_add_mapping); \
31  ht_pthread_mapped_tracepoint_leave(); \
32  HT_TP_SCOPED_INT(timeline, (uintptr_t)HT_UNIQUE_VAR_NAME(fnc_track));
33 
34 #endif
35 
44 #define HT_TP_DYN_STRACEPOINT(timeline, label) \
45  HT_TP_SCOPED_INT(timeline, (uintptr_t)ht_feature_cached_string_add_mapping_dynamic(timeline, label));
46 
54 #define HT_TP_FUNCTION(timeline) \
55  HT_TP_STRACEPOINT(timeline, __func__)
56 
57 #endif /* HAWKTRACER_STRING_SCOPED_TRACEPOINT_H */
Stores a map of strings and their hash values.