You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include"dollar.hpp"// dollar is enabled by default. compile with -D$= to disable any profiling intmain() { $ // <-- put a dollar after every curly brace to determinate cpu cost of the scopefor( int x = 0; x < 10000000; ++x ) { $ // <-- functions or loops will apply too// slow stuff...
}
dollar::text(std::cout); // report stats to std::cout in text format; see also csv(), tsv() and markdown()dollar::chrome(std::ofstream("chrome.json")); // write tracing results to a json file (for chrome://tracing embedded profiler) dollar::clear(); // clear all scopes (like when entering a new frame)
}
API
Determinate the CPU cost of any scope by putting a $ dollar sign in front of it.
Or just insert an dollar raii("name") object.
The predefined $ macro just adds function name, line and number to the RAII object name.
Use dollar::text(ostream), dollar::csv(ostream), dollar::tsv(ostream) or dollar::markdown(ostream) to print a text report in any ostream object (like std::cout).
Additionally, use dollar::chrome(ostream) to write a chrome://tracing friendly json trace.
Finally, call dollar::clear() when entering a new frame.