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?).