This namespace provides the functions required to perform profiling of specific sections of code.
More...
This namespace provides the functions required to perform profiling of specific sections of code.
TO ACTIVATE THE PROFILER
Call the following functions to activate/deactivate it as needed:
- mysqlshdk::profiling::activate();
- mysqlshdk::profiling::deactivate();
Or do as follows to ensure it is active within a specific context:
mysqlshdk::profiling::activate(); auto finally = shcore::on_leave_scope([]() { mysqlshdk::profiling::deactivate(); });
TO ADD A MEASURING POINT WITHIN A THREAD
Call the following functions to measure the time spent between them:
- mysqlshdk::profiling::stage_begin("<MEASURE ID>");
- mysqlshdk::profiling::stage_end("<MEASURE ID>");
"<MEASURE ID>": Text to identify the context being measured.
Make sure the measure ID passed to both functions is the same. It will record a the number of milliseconds spend between both calls for each time the code is hit while the profiling is active.
To measure the time within a specific scope you can also use:
mysqlshdk::profiling::stage_begin("<MEASURE ID>"); shcore::on_leave_scope end_stage( []() { mysqlshdk::profiling::stage_end("<MEASURE ID>"); });
You can add as many measure points as needed.