Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)

Intel VTune Profiler for time spent per function call

Jutt__Bobby
Beginner
2,736 Views

Hi amazing support :-)

 

I have a question. Does Intel VTune profiler gives an option to see the time per call....I mean time per function call... 'time in sec' spent in each function. Is there any option that can be used in the command window, that would help me know the time, in seconds, spent in each function in my C ++ application?

 

Thanks in advance !

0 Kudos
1 Solution
McCalpinJohn
Honored Contributor III
2,736 Views

I am not sure if this answers the original question....

VTune will certainly show an estimate of the total time spent executing a function, but I don't think that it tracks the number of times the function was called while the measurements were occurring.   Since VTune uses a "sampling" methodology, a particular function will be sampled 0, 1, or more times per function execution -- mostly depending on how long the function executes. 

If you run the measurements for the duration of the program execution and happen to know how many times the function was called, then you can divide the estimated total time for the function from VTune by the number of executions that you think happened to get the average time per function invocation. 

The Intel C compiler has an option "-finstrument-functions" to generate "wrapper" calls at the entry and exit of each function.  These can be used to collect statistics on function calls, including timers or performance counters, and provide both the function address and the call site address so that you can build call trees.  This instrumentation disables function inlining, unless you instrument a function with a magical "__attribute__((__no_instrument_function__))" annotation.  In that case the function will be eligible for inlining, but inlined copies will not generate instrumentation calls.....

View solution in original post

8 Replies
ArunJ_Intel
Moderator
2,736 Views

Hey Bobby,

 

You can run vtune hotspot analysis for viewing time per function. Time per function can be seen in the bottom-up as well as caller callee pane of the vtune report generated.  You can find more information regarding running hotspot analysis in the below link.

https://software.intel.com/en-us/vtune-help-running-basic-hotspots-analysis-from-the-command-line

 

After performing an analysis via the command line, you can view command line results in the GUI to get full benefits of VTune Profiler GUI tools, or you can view a report from the command line. A variety of report types, filtering and formatting options are available. Please visit the below link for more details on generating command line reports

 

https://software.intel.com/en-us/vtune-help-generating-command-line-reports

 

Arun Jose

0 Kudos
Jutt__Bobby
Beginner
2,736 Views

Hi Arun, 

Thanks for the helping reply....Is it also possible to view time per function straight from the GUI? Or one has to use command line always?

0 Kudos
ArunJ_Intel
Moderator
2,736 Views

Hey Bobby, 

It is possible to see the time per function from the GUI

 

Arun Jose

0 Kudos
Kirill_U_Intel
Employee
2,736 Views

Hi, Bobby.

You could open bottom-up pane for hotspot analysis view, for example

https://software.intel.com/en-us/vtune-help-window-bottom-up

F021DC2F-96E9-48A3-B6D4-58BAEEFAD405-imageId=D263BC36-BA7C-48D5-B270-245A6E60C62A.png

0 Kudos
ArunJ_Intel
Moderator
2,736 Views

Hi Bobby,

Hope that answers your query . Could you please confirm if we could close this case.

 

 

Arun Jose

0 Kudos
McCalpinJohn
Honored Contributor III
2,737 Views

I am not sure if this answers the original question....

VTune will certainly show an estimate of the total time spent executing a function, but I don't think that it tracks the number of times the function was called while the measurements were occurring.   Since VTune uses a "sampling" methodology, a particular function will be sampled 0, 1, or more times per function execution -- mostly depending on how long the function executes. 

If you run the measurements for the duration of the program execution and happen to know how many times the function was called, then you can divide the estimated total time for the function from VTune by the number of executions that you think happened to get the average time per function invocation. 

The Intel C compiler has an option "-finstrument-functions" to generate "wrapper" calls at the entry and exit of each function.  These can be used to collect statistics on function calls, including timers or performance counters, and provide both the function address and the call site address so that you can build call trees.  This instrumentation disables function inlining, unless you instrument a function with a magical "__attribute__((__no_instrument_function__))" annotation.  In that case the function will be eligible for inlining, but inlined copies will not generate instrumentation calls.....

ArunJ_Intel
Moderator
2,734 Views

Hi Bobby,

 

Hope that answers your query. Could you please confirm if we could close this case.

 

 

Arun Jose

0 Kudos
ArunJ_Intel
Moderator
2,734 Views

Hi Bobby,

We are closing this case assuming the solution provided helps. Please feel free to raise a new thread in case of further issues.

 

Arun Jose 

0 Kudos
Reply