how to calculate processing time in milliseconds

Feb 5, 2013 at 1:48pm
I want to calculate processing time in milliseconds as most of function I found give me in second. I am new user to C++, the code will be running under linux.


Regards
Feb 5, 2013 at 2:15pm
In windows, I like to use
QueryPerformanceCounter and QueryPerformanceFrequency

http://msdn.microsoft.com/en-us/library/windows/desktop/ms644904(v=vs.85).aspx
Feb 5, 2013 at 2:36pm
with Linux, you have many options:
high_resolution_clock from C++ (http://en.cppreference.com/w/cpp/chrono )
microsec_clock from boost (http://www.boost.org/doc/libs/release/doc/html/date_time/posix_time.html )
clock_gettime from POSIX (http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html )
and probably something linux-specific, too.

There's also the commandline utility and the shell builtin time which measures wall time, CPU time, and system time spent by a given application.
Last edited on Feb 5, 2013 at 2:39pm
Feb 5, 2013 at 4:04pm
high_resolution_clock from C++ (http://en.cppreference.com/w/cpp/chrono )


That's Awesome.
Feb 5, 2013 at 4:13pm
The clocks in <chrono> are wall clocks; they deal with elapsed time.
Feb 8, 2013 at 2:30pm
Thanks a lots,,,
Topic archived. No new replies allowed.