|
VLink 2.0.0
A high-performance communication middleware
|
RAII guard that automatically calls CpuProfiler::begin() and CpuProfiler::end(). 更多...
#include "./macros.h"类 | |
| class | vlink::CpuProfilerGuard |
RAII scope guard that brackets a CpuProfiler active interval. 更多... | |
命名空间 | |
| namespace | vlink |
RAII guard that automatically calls CpuProfiler::begin() and CpuProfiler::end().
CpuProfilerGuard is a lightweight RAII wrapper that calls CpuProfiler::begin() in its constructor and CpuProfiler::end() in its destructor. This ensures the active interval is always closed, even if an exception is thrown.
nullptr as the profiler pointer is safe; both constructor and destructor check for nullptr before calling any method.CpuProfiler::is_global_enabled() to skip guard construction when profiling is disabled globally, reducing overhead in hot paths.