NAME

PAPI_profil, PAPI_sprofil - generate PC histogram data where hardware counter overflow occurs

CONTENTS

Synopsis
Description
Arguments
Return Values
Errors
Examples
Authors
Bugs
See Also

SYNOPSIS

C Interface

#include <papi.h> 

int PAPI_profil(void * buf, unsigned bufsiz, unsigned long offset,  

        unsigned  int EventSet, 
             int  EventCode,  int  threshold,  int  flags );

int PAPI_sprofil(PAPI_sprofil_t * prof, int profcnt, int EventSet,  

        int int threshold, int flags ); 

Fortran Interface

The profiling routines have no Fortran interface.

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. The user can use more than one event to generate more than one histogram in one eventset. For example, if you want to use two events to generate two histograms while running your program once, then you just call PAPI_profil twice.

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.

*prof -- pointer to PAPI_sprofil_t structure.

profcnt -- number of buffers for hardware profiling (*reserved*)

Defined bits for the flags variable
PAPI_PROFIL_POSIXDefault type of profiling, similar to
PAPI_PROFIL_RANDOMDrop a random 25% of the samples.
PAPI_PROFIL_WEIGHTEDWeight the samples by their value.
PAPI_PROFIL_COMPRESSIgnore samples if hash buckets get big.
PAPI_PROFIL_BUCKET_16use unsigned short(16bit) as bucket, This is the default bucket.
PAPI_PROFIL_BUCKET_32use unsigned int(32bit) as bucket.
PAPI_PROFIL_BUCKET_64use unsigned long(64bit) as bucket.

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)/sizeof(unsigned short) *sizeof(unsigned short);

profbuf = (unsigned short *)malloc(length); if (profbuf == NULL) handle_error(1); memset(profbuf,0x00,length);

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);

AUTHORS

The PAPI Team. See them at the PAPI Web Site: http://icl.cs.utk.edu/projects/papi

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_remove_event (3), PAPI_remove_events (3), PAPI_query (3), PAPI_cleanup_eventset (3), PAPI_destroy_eventset (3)


PAPI Programmer’s Reference PAPI_profil (3) November, 2003

  Innovative Computing Laboratory
2001 R&D Winner  
Contact PAPI: papi@cs.utk.edu Computer Science Department
  University of Tennessee