HawkTracer  0.10.0
feature_cached_string.h File Reference

Stores a map of strings and their hash values. More...

Go to the source code of this file.

Functions

HT_DECLS_BEGIN HT_API HT_ErrorCode ht_feature_cached_string_enable (HT_Timeline *timeline, HT_Boolean thread_safe)
 Enables a feature for the timeline. More...
 
HT_API uintptr_t ht_feature_cached_string_add_mapping (HT_Timeline *timeline, const char *label)
 Adds a mapping. More...
 
HT_API void ht_feature_cached_string_push_map (HT_Timeline *timeline)
 Pushes mapping events of all the strings registered in the feature. More...
 
HT_API uintptr_t ht_feature_cached_string_add_mapping_dynamic (HT_Timeline *timeline, const char *label)
 

Detailed Description

Stores a map of strings and their hash values.

The feature allows to reduce a size of the payload being generated by HawkTracer by generating a special event (Mapping Event) that contains a mapping between string value and the number, so the user can use the hash value when sends the string.

Function Documentation

◆ ht_feature_cached_string_add_mapping()

HT_API uintptr_t ht_feature_cached_string_add_mapping ( HT_Timeline timeline,
const char *  label 
)

Adds a mapping.

The function also pushes a mapping event to the timeline.

Parameters
timelinethe timeline.
labela string to map. The string must be a static string (i.e. must be valid for the whole period of the program). For dynamic strings, use ht_feature_cached_string_add_mapping_dynamic()
Returns
hash of the string passed as argument.

◆ ht_feature_cached_string_add_mapping_dynamic()

HT_API uintptr_t ht_feature_cached_string_add_mapping_dynamic ( HT_Timeline timeline,
const char *  label 
)

◆ ht_feature_cached_string_enable()

HT_DECLS_BEGIN HT_API HT_ErrorCode ht_feature_cached_string_enable ( HT_Timeline timeline,
HT_Boolean  thread_safe 
)

Enables a feature for the timeline.

Parameters
timelinethe timeline.
thread_safewether the feature should be thread-safe (i.e. will be used across different threads) or not.
Returns
HT_ERR_OK if enabling the feature completes successfully; otherwise, appropriate error code.

◆ ht_feature_cached_string_push_map()

HT_API void ht_feature_cached_string_push_map ( HT_Timeline timeline)

Pushes mapping events of all the strings registered in the feature.

Parameters
timelinethe timeline.