Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Runtime measurement for process and threads: (1 Item)
   
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.