Time stamping kernel activity - To analyze the kernel operation

Rough workflow of my code -
-Each thread is in a continuous while loop - persistent thread
-There is a global worklist - threads read work units from this worklist - process them - may or maynot add new work back to the worklist.

  • This producer-consumer cycle goes on till there is no work in the list AND all threads are also idle (this is the convergence/exit condition)

Now, there are times when threads/thread blocks are waiting for other threads to produce some work (other threads are busy working)
I wish to time-stamp this wait - or in some way know for how much time a thread had to wait before new work was added to the list and It was able to read that new work.

Are there any suggestions for this?

Basically I wanna have my own timing function through which i can time such waits in the kernel.


So, what’s the problem? Use clock()?

I believe clock() has a 32 bit return value. If you must be sure, you can use inline ptx to get the 64 bit counter too.

Or use [font=“Courier New”]clock64()[/font]?

thanks guys. I will look into it.

Ah! Beautiful! Thanks tera. I could swear I didn’t see that in one of the previous versions of the guide, but it’s there in 4.2. :)