Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
25 Views

How does Intel's VTune works?

I need to optimize a program on Intel's XScale, so I use VTune to
find the hot spot. I use
sampling to locate the hot spot.
At first, the functions lists according to its used time
Function
A
B
C
D
E

But after I have written assembly source for A, and run VTune again,
but the result is confusing
C
B
A
E
D

XScale hardware provides several performance counter.
Each counter can trigger interrupts, and VTune do the time statistics
in ISR.
Using sampling, VTune interrupts the program at interval.
For example, there are two functions in a souce file:
void A
{
a1;
a2;
-------------- trigger a interrupt
a3;
a4;

}

void B
{
b1;
b2;
--------------- trigger a interrupt
b3;
b4;

}

VTune will consider the time between interrupts is consumed by B?
How does VTune do?
0 Kudos
1 Reply
Highlighted
Employee
25 Views

The VTune analyzer doesn't really "consider" time at all! When the interrupt occurs because of an event trigger, the VTune analyzer ISR records the things like process ID, thread ID, and instruction pointer. Later, during post-processing, because it has collected info about modules, processes, and threads, it can determine which functions in which modules in which thread in which process the sample was taken. Thus, the info displayed is the number of samples that occurred within that function (for the selected process/thread/module).

So, in your example, the interrupt in function A() results in a sample being recorded in function A(). Likewise, the interrupt in function B() results in a sample being recorded in function B(). Sampling presents a "statistical" representation of relative active-ness of various parts of the code.

Thus, what your results confirmed was that your assembly version resulted in fewer samples occurring in that function than when it was written in the high-level language (assuming the order is sorted from highest to lowest and that it was a high-level language, initially :-).
0 Kudos