Shreyas Pophli(deleted)
|
Runtime measurement for process and threads
|
Shreyas Pophli(deleted)
08/02/2018 1:58 AM
post119031
|
Runtime measurement for process and threads
I want to measure the time taken by a process and several threads inside it individually.
Say my process has 10 threads, I need to measure the runtime of individual thread and also the process allocated time
for individual thread in the best possible resolution.
I am using following API's:
For process :
ClockCycles(): This gives time in microseconds resolution.
For thread:
Pthread_getcpuclockid() , followed by clock_gettime() for thread ID.
I however see huge difference in both the values i.e process allocated time for thread and thread actual runtime.
Logic used: start() is called at start of thread execution and stop() at end. Time stamps are taken at start() and
stop() and difference is calculated.
Please suggest some better way.
|
|
|