Hermes
|
Hermes provides a profiling tool to track your code performance, the hermes::profiler::Profiler singleton class. It works by registering blocks that represent execution time of code sections, scopes and functions. Each block receives a name (and a color if you want), so you can analyze your data later.
You can profile your code by using a set of macros like this:
The profiler uses with a simple stack to manage block creation and completion. So remember to finish blocks consistently.
You can access the history of blocks as well:
Sometimes you don't want to store all blocks created since the start of your program, maybe to save memory. You can limit the profiler to keep only the last n
blocks by calling:
You can also enable or disable the profiler in runtime with the following macros, respectively:
Sometimes, it is also useful to set colors for your blocks. The block label struct holds a field u32 color;
for that purpose. You can encode your color in this unsigned integer the way you prefer, but hermes
provide a namespace containing u32
colors for you called hermes::argb_colors. You can set the block's color with the same profiling macros: