|
Hermes
|
Singleton code profiler. More...
#include <profiler.h>
Classes | |
| class | Block |
| Holds a labeled profiler block with start/end time points. More... | |
| struct | BlockDescriptor |
| Describes a block label. More... | |
| class | ScopedBlock |
| RAII Profiler Block. More... | |
Public Member Functions | |
| Profiler (Profiler &&other)=delete | |
| Profiler (const Profiler &other)=delete | |
| Profiler & | operator= (const Profiler &other)=delete |
| Profiler & | operator= (Profiler &&other)=delete |
Static Public Member Functions | |
| static const std::vector< Block > & | blockList () |
| Raw block data. | |
| static const BlockDescriptor & | blockDescriptor (const Block &block) |
| Get block descriptor from block. | |
| static u64 | initTime () |
| Get time point when Profiler was instantiated. | |
| static i64 | cpuFrequency () |
| Computed CPU frequency. | |
| static bool | isEnabled () |
| Checks if Profiler is currently enabled. | |
| static void | enable () |
| Enables Profiler. | |
| static void | disable () |
| Disables Profiler. | |
| static u32 | pushBlockDescriptor (const char *name, u32 color=argb_colors::Default) |
| Registers a new block description. | |
| static void | startBlock (Block &block) |
| Starts a new block by taking this call time point. | |
| static void | endBlock () |
| Finishes the block at the top of the stack. | |
| static void | setMaxBlockCount (size_t max_block_count) |
| Sets a limit into the maximum number of stored blocks. | |
| static void | reset () |
| Clears all blocks. | |
| static void | iterateBlocks (const std::function< void(const Block &)> &f) |
| Iterates over stored blocks sequentially. | |
| static std::string | dump () |
| Dumps profiling into a string. | |
Singleton code profiler.
This profiler works by registering a sequence labeled blocks (time intervals). The labeled blocks can represent blocks of code lines, functions bodies and sections. Blocks can also reside inside other blocks constituting hierarchies - useful to find out which section of a function is slower for example.
Ideally, the class should be used indirectly by the auxiliary MACROS. Here is an example of different types of blocks being used:
|
static |
Get block descriptor from block.
| block |
|
static |
Raw block data.
|
static |
Computed CPU frequency.
|
static |
Finishes the block at the top of the stack.
|
static |
Get time point when Profiler was instantiated.
|
static |
Checks if Profiler is currently enabled.
|
static |
Iterates over stored blocks sequentially.
| f | callback function for each block |
|
static |
Registers a new block description.
| name | |
| color |
Sets a limit into the maximum number of stored blocks.
| max_block_count |
|
static |
Starts a new block by taking this call time point.
| block |