Interval Profile Dumping

The _PGOPTI_Set_Interval_Prof_Dump() function activates Interval Profile Dumping and sets the approximate frequency at which dumps occur. This function is used in non-terminating applications.

The prototype of the function call is listed below.

Syntax

void _PGOPTI_Set_Interval_Prof_Dump(int interval);

This function is used in non-terminating applications.

The interval parameter specifies the time interval at which profile dumping occurs and is measured in milliseconds. For example, if interval is set to 5000, then a profile dump and reset will occur approximately every 5 seconds. The interval is approximate because the time-check controlling the dump and reset is only performed upon entry to any instrumented function in your application.

Setting the interval to zero or a negative number will disable interval profile dumping, and setting a very small value for the interval may cause the instrumented application to spend nearly all of its time dumping profile information. Be sure to set interval to a large enough value so that the application can perform actual work and substantial profile information is collected.

The following example demonstrates one way of using interval profile dumping in non-terminating code.

Example

#include <stdio.h>

// The next include is to access

// _PGOPTI_Set_Interval_Prof_Dump_All

#include <pgouser.h>

int returnValue()

{ return 100; }

int main()

{

int ans;

printf("CTRL-C to quit.\n");

_PGOPTI_Set_Interval_Prof_Dump(5000);

while (1)

ans = returnValue();

}

You can compile the code shown above by entering commands similar to the following:

Operating System

Example

Linux* and Mac OS* X

icc -prof-gen -o intrumented_number number.c

Windows*

icl /Qprof-gen /Feinstrumented_number number.c

When compiled, the code shown above will dump profile information a .dyn file about every five seconds until the program is ended.

You can use the profmerge tool to merge the .dyn files.

Recommended usage

Call this function at the start of a non-terminating user application to initiate interval profile dumping. Note that an alternative method of initiating interval profile dumping is by setting the environment variable INTEL_PROF_DUMP_INTERVAL to the desired interval value prior to starting the application.

Using interval profile dumping, you should be able to profile a non-terminating application with minimal changes to the application source code.