Last Updated: February 25, 2016
·
917
· dmcrodrigues

time monitoring in C/C++

I developed a small library, <a href="https://github.com/dmcrodrigues/TimeMonitor">TimeMonitor</a>, to provide the capability of find time bottlenecks on code. It's written in C and can be easily used.

Basic usage

TimeMonitor *monitor = tm_init();

...

tm_start_profiling(monitor);

...

tm_add_timepoint(monitor, "some custom timepoint description");

...

tm_stop_profiling(monitor);

...

tm_print_info(monitor);

The results are presented as follows.

| timepoint  1 |      1 ms (  0.00%) | input-case generation completed |
| timepoint  2 |  14276 ms ( 99.00%) | selection sort completed |
| timepoint  3 |      0 ms (  0.00%) | check 100000 results from selection     sort algorithm completed |
------------------------------------------------------
[TOTAL] - elapsed time: 14278 (ms)

You can check the project on Github.

https://github.com/dmcrodrigues/TimeMonitor