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

how to collect data when vtune API was used?

explore_zjx
Beginner
344 Views
Hi, everyone,
I am using Vtune API instrument my code by calling the VTResume() and VTPause() function. Now my quistion is how to collect data when VTPause() was called. And after collecting data, reset the Vtune. Fox example, I want to do the following sampling.
for (int i=0;i<100000;i++)
{
if (i %50 ==0)
{ VTResume();}

do some work;

if (i>=(i+20))
{
VTPause();
//here I want to collect data and after collect data, I must reset the vtune.
//how to implement this?
}
I mean I want to get the following data respectively. Is there a possibility that collecting data for one run?
iterations 0-20: some event data
iterations 50-70: some event data
iterations 100-120:some event data
.....
.....

any suggestions? Thanks for responsing!
0 Kudos
7 Replies
Peter_W_Intel
Employee
344 Views
Quoting - explore_zjx
Hi, everyone,
I am using Vtune API instrument my code by calling the VTResume() and VTPause() function. Now my quistion is how to collect data when VTPause() was called. And after collecting data, reset the Vtune. Fox example, I want to do the following sampling.
for (int i=0;i<100000;i++)
{
if (i %50 ==0)
{ VTResume();}

do some work;

if (i>=(i+20))
{
VTPause();
//here I want to collect data and after collect data, I must reset the vtune.
//how to implement this?
}
I mean I want to get the following data respectively. Is there a possibility that collecting data for one run?
iterations 0-20: some event data
iterations 50-70: some event data
iterations 100-120:some event data
.....
.....

any suggestions? Thanks for responsing!

I think,in generalusingVTuneAPIs in "branch" code is dangerous, sinceVTuneResume()->VTuneResume() or VTPause()->VTunePause() sequencemay happen to cause unexpected results.

However it seems that the flow of youriterations is well controlled.
1) Startdata collection in "Paused" mode.
2)When iteration is 0, 50, 100, ... to resume data collection.
3) When iteration is 21, 71, 121, ... to pause data collection (Why did you say "I must reset the vtune"? No, you don't need to reset it!)
4) When loop completed, use VTStop() to finish data collection and save data.

Regards, Peter
0 Kudos
explore_zjx
Beginner
344 Views

I think,in generalusingVTuneAPIs in "branch" code is dangerous, sinceVTuneResume()->VTuneResume() or VTPause()->VTunePause() sequencemay happen to cause unexpected results.

However it seems that the flow of youriterations is well controlled.
1) Startdata collection in "Paused" mode.
2)When iteration is 0, 50, 100, ... to resume data collection.
3) When iteration is 21, 71, 121, ... to pause data collection (Why did you say "I must reset the vtune"? No, you don't need to reset it!)
4) When loop completed, use VTStop() to finish data collection and save data.

Regards, Peter

Hi, Peter
Thanks for your response.
Maybe you misunderstand my meaning.
In the loop, I want to record the event number such as L2 miss number, for a short iterations. For example, I want to know the L2 miss number between iteration 50and iteration 70. And also I want to know the L2 misses between iteration 71 and iteration 90. I want to know the L2 misses in the relatively short period. I am not interesting in the total number. I'm interesting inthe L2 misses duringin the20 iterations. so I want to reset the Vtune.
However, I think I can't gain the data through one time run of the application. Am I right?
0 Kudos
Peter_W_Intel
Employee
344 Views
Quoting - explore_zjx

Hi, Peter
Thanks for your response.
Maybe you misunderstand my meaning.
In the loop, I want to record the event number such as L2 miss number, for a short iterations. For example, I want to know the L2 miss number between iteration 50and iteration 70. And also I want to know the L2 misses between iteration 71 and iteration 90. I want to know the L2 misses in the relatively short period. I am not interesting in the total number. I'm interesting inthe L2 misses duringin the20 iterations. so I want to reset the Vtune.
However, I think I can't gain the data through one time run of the application. Am I right?

I get confused, because you said -

" iterations 0-20: some event data
iterations 50-70: some event data
iterations 100-120:some event data
...
"
I don't understand what you meant for "reset vtune"! I guess that you meant to run data collection in another session.

As I mentioned in previous post:
1. If you can understand control flow of code, you can run data collection in one session
2. If you can't understand control flow of code, you can run data collection in multiple session for different interest of code area.

-Peter




0 Kudos
explore_zjx
Beginner
344 Views

I get confused, because you said -

" iterations 0-20: some event data
iterations 50-70: some event data
iterations 100-120:some event data
...
"
I don't understand what you meant for "reset vtune"! I guess that you meant to run data collection in another session.

As I mentioned in previous post:
1. If you can understand control flow of code, you can run data collection in one session
2. If you can't understand control flow of code, you can run data collection in multiple session for different interest of code area.

-Peter





Hi, Peter
I 'm sorry for bothering you again. reset vtune, I mean vtune re-sampling. In other words, vtune discard the prior sampling result. the prior L2 miss count is discard, and recount the L2 miss number. I don't know whether you understand. sorry for my unclear expression.
0 Kudos
Peter_W_Intel
Employee
344 Views
Quoting - explore_zjx

Hi, Peter
I 'm sorry for bothering you again. reset vtune, I mean vtune re-sampling. In other words, vtune discard the prior sampling result. the prior L2 miss count is discard, and recount the L2 miss number. I don't know whether you understand. sorry for my unclear expression.

No problem. If you want to discard current sampling result, you have to 1) Use VTStop to stop this session. 2) Use VTStart to invoke another sampling session.

-Peter
0 Kudos
explore_zjx
Beginner
344 Views

No problem. If you want to discard current sampling result, you have to 1) Use VTStop to stop this session. 2) Use VTStart to invoke another sampling session.

-Peter

hi, Peter
I want to know how to read the sample result use vtuneAPI ? After I stop a vtune session, I want to read the sample data which vtune collected. and then ivoke another sampling session. Sorry for bothering again. And I can't any clues by searching the google site. So ask for your help.
thanks in advance.
0 Kudos
Peter_W_Intel
Employee
344 Views
Quoting - explore_zjx

hi, Peter
I want to know how to read the sample result use vtuneAPI ? After I stop a vtune session, I want to read the sample data which vtune collected. and then ivoke another sampling session. Sorry for bothering again. And I can't any clues by searching the google site. So ask for your help.
thanks in advance.

I remember that I have a post about using VTune APIs, please http://software.intel.com/en-us/articles/use-vtuneapi-in-your-code-to-profile-without-launching-vtunetm-analyzer/

-peter
0 Kudos
Reply