0

I found this site

http://www.guyrutenberg.com/2007/09/22/profiling-code-using-clock_gettime/

If I have a server-client code and this:

clock_gettime(CLOCK_REALTIME, &time_a); // create socket
clock_gettime(CLOCK_REALTIME, &time_b); // close socket

If I have a and b wand want to measure the time it takes to communicate, what's the best way ? Still not fully understanding the exact difference between

CLOCK_REALTIME
CLOCK_PROCESS_CPUTIME_ID
CLOCK_THREAD_CPUTIME_ID

And there are a few others.

Edited by XodoX

2
Contributors
3
Replies
11
Views
3 Years
Discussion Span
Last Post by NathanOliver
0

Thank you. So it dosen't really matter which one I use ? I don't understand the difference.

0

Well the different choices are for which clock to use. CLOCK_REALTIME uses the full system time. CLOCK_PROCESS_CPUTIME_ID uses the time in the process and CLOCK_THREAD_CPUTIME_ID uses the time from the thread. If you have c++11 I would really suggest using the high resolution clock from the chrono header.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.