|
NAME
PAPI_profil, PAPI_sprofil - generate PC histogram data where hardware counter overflow occurs
CONTENTS
Synopsis
Description
Arguments
Return Values
Errors
Examples
Author
Bugs
See Also
SYNOPSIS
C Interface
#include <papi.h>
int PAPI_profil(unsigned short * buf, unsigned bufsiz, unsigned long offset, unsigned scale, int EventSet,
int EventCode, int threshold, int flags );
int PAPI_sprofil(PAPI_sprofil_t * prof, int profcnt, int EventSet, int EventCode, int threshold, int flags );
Fortran Interface
#include fpapi.h
PAPIF_profil(C_INT(*) buf, C_INT bufsiz, C_INT offset, C_INT scale, C_INT EventSet,
C_INT EventCode, C_INT threshold, C_INT flags, C_INT check )
DESCRIPTION
PAPI_profil() uses its first four parameters to create the data structures needed by PAPI_sprofil
and then calls PAPI_sprofil to do the work.
PAPI_sprofil() assumes a preinitialized sprofil structure, and initiates profiling based on its values.
ARGUMENTS
*buf -- pointer to profile buffer array.
bufsiz -- number of entries in *buf.
offset -- starting value of lowest memory address to profile.
scale -- scaling factor for bin values.
EventSet -- The PAPI EventSet to profile when it is started.
EventCode -- Code of the Event in the EventSet to profile.
threshold -- threshold value for the Event triggers the handler.
flags -- bit pattern to control profiling behavior. Defined values are shown in the table below.
| Defined bits for the flags variable
|
| PAPI_PROFIL_POSIX | Default type of profiling, similar to
|
| PAPI_PROFIL_RANDOM | Drop a random 25% of the samples.
|
| PAPI_PROFIL_WEIGHTED | Weight the samples by their value.
|
| PAPI_PROFIL_COMPRESS | Ignore samples if hash buckets get big.
|
*prof -- pointer to PAPI_sprofil_t structure.
profcnt -- number of buffers for hardware profiling (*reserved*)
RETURN VALUES
On success, this function returns
PAPI_OK.
On error, a non-zero error code is returned.
ERRORS
|
PAPI_EINVAL | | |
One or more of the arguments is invalid.
|
|
PAPI_ENOMEM | | |
Insufficient memory to complete the operation.
|
|
PAPI_ENOEVST | | |
The EventSet specified does not exist.
|
|
PAPI_EISRUN | | |
The EventSet is currently counting events.
|
|
PAPI_ECNFLCT | | |
The underlying counter hardware can not count this event and other events
in the EventSet simultaneously.
|
|
PAPI_ENOEVNT | | |
The PAPI preset is not available on the underlying hardware.
|
|
EXAMPLES
int retval;
int EventSet = PAPI_NULL;
unsigned long start, end, length;
PAPI_exe_info_t *prginfo;
unsigned short *profbuf;
retval = PAPI_library_init(PAPI_VER_CURRENT);
if (retval != PAPI_VER_CURRENT & retval > 0) {
fprintf(stderr,"PAPI library version mismatch!0);
exit(1); }
if (retval < 0)
handle_error(retval);
if ((prginfo = PAPI_get_executable_info()) == NULL)
handle_error(1);
start = (unsigned long)prginfo->text_start;
end = (unsigned long)prginfo->text_end;
length = end - start;
profbuf = (unsigned short *)malloc(length*sizeof(unsigned short));
if (profbuf == NULL)
handle_error(1);
memset(profbuf,0x00,length*sizeof(unsigned short));
if ((retval = PAPI_create_eventset(&EventSet)) != PAPI_OK)
handle_error(retval);
/* Add Total FP Instructions Executed to our EventSet */
if ((retval = PAPI_add_event(&EventSet, PAPI_FP_INS)) != PAPI_OK)
handle_error(retval);
if ((retval = PAPI_profil(profbuf, length, start, 65536, EventSet,
PAPI_FP_INS, 1000000, PAPI_PROFIL_POSIX)) != PAPI_OK)
handle_error(retval);
/* Start counting */
if ((retval = PAPI_start(EventSet)) != PAPI_OK)
handle_error(1);
AUTHOR
Philip J. Mucci <mucci@cs.utk.edu>
BUGS
These functions have no known bugs.
SEE ALSO
PAPI_preset (3),
PAPI_get_executable_info (3),
PAPI_set_opt (3),
PAPI_start (3),
PAPI_rem_event (3),
PAPI_rem_events (3),
PAPI_query (3),
PAPI_cleanup_eventset (3),
PAPI_destroy_eventset (3),
The PAPI Web Site:
http://icl.cs.utk.edu/projects/papi
| PAPI Function Reference | PAPI_profil (3) | December, 2001 |
|
|