measuring idle time of worker threads

measuring idle time of worker threads

I have a threaded application with timing blocks around all the sections of code I *believe* are performance intensive.  These sections are long enough that the timing code can remain active even in final production runs.

In my current custom implementation of a thread pool, I compute two extra times for each worker thread: (1) the amount of idle time spent waiting on an empty pool for a job to arrive and (2) the amount of "missing" time not accounted for by either idling or a timing block (indicating a performance intensive region that I've missed).

Is it possible to measure idle time when using TBB tasks?  The sum of idle time and missing time can easily be computed by subtracting each timed section from the total wall clock interval, but getting at each separately requires special support (or perhaps a special idle task with low priority that spins trying to preempt itself?).

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I asked this question at http://stackoverflow.com/questions/11926270/measuring-thread-idle-time-w... as well, and will synchronize answers.

Login to leave a comment.