Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Measuring Profile information

Shankar1
Beginner
470 Views
I have an application which uses TBB scheduler under the hood. I have lot of recursive parallel tasks which are being operated by the scheduler. I would like to measure some information from with in the application like Task pool size, Average Task execution time, Task throughput time, Task wait time, number of stolen tasks etc at every thread level.

Is there a way by which I can gather this information?

--------
Sankar
0 Kudos
4 Replies
robert-reed
Valued Contributor II
470 Views
Well, the source code for the scheduler is available from the open source site so the ultimate answer (and cop-out) is that you can add whatever instrumentation you want to the scheduler. ;-) Unfortunately, my quick scan of a recent source distribution did not reveal any built-in hooks, either permanently available or available as a compile time option. Perhaps one of the developers has something squirrelled away, but I'd be very careful about adding anything to the schedulersince code added in the wrong place could Heisenberg itsinstrumented behaviorinto a different reality fromthe non-instrumented cases.
0 Kudos
Shankar1
Beginner
470 Views
Thank you for your reply. Well adding to the TBB source code is a solution that I was thinking of from earlier. I even did some profiling to some extent in a custom profile mode of tbb build that I had made. But the problem with this is that I will have to merge this code every time TBB makes a release, which is a big pain.

Then I had a look at the tbb_scheduler_observer class which can monitor the scheduler to some extent. So I was thinking why can this class be not extended further so that I can get all the profiling information that I want. That way I would be implementing things outside of TBB than trying to meddle/fight with the TBB source code.


Sankar
0 Kudos
Anton_Pegushin
New Contributor II
470 Views
Hi, I talked to the TBB development people and apparently there is a macro that you can use to make TBB provide you lots and lots of stats on tasks and threads lifecycle. The macro is __TBB_STATISTICS and more details on what it turns on could be found intbb_statistics.h/cpp files. Of course, this applies to open-source version of TBB, as you'd have to rebuild the library to see statistics.
0 Kudos
Shankar1
Beginner
470 Views
Oh I dint notice this before. Thanks for the pointer. I think this will help.
0 Kudos
Reply