- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using a large third-party open-source software with OpenMP. The "main" C++ function is located in a closed-source counter part.
I have added some OpenMP for directives and I would like to see how well or worse the performance has become.
I read the article on Using Pause/Resume API. However, I want to do the opposite of what is written there. I want the sampling to be Off during the whole duration. Then, it turns on right before the part where I placed my OpenMP directives. Then, it goes back off, until it re-reaches that OpenMP directive part again.
For example:
[cpp]#include
#include
int main () // I have no access to this part
{
//If I had access I can simply add VTPause()
time_t seconds;
while(...)
{
seconds = time (NULL);
// VTResume()
for(...)
printf ("%ld hours since January 1, 1970", seconds/3600);
// VTPause
}
return 0;
}[/cpp]
If that is not possible, then I would like to change my question to be that I want to calculate how much a certain function has taken. I have done some sampling in the past. But, the displayed information is just too much for me to know which one to look at. Many CLOCK columns.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As I understand from the tutorial, if I want to monitor a certain area with VTune, I should place a VTPause() a the beginning of the program, and then add a VTResume() right before the area where I want to monitor.
But, because I do not have access to the main function of the program, I want to know what kind of orgnization do I place the VTPause()/VTResume() in my program? Where should I place them if I have no access to the main function? Note, I want to monitor a very small area in a very large program.
Not quite right. When using VTune API, you start VTune collection in "paused" mode. This means that VTune doesn't collect any data until program execution reached VTResume() call. After that collection starts and then it goes until reaching VTPause() call. So, you can collect profiling data on any code region within your program, just put VTResume() before and VTPause() after the code of interest.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using a large third-party open-source software with OpenMP. The "main" C++ function is located in a closed-source counter part.
I have added some OpenMP for directives and I would like to see how well or worse the performance has become.
I read the article on Using Pause/Resume API. However, I want to do the opposite of what is written there. I want the sampling to be Off during the whole duration. Then, it turns on right before the part where I placed my OpenMP directives. Then, it goes back off, until it re-reaches that OpenMP directive part again.
For example:
[cpp]#include
#include
int main () // I have no access to this part
{
//If I had access I can simply add VTPause()
time_t seconds;
while(...)
{
seconds = time (NULL);
// VTResume()
for(...)
printf ("%ld hours since January 1, 1970", seconds/3600);
// VTPause
}
return 0;
}[/cpp]
If that is not possible, then I would like to change my question to be that I want to calculate how much a certain function has taken. I have done some sampling in the past. But, the displayed information is just too much for me to know which one to look at. Many CLOCK columns.
Hi,
May be I didn't get it what do you mean by saying that you "want to do the opposite of what is written there", but if you put the VTResume()call right before the omp for' pragma and the VTPause() call right after the end of scope, you'll get the sampling results over threads created ror your function. If you interested in measuring performance gain only, you may want to insert only time calls instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
May be I didn't get it what do you mean by saying that you "want to do the opposite of what is written there", but if you put the VTResume()call right before the omp for' pragma and the VTPause() call right after the end of scope, you'll get the sampling results over threads created ror your function. If you interested in measuring performance gain only, you may want to insert only time calls instead.
As I understand from the tutorial, if I want to monitor a certain area with VTune, I should place a VTPause() a the beginning of the program, and then add a VTResume() right before the area where I want to monitor.
But, because I do not have access to the main function of the program, I want to know what kind of orgnization do I place the VTPause()/VTResume() in my program? Where should I place them if I have no access to the main function? Note, I want to monitor a very small area in a very large program.
Can you tell me how to use those time calls?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
May be I didn't get it what do you mean by saying that you "want to do the opposite of what is written there", but if you put the VTResume()call right before the omp for' pragma and the VTPause() call right after the end of scope, you'll get the sampling results over threads created ror your function. If you interested in measuring performance gain only, you may want to insert only time calls instead.
I looked for what "time calls" are, but couldn't find them. Is there a closer keyword I can look for to find those?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As I understand from the tutorial, if I want to monitor a certain area with VTune, I should place a VTPause() a the beginning of the program, and then add a VTResume() right before the area where I want to monitor.
But, because I do not have access to the main function of the program, I want to know what kind of orgnization do I place the VTPause()/VTResume() in my program? Where should I place them if I have no access to the main function? Note, I want to monitor a very small area in a very large program.
Not quite right. When using VTune API, you start VTune collection in "paused" mode. This means that VTune doesn't collect any data until program execution reached VTResume() call. After that collection starts and then it goes until reaching VTPause() call. So, you can collect profiling data on any code region within your program, just put VTResume() before and VTPause() after the code of interest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I looked for what "time calls" are, but couldn't find them. Is there a closer keyword I can look for to find those?
By "time call" I was meaning just using Windows API time functions. Something liketimeGetTimeor QueryPerformanceCounter for better precision.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not quite right. When using VTune API, you start VTune collection in "paused" mode. This means that VTune doesn't collect any data until program execution reached VTResume() call. After that collection starts and then it goes until reaching VTPause() call. So, you can collect profiling data on any code region within your program, just put VTResume() before and VTPause() after the code of interest.
I see now. Thanks for clearing that out for me!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
By "time call" I was meaning just using Windows API time functions. Something liketimeGetTime or QueryPerformanceCounter for better precision.
I don't know what I pressed by mistake, and got those large fonts : ).
Anyway, thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
By "time call" I was meaning just using Windows API time functions. Something liketimeGetTime or QueryPerformanceCounter for better precision.
I have just finished adding QueryPerformanceCounter into my project. From what I can see, it is very precise. I used to use ctime's clock() function, which was nothing like this one.
Anyway, thank you for your help!!! : )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have just finished adding QueryPerformanceCounter into my project. From what I can see, it is very precise. I used to use ctime's clock() function, which was nothing like this one.
Anyway, thank you for your help!!! : )
You are welcome! Good to know that it helped :)

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page