The High Level API

Functions

int PAPI_accum_counters (long long *values, int array_len)
int PAPI_num_counters (void)
int PAPI_num_components (void)
int PAPI_read_counters (long long *values, int array_len)
int PAPI_start_counters (int *events, int array_len)
int PAPI_stop_counters (long long *values, int array_len)
int PAPI_flips (float *rtime, float *ptime, long long *flpins, float *mflips)
int PAPI_flops (float *rtime, float *ptime, long long *flpops, float *mflops)
int PAPI_ipc (float *rtime, float *ptime, long long *ins, float *ipc)
int PAPI_epc (int event, float *rtime, float *ptime, long long *ref, long long *core, long long *evt, float *epc)

Detailed Description

For internal use only.

The simple interface implemented by the following eight routines allows the user to access and count specific hardware events from both C and Fortran. It should be noted that this API can be used in conjunction with the low level API.


Function Documentation

int PAPI_accum_counters ( long long *  values,
int  array_len 
)

add current counts to array and reset counters

Definition at line 756 of file papi_hl.c.

00757 {
00758     if ( values == NULL || array_len <= 0 )
00759         return PAPI_EINVAL;
00760 
00761     return ( _internal_hl_read_cnts( values, array_len, HL_ACCUM ) );
00762 }

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_epc ( int  event,
float *  rtime,
float *  ptime,
long long *  ref,
long long *  core,
long long *  evt,
float *  epc 
)

gets (named) events per cycle, real and processor time, reference and core cycles

Definition at line 383 of file papi_hl.c.

00384 {
00385     long long values[3] = { 0, 0, 0 };
00386     int events[3] = {PAPI_TOT_INS, PAPI_TOT_CYC, PAPI_REF_CYC};
00387     int retval = 0;
00388 
00389     if ( rtime == NULL || ptime == NULL || ref == NULL ||core == NULL || evt == NULL || epc == NULL )
00390         return PAPI_EINVAL;
00391 
00392     // if an event is provided, use it; otherwise use TOT_INS
00393     if (event != 0 ) events[0] = event;
00394     
00395     if ( PAPI_query_event( ( int ) PAPI_REF_CYC ) != PAPI_OK )
00396         events[2] = 0;
00397 
00398     retval = _hl_rate_calls( rtime, ptime, events, values, evt, epc, HL_EPC );
00399     *core = values[1];
00400     *ref = values[2];
00401     return ( retval );
00402 }

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_flips ( float *  rtime,
float *  ptime,
long long *  flpins,
float *  mflips 
)

simplified call to get Mflips/s (floating point instruction rate), real and processor time

Definition at line 204 of file papi_hl.c.

00205 {
00206     int retval;
00207    int events[1] = {PAPI_FP_INS};
00208     long long values = 0;
00209 
00210     if ( rtime == NULL || ptime == NULL || flpins == NULL || mflips == NULL )
00211         return PAPI_EINVAL;
00212 
00213    retval = _hl_rate_calls( rtime, ptime, events, &values, flpins, mflips, HL_FLIP );
00214     return ( retval );
00215 }

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_flops ( float *  rtime,
float *  ptime,
long long *  flpops,
float *  mflops 
)

simplified call to get Mflops/s (floating point operation rate), real and processor time

Definition at line 259 of file papi_hl.c.

00260 {
00261     int retval;
00262    int events[1] = {PAPI_FP_OPS};
00263     long long values = 0;
00264 
00265     if ( rtime == NULL || ptime == NULL || flpops == NULL || mflops == NULL )
00266         return PAPI_EINVAL;
00267 
00268    retval = _hl_rate_calls( rtime, ptime, events, &values, flpops, mflops, HL_FLOP );
00269     return ( retval );
00270 }

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_ipc ( float *  rtime,
float *  ptime,
long long *  ins,
float *  ipc 
)

gets instructions per cycle, real and processor time

Definition at line 316 of file papi_hl.c.

00317 {
00318     long long values[2] = { 0, 0 };
00319     int events[2] = {PAPI_TOT_INS, PAPI_TOT_CYC};
00320     int retval = 0;
00321 
00322     if ( rtime == NULL || ptime == NULL || ins == NULL || ipc == NULL )
00323         return PAPI_EINVAL;
00324 
00325     retval = _hl_rate_calls( rtime, ptime, events, values, ins, ipc, HL_IPC );
00326     return ( retval );
00327 }

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_num_components ( void   ) 

get the number of components available on the system

Definition at line 4395 of file papi.c.

04396 {
04397     APIDBG( "Entry:\n");
04398     return ( papi_num_components );
04399 }

Here is the caller graph for this function:

int PAPI_num_counters ( void   ) 

get the number of hardware counters available on the system

Definition at line 537 of file papi_hl.c.

00538 {
00539     int retval;
00540     HighLevelInfo *tmp = NULL;
00541 
00542     /* Make sure the Library is initialized, etc... */
00543     if ( ( retval = _internal_check_state( &tmp ) ) != PAPI_OK )
00544         return ( retval );
00545 
00546     return ( PAPI_get_opt( PAPI_MAX_HWCTRS, NULL ) );
00547 }

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_read_counters ( long long *  values,
int  array_len 
)

copy current counts to array and reset counters

Definition at line 706 of file papi_hl.c.

00707 {
00708     return ( _internal_hl_read_cnts( values, array_len, HL_READ ) );
00709 }

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_start_counters ( int *  events,
int  array_len 
)

start counting hardware events

Definition at line 593 of file papi_hl.c.

00594 {
00595     int i, retval;
00596     HighLevelInfo *state = NULL;
00597 
00598     if ( events == NULL || array_len <= 0 )
00599         return PAPI_EINVAL;
00600 
00601     if ( ( retval = _internal_check_state( &state ) ) != PAPI_OK )
00602         return ( retval );
00603 
00604     if ( state->running != 0 )
00605         return ( PAPI_EINVAL );
00606 
00607     /* load events to the new EventSet */
00608     for ( i = 0; i < array_len; i++ ) {
00609         retval = PAPI_add_event( state->EventSet, events[i] );
00610         if ( retval == PAPI_EISRUN )
00611             return ( retval );
00612 
00613         if ( retval ) {
00614             /* remove any prior events that may have been added 
00615              * and cleanup the high level information
00616              */
00617             _internal_cleanup_hl_info( state );
00618             PAPI_cleanup_eventset( state->EventSet );
00619             return ( retval );
00620         }
00621     }
00622     /* start the EventSet */
00623     if ( ( retval = _internal_start_hl_counters( state ) ) == PAPI_OK ) {
00624         state->running = HL_START;
00625         state->num_evts = ( short ) array_len;
00626     }
00627     return ( retval );
00628 }

Here is the call graph for this function:

Here is the caller graph for this function:

int PAPI_stop_counters ( long long *  values,
int  array_len 
)

stop counters and return current counts

Definition at line 803 of file papi_hl.c.

00804 {
00805     int retval;
00806     HighLevelInfo *state = NULL;
00807 
00808     if ( ( retval = _internal_check_state( &state ) ) != PAPI_OK )
00809         return ( retval );
00810 
00811     if ( state->running == 0 )
00812         return ( PAPI_ENOTRUN );
00813 
00814     if ( state->running == HL_START ) {
00815         if ( array_len < state->num_evts  || values == NULL) {
00816             return ( PAPI_EINVAL );
00817         } else {
00818             retval = PAPI_stop( state->EventSet, values );
00819         }
00820     }
00821 
00822     if ( state->running > HL_START ) {
00823         long long tmp_values[3];
00824         retval = PAPI_stop( state->EventSet, tmp_values );
00825     }
00826     
00827     if ( retval == PAPI_OK ) {
00828         _internal_cleanup_hl_info( state );
00829         PAPI_cleanup_eventset( state->EventSet );
00830     }
00831     APIDBG( "PAPI_stop_counters returns %d\n", retval );
00832     return retval;
00833 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on 26 Jan 2016 for PAPI by  doxygen 1.6.1