Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

PGO: How to use Interval Profile Dumping with ICC 9.0 on Linux?

maverick6664
Beginner
547 Views
I am trying to use Interval Profile Dumping...I saw the document ( /opt/intel/cc/9.0/doc/main_cls/mergedProjects/optaps_cls/common/optaps_pigs_int.htm) and tried with this small testcase.

This is supposed to dump profile information every 2 seconds (if I understand correctly, and I hope so.)

---prof-dump1.c----
#include
#include

int
main()
{
int i;

_PGOPTI_Set_Interval_Prof_Dump(2000);

for (i=0;;i++){
printf("hello world! %4d ", i);
sleep(1);
}

return 0;
}
-------------------

I compiled with -prof-gen option, and run it, but no .dyn file is produced. I also tried "PROF_DUMP_INTERVAL" environment variable, but in vain.

How can I utilize this function?

BTW as a matter of course, if I modify this program so it finishes normally (for ex, add condition i 10 or so) it creates a .dyn file.

Thanks in advance.
0 Kudos
7 Replies
Maximillia_D_Intel
547 Views
Hi,
The issue is that for the profile dumps to occur, there needs to be a call to an instrumented function (the interval check is at the top of an instrumented function). Your code is a for loop containing no instrumented functions so the profile never gets a chance to be dumped.
Try adding a call to another function that you know is in your compiled source (it's instrumented) and it should work.
Please let me know if this helps.
Thanks,
Max
0 Kudos
maverick6664
Beginner
547 Views
Thank you.....

I found two dumping functions
_PGOPTI_Prof_Dump(void);
_PGOPTI_Prof_Dump_And_Reset(void);

but these functions dump .dyn file each time they are called; not with an interval....even with
_PGOPTI_Set_Interval_Prof_Dump(2000);
it doesn't work.

How can I dump .dyn files with an interval?

Thanks in advance.

Message Edited by maverick6664 on 07-07-2005 06:10 AM

0 Kudos
Maximillia_D_Intel
547 Views
Hi,
I don't think I was clear.You don't need to explicitly call the dumping functions; you just need a call to another function inside of the kernel of your code, where the kernel is the subset of code that is 'always' running. This other function needs to be compiled with the profile generation switch so that it is instrumented. Part of the instrumentation is a check against the interval to see if it's time to dump the profile information.
Please let me know if this helps,
Max
0 Kudos
maverick6664
Beginner
547 Views
Thank you, but I don't understand yet...

Do you mean just a part of the application should be compiled with -prof-gen ? But I want to use PGO over the whole application..

Now I'm thinking of putting these dumping functions in a periodically called function which is called every 5 minutes or so. But since ICC has _PGOPTI_Set_Interval_Prof_Dump(int interval), I want to use it if possible....

Thanks in advance.
0 Kudos
Maximillia_D_Intel
547 Views
Hi,
Here's an explicit example of what I mean:
int foo()
{
return 1;
}
int bar()
{
while (1) {
foo();
printf("hey ");
}
}
This program should dump profile information using the interval profiling as long as the file that contained bar and foo where compiled with the prof_gen option. In the compiled version of foo, there will be a check to see if the interval has been met and if it's time to dump the profile.
If the foo function is not in the while loop (which would be similar to your for loop that contains functions not compiled with prof_gen), the interval profiling would not work. No instrumentedfunction would be called inside of the for loop so that the interval check could occur.
So try adding a call to a function (that is in the same file)similar to what I have done (inside your for loop)and see if you get better results.
Max
0 Kudos
maverick6664
Beginner
547 Views
Thank you! It worked!!

I can proceed.
0 Kudos
Christina_C_Intel
547 Views
I am having trouble creating the .dyn on Windows. When I run a program (ie. the program in the previous threads)on Linux it creates the .dyn files,but on windows it does not. I am using the /Qprof_gen switch. Does something need to be done differently on Windows than on Linux? I am using the same file and switch, so I am not sure why it behaves differently on Windows.
Thanks
0 Kudos
Reply