PAPI  5.0.1.0
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)

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

< Invalid argument

Definition at line 674 of file papi_hl.c.

{
    if ( values == NULL || array_len <= 0 )
        return PAPI_EINVAL;

    return ( _internal_hl_read_cnts( values, array_len, PAPI_HL_ACCUM ) );
}

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

< Invalid argument

< No error

< No error

< No error

Definition at line 203 of file papi_hl.c.

{
    if ( rtime == NULL || ptime == NULL || flpins == NULL || mflips == NULL )
        return PAPI_EINVAL;

    HighLevelInfo *state = NULL;
    int retval;

    if ( ( retval = _internal_check_state( &state ) ) != PAPI_OK ) {
        return ( retval );
        }

    if ( ( retval =
           _hl_rate_calls( rtime, ptime, flpins, mflips,
                           ( unsigned int ) PAPI_FP_INS, state ) ) != PAPI_OK )
        return ( retval );

    return ( PAPI_OK );
}

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

< Invalid argument

< No error

< No error

< No error

Definition at line 272 of file papi_hl.c.

{
    if ( rtime == NULL || ptime == NULL || flpops == NULL || mflops == NULL )
        return PAPI_EINVAL;

    HighLevelInfo *state = NULL;
    int retval;

    if ( ( retval = _internal_check_state( &state ) ) != PAPI_OK )
        return ( retval );

    if ( ( retval =
           _hl_rate_calls( rtime, ptime, flpops, mflops,
                           ( unsigned int ) PAPI_FP_OPS, state ) ) != PAPI_OK )
        return ( retval );

    return ( PAPI_OK );
}

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

< Invalid argument

< No error

Definition at line 326 of file papi_hl.c.

{
    if ( rtime == NULL || ptime == NULL || ins == NULL || ipc == NULL )
        return PAPI_EINVAL;

    HighLevelInfo *state = NULL;
    int retval;

    if ( ( retval = _internal_check_state( &state ) ) != PAPI_OK )
        return ( retval );

    return _hl_rate_calls( rtime, ptime, ins, ipc,
                           ( unsigned int ) PAPI_TOT_INS, state );
}

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 4256 of file papi.c.

{
    return ( papi_num_components );
}
int PAPI_num_counters ( void  )

get the number of hardware counters available on the system

< No error

< Number of physical hardware counters

Definition at line 455 of file papi_hl.c.

{
    int retval;
    HighLevelInfo *tmp = NULL;

    /* Make sure the Library is initialized, etc... */
    if ( ( retval = _internal_check_state( &tmp ) ) != PAPI_OK )
        return ( retval );

    return ( PAPI_get_opt( PAPI_MAX_HWCTRS, NULL ) );
}

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 624 of file papi_hl.c.

{
    return ( _internal_hl_read_cnts( values, array_len, PAPI_HL_READ ) );
}

Here is the caller graph for this function:

int PAPI_start_counters ( int *  events,
int  array_len 
)

start counting hardware events

< Invalid argument

< No error

< Invalid argument

< EventSet is currently counting

< No error

Definition at line 511 of file papi_hl.c.

{
    int i, retval;
    HighLevelInfo *state = NULL;

    if ( events == NULL || array_len <= 0 )
        return PAPI_EINVAL;

    if ( ( retval = _internal_check_state( &state ) ) != PAPI_OK )
        return ( retval );

    if ( state->running != 0 )
        return ( PAPI_EINVAL );

    /* load events to the new EventSet */
    for ( i = 0; i < array_len; i++ ) {
        retval = PAPI_add_event( state->EventSet, events[i] );
        if ( retval == PAPI_EISRUN )
            return ( retval );

        if ( retval ) {
            /* remove any prior events that may have been added 
             * and cleanup the high level information
             */
            _internal_cleanup_hl_info( state );
            PAPI_cleanup_eventset( state->EventSet );
            return ( retval );
        }
    }
    /* start the EventSet */
    if ( ( retval = _internal_start_hl_counters( state ) ) == PAPI_OK ) {
        state->running = HL_START_COUNTERS;
        state->num_evts = ( short ) array_len;
    }
    return ( retval );
}

Here is the caller graph for this function:

int PAPI_stop_counters ( long long *  values,
int  array_len 
)

stop counters and return current counts

< Invalid argument

< No error

< EventSet is currently not running

< Invalid argument

< No error

Definition at line 721 of file papi_hl.c.

{
    int retval;
    HighLevelInfo *state = NULL;

    if ( values == NULL || array_len <= 0 )
        return PAPI_EINVAL;

    if ( ( retval = _internal_check_state( &state ) ) != PAPI_OK )
        return ( retval );

    if ( state->running == 0 )
        return ( PAPI_ENOTRUN );

    if ( state->running == HL_FLOPS || state->running == HL_FLIPS ||
         state->running == HL_IPC ) {
        long long tmp_values[2];
        retval = PAPI_stop( state->EventSet, tmp_values );
    } else if ( state->running != HL_START_COUNTERS ||
                array_len < state->num_evts )
        return ( PAPI_EINVAL );
    else
        retval = PAPI_stop( state->EventSet, values );

    if ( retval == PAPI_OK ) {
        _internal_cleanup_hl_info( state );
        PAPI_cleanup_eventset( state->EventSet );
    }
    APIDBG( "PAPI_stop_counters returns %d\n", retval );
    return retval;
}

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines