Support for Analyzers (Intel VTune™ Profiler, Intel Advisor, Intel Inspector)
4699 Discussions

How to detect that user task analysis is active?


We would like to add user task analysis to a project. The collection in our case is best achieved using a callback registration mechanism, which has a bit of overhead, but has the advantage that the overhead could potentially zero in case no user task analysis has been requested.

To achieve this, we check the domain->flag to see if analysis is active, and only in that case register the callbacks. Unfortunately, it seems that the flag is non-zero as soon vtune is attached (regardless if user task analysis has been requested or not).

Is there a way to check from within the application if user task analysis has been requested?



0 Kudos
1 Reply

Hi Stephan,

I think there is no easy way to detect from a user app whether User Task Analysis is enabled. 
In my opinion, as it's a static mechanism of registering call backs, its control should be done at compile time as well. But if you decide to take a risk and leave the itt library linked with your production app, than you should expect it is launched under profiler and the callbacks are active (creating some overhead). In this case you can only control by checking "if (profile == TRUE)" condition before calling itt API functions in your code.