Class ScopedProfiler

Nested Relationships

Nested Types

Class Documentation

class ScopedProfiler

Scoped RAII profiler that measures elapsed time for a named code block.

This class records the execution time between construction and destruction (or explicit finish call) and aggregates statistics including count, total time, and max time per named scope.

The stats are saved in a static map. Will survive till the end of execution.

Public Functions

inline explicit ScopedProfiler(std::string name_)
ScopedProfiler(const ScopedProfiler&) = delete
ScopedProfiler(ScopedProfiler&&) = delete
ScopedProfiler &operator=(const ScopedProfiler&) = delete
ScopedProfiler &operator=(ScopedProfiler&&) = delete
inline void finish()

Explicitly finish timing and update aggregated statistics.

inline ~ScopedProfiler()

Automatically finish timing on destruction if not already finished.

Public Static Functions

static inline void print_results()

Print aggregated profiling results to stdout.