Community
cancel
Showing results for 
Search instead for 
Did you mean: 
explore_zjx
Beginner
87 Views

how to collect data when vtune API was used?

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
87 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
explore_zjx
Beginner
87 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?
Peter_W_Intel
Employee
87 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




explore_zjx
Beginner
87 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.
Peter_W_Intel
Employee
87 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
explore_zjx
Beginner
87 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.
Peter_W_Intel
Employee
87 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-vtun...

-peter
Reply