![]() |
Spicy
|
#include <profiler.h>
Public Member Functions | |
| Profiler ()=default | |
| Profiler (const Profiler &other)=delete | |
| Profiler (Profiler &&other)=default | |
| ~Profiler () | |
| Profiler & | operator= (const Profiler &other)=delete |
| Profiler & | operator= (Profiler &&other)=default |
| void | record (const profiler::Measurement &end) |
| operator bool () const | |
Static Public Member Functions | |
| static profiler::Measurement | snapshot (std::optional< uint64_t > volume=std::nullopt) |
Protected Member Functions | |
| Profiler (std::string_view name, std::optional< uint64_t > volume) | |
Friends | |
| std::optional< Profiler > | profiler::start (std::string_view name, std::optional< uint64_t > volume) |
| void | profiler::detail::done () |
Class representing one block of code to profile. The constructor records a first measurement, and the destructor records a second. The delta between the two measurements is then added to a global total kept for respective block of code. Blocks are identified through descriptive names, which will be shows as part of the final report.
Profilers can't be instantiated directly; use the start() and stop() API instead.
|
default |
Default constructor instantiating a no-op profiler that's not actively recording any measurement. The only purpose of constructor is allowing to pre-allocate a local profiler variable that a real profiler can later be move into.
|
inline |
Destructor concluding any pending measurement.
|
inlineprotected |
Constructor starting a new measurement. Don't call directly, use profiler::start() instead.
| name | descriptive, unique name of the block of code to profile |
| volume | optional initial absolute volume to record with the measurement |
|
inline |
Returns true if the profiler is currently taking an active measurement.
| void Profiler::record | ( | const profiler::Measurement & | end | ) |
Take final measurement and record the delta between first and final.
|
static |
Take and return a single measurement.
| volume | optional current absolute volume to record with the measurement |