In my program, it takes long to complete some loading routines. I would like a quick snippet to check how much time it took to execute the function. I mean little "preferably without 3rd party libraries".
Maybe the system is as easy as taking time?
start = current_system_time () load_something () delta = current_system_time () - get started log_debug ("loaded" + delta)
Edit: The target OS in the question is Windows
Your answer: Yes
WARNING: To work in no multihtreaded code or multiple core machines, you should have a strong wall-clock timer, so I recommend that you use the OMP wall. OMP has been included with VC and GCC, and most compilers and its standard do not require you to worry about the disappearance.
#include & lt; Omp.h & gt; // time measurement start dual start = omp_get_wtime (); // calculation to calculate ... // elapsed time double end = omp_get_wtime (); // time calculation (in seconds)
Comments
Post a Comment