PAPI  5.3.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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

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.

757 {
758  if ( values == NULL || array_len <= 0 )
759  return PAPI_EINVAL;
760 
761  return ( _internal_hl_read_cnts( values, array_len, HL_ACCUM ) );
762 }
int _internal_hl_read_cnts(long long *values, int array_len, int flag)
Definition: papi_hl.c:639
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define HL_ACCUM
Definition: papi_hl.c:33
static long long values[NUM_EVENTS]
Definition: init_fini.c:10

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.

384 {
385  long long values[3] = { 0, 0, 0 };
387  int retval = 0;
388 
389  if ( rtime == NULL || ptime == NULL || ref == NULL ||core == NULL || evt == NULL || epc == NULL )
390  return PAPI_EINVAL;
391 
392  // if an event is provided, use it; otherwise use TOT_INS
393  if (event != 0 ) events[0] = event;
394 
395  if ( PAPI_query_event( ( int ) PAPI_REF_CYC ) != PAPI_OK )
396  events[2] = 0;
397 
398  retval = _hl_rate_calls( rtime, ptime, events, values, evt, epc, HL_EPC );
399  *core = values[1];
400  *ref = values[2];
401  return ( retval );
402 }
#define PAPI_TOT_INS
Definition: fpapi.h:185
device[deviceId] domain[domainId] event
Definition: linux-cuda.c:306
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define PAPI_REF_CYC
Definition: fpapi.h:242
#define HL_EPC
Definition: papi_hl.c:31
#define PAPI_TOT_CYC
Definition: fpapi.h:194
char events[MAX_EVENTS][BUFSIZ]
int _hl_rate_calls(float *real_time, float *proc_time, int *events, long long *values, long long *ins, float *rate, int mode)
Definition: papi_hl.c:405
int PAPI_query_event(int EventCode)
Definition: papi.c:695
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338

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.

205 {
206  int retval;
207  int events = PAPI_FP_INS;
208  long long values = 0;
209 
210  if ( rtime == NULL || ptime == NULL || flpins == NULL || mflips == NULL )
211  return PAPI_EINVAL;
212 
213  retval = _hl_rate_calls( rtime, ptime, &events, &values, flpins, mflips, HL_FLIP );
214  return ( retval );
215 }
return PAPI_EINVAL
Definition: linux-nvml.c:408
char events[MAX_EVENTS][BUFSIZ]
int _hl_rate_calls(float *real_time, float *proc_time, int *events, long long *values, long long *ins, float *rate, int mode)
Definition: papi_hl.c:405
#define PAPI_FP_INS
Definition: fpapi.h:187
#define HL_FLIP
Definition: papi_hl.c:28
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338

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.

260 {
261  int retval;
262  int events = PAPI_FP_OPS;
263  long long values = 0;
264 
265  if ( rtime == NULL || ptime == NULL || flpops == NULL || mflops == NULL )
266  return PAPI_EINVAL;
267 
268  retval = _hl_rate_calls( rtime, ptime, &events, &values, flpops, mflops, HL_FLOP );
269  return ( retval );
270 }
#define HL_FLOP
Definition: papi_hl.c:29
#define PAPI_FP_OPS
Definition: fpapi.h:237
return PAPI_EINVAL
Definition: linux-nvml.c:408
char events[MAX_EVENTS][BUFSIZ]
int _hl_rate_calls(float *real_time, float *proc_time, int *events, long long *values, long long *ins, float *rate, int mode)
Definition: papi_hl.c:405
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338

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.

317 {
318  long long values[2] = { 0, 0 };
319  int events[2] = {PAPI_TOT_INS, PAPI_TOT_CYC};
320  int retval = 0;
321 
322  if ( rtime == NULL || ptime == NULL || ins == NULL || ipc == NULL )
323  return PAPI_EINVAL;
324 
325  retval = _hl_rate_calls( rtime, ptime, events, values, ins, ipc, HL_IPC );
326  return ( retval );
327 }
#define PAPI_TOT_INS
Definition: fpapi.h:185
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define HL_IPC
Definition: papi_hl.c:30
#define PAPI_TOT_CYC
Definition: fpapi.h:194
char events[MAX_EVENTS][BUFSIZ]
int _hl_rate_calls(float *real_time, float *proc_time, int *events, long long *values, long long *ins, float *rate, int mode)
Definition: papi_hl.c:405
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function:

get the number of components available on the system

Definition at line 4272 of file papi.c.

4273 {
4274  return ( papi_num_components );
4275 }
int papi_num_components

Here is the caller graph for this function:

get the number of hardware counters available on the system

Definition at line 537 of file papi_hl.c.

538 {
539  int retval;
540  HighLevelInfo *tmp = NULL;
541 
542  /* Make sure the Library is initialized, etc... */
543  if ( ( retval = _internal_check_state( &tmp ) ) != PAPI_OK )
544  return ( retval );
545 
546  return ( PAPI_get_opt( PAPI_MAX_HWCTRS, NULL ) );
547 }
int _internal_check_state(HighLevelInfo **state)
Definition: papi_hl.c:100
return PAPI_OK
Definition: linux-nvml.c:458
#define PAPI_MAX_HWCTRS
Definition: fpapi.h:58
int PAPI_get_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:4030
ssize_t retval
Definition: libasync.c:338
long long tmp
Definition: iozone.c:12031

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.

707 {
708  return ( _internal_hl_read_cnts( values, array_len, HL_READ ) );
709 }
int _internal_hl_read_cnts(long long *values, int array_len, int flag)
Definition: papi_hl.c:639
#define HL_READ
Definition: papi_hl.c:32
static long long values[NUM_EVENTS]
Definition: init_fini.c:10

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.

594 {
595  int i, retval;
596  HighLevelInfo *state = NULL;
597 
598  if ( events == NULL || array_len <= 0 )
599  return PAPI_EINVAL;
600 
601  if ( ( retval = _internal_check_state( &state ) ) != PAPI_OK )
602  return ( retval );
603 
604  if ( state->running != 0 )
605  return ( PAPI_EINVAL );
606 
607  /* load events to the new EventSet */
608  for ( i = 0; i < array_len; i++ ) {
609  retval = PAPI_add_event( state->EventSet, events[i] );
610  if ( retval == PAPI_EISRUN )
611  return ( retval );
612 
613  if ( retval ) {
614  /* remove any prior events that may have been added
615  * and cleanup the high level information
616  */
617  _internal_cleanup_hl_info( state );
619  return ( retval );
620  }
621  }
622  /* start the EventSet */
623  if ( ( retval = _internal_start_hl_counters( state ) ) == PAPI_OK ) {
624  state->running = HL_START;
625  state->num_evts = ( short ) array_len;
626  }
627  return ( retval );
628 }
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1597
short int num_evts
Definition: papi_hl.c:41
#define PAPI_EISRUN
Definition: fpapi.h:115
int _internal_check_state(HighLevelInfo **state)
Definition: papi_hl.c:100
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
int i
Definition: fileop.c:140
int _internal_start_hl_counters(HighLevelInfo *state)
Definition: papi_hl.c:146
#define HL_START
Definition: papi_hl.c:27
char events[MAX_EVENTS][BUFSIZ]
int PAPI_cleanup_eventset(int EventSet)
Definition: papi.c:2795
void _internal_cleanup_hl_info(HighLevelInfo *state)
Definition: papi_hl.c:152
short int running
Definition: papi_hl.c:42
child_idents[x-1] state
Definition: iozone.c:21341
int EventSet
Definition: papi_hl.c:40
ssize_t retval
Definition: libasync.c:338

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.

804 {
805  int retval;
806  HighLevelInfo *state = NULL;
807 
808  if ( ( retval = _internal_check_state( &state ) ) != PAPI_OK )
809  return ( retval );
810 
811  if ( state->running == 0 )
812  return ( PAPI_ENOTRUN );
813 
814  if ( state->running == HL_START ) {
815  if ( array_len < state->num_evts || values == NULL) {
816  return ( PAPI_EINVAL );
817  } else {
818  retval = PAPI_stop( state->EventSet, values );
819  }
820  }
821 
822  if ( state->running > HL_START ) {
823  long long tmp_values[3];
824  retval = PAPI_stop( state->EventSet, tmp_values );
825  }
826 
827  if ( retval == PAPI_OK ) {
828  _internal_cleanup_hl_info( state );
830  }
831  APIDBG( "PAPI_stop_counters returns %d\n", retval );
832  return retval;
833 }
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2225
int _internal_check_state(HighLevelInfo **state)
Definition: papi_hl.c:100
return PAPI_OK
Definition: linux-nvml.c:458
return PAPI_EINVAL
Definition: linux-nvml.c:408
#define APIDBG(format, args...)
Definition: papi_debug.h:64
#define HL_START
Definition: papi_hl.c:27
int PAPI_cleanup_eventset(int EventSet)
Definition: papi.c:2795
void _internal_cleanup_hl_info(HighLevelInfo *state)
Definition: papi_hl.c:152
short int running
Definition: papi_hl.c:42
child_idents[x-1] state
Definition: iozone.c:21341
#define PAPI_ENOTRUN
Definition: fpapi.h:114
int EventSet
Definition: papi_hl.c:40
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
ssize_t retval
Definition: libasync.c:338

Here is the call graph for this function:

Here is the caller graph for this function: