|
libhatchet
|
Go to the source code of this file.
Macros | |
| #define | hxprofile_scope(label_string_literal_) |
| #define | hxprofile_scope_min(label_string_literal_, min_cycles_) |
| #define | hxprofiler_start() |
| #define | hxprofiler_stop() |
| #define | hxprofiler_log() |
| #define | hxprofiler_write_to_chrome_tracing(filename_) |
Typedefs | |
| using | hxcycles_t = size_t |
Functions | |
| hxcycles_t | hxtime_sample_cycles (void) |
Variables | |
| constexpr double | hxcycles_per_second = 3.0e+9 |
| constexpr double | hxmilliseconds_per_cycle = 1.0e+3 / hxcycles_per_second |
| constexpr double | hxmicroseconds_per_cycle = 1.0e+6 / hxcycles_per_second |
Provides macros for RAII-style profiling (hxprofile_scope, hxprofile_scope_min with optional cycle cutoffs).
Allows exporting to Chrome's tracing format (hxprofiler_write_to_chrome_tracing). Profiling is enabled only if HX_USE_PROFILER is defined.
| Macro | Purpose |
|---|---|
| hxprofile_scope | Records scoped samples keyed by a string literal. |
| hxprofile_scope_min | Records scoped samples when the cycle cutoff is met. |
| hxprofiler_start | Clears existing samples then starts recording. |
| hxprofiler_stop | Stops recording while retaining samples. |
| hxprofiler_log | Logs captured samples to the system log. |
| hxprofiler_write_to_chrome_tracing | Writes captured samples to Chrome tracing JSON. |
| #define hxprofile_scope | ( | label_string_literal_ | ) |
hxprofile_scope(const char* label_string_literal) - Declares an RAII-style profiling sample.
WARNING: A pointer to label_string_literal is kept. Compiles to a NOP when not in use.
| #define hxprofile_scope_min | ( | label_string_literal_, | |
| min_cycles_ ) |
hxprofile_scope_min(const char* label_string_literal, hxcycles_t min_cycles) - Declares an RAII-style profiling sample with a minimum cycle cutoff.
WARNING: A pointer to label_string_literal is kept. Compiles to a NOP when not in use.
| #define hxprofiler_log | ( | ) |
hxprofiler_log(void) - Stops sampling and writes samples to the system log.
Compiles to a NOP when not in use.
| #define hxprofiler_start | ( | ) |
hxprofiler_start(void) - Clears samples and begins sampling.
Compiles to a NOP when not in use.
| #define hxprofiler_stop | ( | ) |
hxprofiler_stop(void) - Ends sampling.
Does not clear samples. Compiles to a NOP when not in use.
| #define hxprofiler_write_to_chrome_tracing | ( | filename_ | ) |
hxprofiler_write_to_chrome_tracing(const char* filename) - Stops sampling and writes samples to the provided file in JSON format compatible with https://ui.perfetto.dev/.
Compiles to a NOP when not in use.
| using hxcycles_t = size_t |
hxcycles_t - Stores approximately 1.5 seconds to 209 years worth of processor cycles starting from an unspecified origin and wrapping using unsigned rules.
This is intended for profiling, not calendaring. Used by the following include.
|
inline |
hxtime_sample_cycles(void) - Set up the processor cycle counter for your architecture.
This is callable without enabling HX_USE_PROFILER.
|
inlineconstexpr |
hxcycles_per_second - WARNING: Customize for your processor speed.
This assumes 2.8 GHz. These constants are primarily used with printf, which promotes everything to double anyway.
|
inlineconstexpr |
hxmicroseconds_per_cycle - The number of microseconds in a single processor cycle, derived from hxcycles_per_second.
|
inlineconstexpr |
hxmilliseconds_per_cycle - The number of milliseconds in a single processor cycle, derived from hxcycles_per_second.