- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a simple way to make vtune (2019) count the number of times a function has been called?
- Tags:
- Debugging
- Development Tools
- General Support
- Intel-Advisor
- Optimization
- Parallel Computing
- Vectorization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out.
For your information,vtune will let you know the time spent in each function but it will not have the count of function calls.For more information refer the below comment
https://software.intel.com/en-us/forums/vtune/topic/856379#comment-1958661
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
you can use ITT tasks or counters for that. https://software.intel.com/content/www/us/en/develop/documentation/vtune-help/top/api-support/instrumentation-and-tracing-technology-apis/instrumentation-and-tracing-technology-api-reference/counters-api.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for quick answers. My problem is that i have a very large program with several 100s of functions that are called depending on a rather complicated tree of control structures, and the functions are often called several 1000 times. I am profiling two different runs with slightly different input. I would expect identical output, despite the different input. My suspicion is that that somewhere during the run, an erroneous control statement leads to a wrong function being called.
I thought a useful and simple proxy to look at in order to identify how the two runs differ would be to look at the # times the different functions have been called as this seems to be standard output of other profilers, but I suppose this is perhaps not possible by default for vtune? I tried to activate the instrument-functions option during compilation, but I was unable to see any change of the results presented by vtune, and I was also unable to find relevant documentation for this.
Anyways, is there a good, alternative way to analyse a situation like mine where I need to compare two almost identical runs and figure out where they differ? In this particular case, it would help me a lot if I know e.g. the order of the functions called. Of course, I could manually modify the code to track this information, but would it not be a somewhat standard thing to track by a profiler such as vtune?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The traditional way to count function calls and record their calling trees is with "gprof".
With gcc compilers, you add "-pg" to the compile and link statements. Upon execution, the program produces a "gmon.out" file which can be processed by "gprof" to see the time spent in each function, with attribution of the function calls up the relevant calling tree.
With Intel compilers, the "-p" option sets up for the same sort of analysis.
Both gcc and Intel compilers support the "-finstrument-functions" compiler option. This causes the compiler to emit code on entry and exit to every function, which calls a user-provided routine and passes pointers to the current routine and its caller. These can be used to count function invocations, build calling stacks, install performance counter instrumentation, etc. The main disadvantage of this approach is that it disables function inlining. If you call lots of tiny functions, this can lead to a significant performance penalty. For both gcc and Intel compilers, you can add
__attribute__((__no_instrument_function__))
to a function to prevent it from being instrumented (and allow it to be inlined).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, Dr. Bandwidth
It seems that this option is not available for the Windows version of the compiler. Unfortunately, I am stuck with Windows. Does this mean that the function calls calls cannot be instrumented?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am afraid I can't help with Windows questions -- I have not had a windows machine in over five years, and never had a good compiler on one anyway....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for the update.
Could you let us know which Vtune version you are using?
If it is before 2019 u4 we had call count option but the latest version of Vtune doesn’t have this feature.You can also try Intel Advisor for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Janani: I use version 2019 update 6. I also have Intel Advisor 2019. Is there way to show see a function count using Intel Advisor?
Thanks
PS: Also thank you, Dr. Bandwidth for looking into this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for the update.
Kindly follow the procedures mentioned in the below link and let us know the updates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Has this issue been resolved?Could you give us an update?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As Janani already mentioned, there is a dedicated tool to do Call Counts computations.
This is "Intel Advisor TripCounts" analysis. Note that this provides you with exact (precise) loops tripcount and loops/function call counts data.
In order to obtain this data you have to first run Advisor Survey analysis and afterwards Run Advisor TripCounts (FLOP and Tripcounts check-boxes ON at the workflow). The same can be done via command line.
See below:
Regards
Zakhar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We are closing the case assuming that your issue got resolved.Please raise a new thread in case of any further issues.
Thanks.
![](/skins/images/B7BA37F9CE4B52FF7CAE1FB0388839C8/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page