PAPI_profil(3) | PAPI | PAPI_profil(3) |
PAPI_profil -
Generate a histogram of hardware counter overflows vs. PC addresses.
C Interface:
Fortran Interface
Parameters:
Return values:
PAPI_profil() provides hardware event statistics by profiling the occurrence of specified hardware counter events. It is designed to mimic the UNIX SVR4 profil call.
The statistics are generated by creating a histogram of hardware counter event overflows vs. program counter addresses for the current process. The histogram is defined for a specific region of program code to be profiled, and the identified region is logically broken up into a set of equal size subdivisions, each of which corresponds to a count in the histogram.
With each hardware event overflow, the current subdivision is identified and its corresponding histogram count is incremented. These counts establish a relative measure of how many hardware counter events are occurring in each code subdivision.
The resulting histogram counts for a profiled region can be used to identify those program addresses that generate a disproportionately high percentage of the event of interest.
Events to be profiled are specified with the EventSet and EventCode parameters. More than one event can be simultaneously profiled by calling PAPI_profil() several times with different EventCode values. Profiling can be turned off for a given event by calling PAPI_profil() with a threshold value of 0.
Representative values for the scale variable
HEX DECIMAL DEFININTION 0x20000 131072 Maps precisely one instruction address to a unique bucket in buf. 0x10000 65536 Maps precisely two instruction addresses to a unique bucket in buf. 0x0FFFF 65535 Maps approximately two instruction addresses to a unique bucket in buf. 0x08000 32768 Maps every four instruction addresses to a bucket in buf. 0x04000 16384 Maps every eight instruction addresses to a bucket in buf. 0x00002 2 Maps all instruction addresses to the same bucket in buf. 0x00001 1 Undefined. 0x00000 0 Undefined.
Historically, the scale factor was introduced to allow the allocation of buffers smaller than the code size to be profiled. Data and instruction sizes were assumed to be multiples of 16-bits. These assumptions are no longer necessarily true. PAPI_profil() has preserved the traditional definition of scale where appropriate, but deprecated the definitions for 0 and 1 (disable scaling) and extended the range of scale to include 65536 and 131072 to allow for exactly two addresses and exactly one address per profiling bucket.
The value of bufsiz is computed as follows:
bufsiz = (end - start)*(bucket_size/2)*(scale/65536) where
Defined bits for the flags variable:
Example
int retval; unsigned long length; PAPI_exe_info_t *prginfo; unsigned short *profbuf; if ((prginfo = PAPI_get_executable_info()) == NULL)
handle_error(1); length = (unsigned long)(prginfo->text_end - prginfo->text_start); profbuf = (unsigned short *)malloc(length); if (profbuf == NULL)
handle_error(1); memset(profbuf,0x00,length); if ((retval = PAPI_profil(profbuf, length, start, 65536, EventSet,
PAPI_FP_INS, 1000000, PAPI_PROFIL_POSIX | PAPI_PROFIL_BUCKET_16))
!= PAPI_OK)
handle_error(retval);
See Also:
PAPI_sprofil
Generated automatically by Doxygen for PAPI from the source code.
Mon Nov 14 2022 | Version 7.0.0.0 |