PAPI  5.3.0.0
linux-bgq-common.h File Reference

This file is part of the source code for a component that enables PAPI-C to access hardware monitoring counters for BG/Q through the bgpm library. More...

Include dependency graph for linux-bgq-common.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define STRINGIFY(x)   #x
#define TOSTRING(x)   STRINGIFY(x)
#define _AT_   __FILE__ ":" TOSTRING(__LINE__)
#define MAX_COUNTERS   ( PEVT_LAST_EVENT + 1 )

Functions

int _papi_hwi_publish_error (char *error)
int _check_BGPM_error (int err, char *bgpmfunc)
long_long _common_getEventValue (unsigned event_id, int EventGroup)
int _common_deleteRecreate (int *EventGroup_ptr)
int _common_rebuildEventgroup (int count, int *EventGroup_local, int *EventGroup_ptr)
int _common_set_overflow_BGPM (int EventGroup, int evt_idx, int threshold, void(*handler)(int, uint64_t, uint64_t, const ucontext_t *))

Detailed Description

CVS: $Id$

Author:
Heike Jagode jagode@eecs.utk.edu Mods: < your name here > < your email address > BGPM component

Tested version of bgpm (early access)

Definition in file linux-bgq-common.h.


Define Documentation

#define _AT_   __FILE__ ":" TOSTRING(__LINE__)

Definition at line 30 of file linux-bgq-common.h.

#define MAX_COUNTERS   ( PEVT_LAST_EVENT + 1 )

Definition at line 34 of file linux-bgq-common.h.

#define STRINGIFY (   x)    #x

Definition at line 28 of file linux-bgq-common.h.

#define TOSTRING (   x)    STRINGIFY(x)

Definition at line 29 of file linux-bgq-common.h.


Function Documentation

int _check_BGPM_error ( int  err,
char *  bgpmfunc 
)

Definition at line 27 of file linux-bgq-common.c.

{
    char  buffer[PAPI_MAX_STR_LEN];
    int retval;
    
    if ( err < 0 ) {
        sprintf( buffer, "Error: ret value is %d for BGPM API function '%s'.",
                err, bgpmfunc);
        retval =  _papi_hwi_publish_error( buffer );
        return retval;
    }
    
    return PAPI_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _common_deleteRecreate ( int *  EventGroup_ptr)

Definition at line 64 of file linux-bgq-common.c.

{
#ifdef DEBUG_BGQ
    printf( _AT_ " _common_deleteRecreate: *EventGroup_ptr=%d\n", *EventGroup_ptr);
#endif
    int retval;
    
    // delete previous bgpm eventset
    retval = Bgpm_DeleteEventSet( *EventGroup_ptr );
    retval = _check_BGPM_error( retval, "Bgpm_DeleteEventSet" );
    if ( retval < 0 ) return retval;

    // create a new empty bgpm eventset
    *EventGroup_ptr = Bgpm_CreateEventSet();
    retval = _check_BGPM_error( *EventGroup_ptr, "Bgpm_CreateEventSet" );
    if ( retval < 0 ) return retval;

#ifdef DEBUG_BGQ
    printf( _AT_ " _common_deleteRecreate: *EventGroup_ptr=%d\n", *EventGroup_ptr);
#endif
    return PAPI_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

long_long _common_getEventValue ( unsigned  event_id,
int  EventGroup 
)

Definition at line 47 of file linux-bgq-common.c.

{   
    uint64_t value;
    int retval;
    
    retval = Bgpm_ReadEvent( EventGroup, event_id, &value );
    retval = _check_BGPM_error( retval, "Bgpm_ReadEvent" );
    if ( retval < 0 ) return retval;

    return ( ( long_long ) value ); 
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _common_rebuildEventgroup ( int  count,
int *  EventGroup_local,
int *  EventGroup_ptr 
)

Definition at line 92 of file linux-bgq-common.c.

{
#ifdef DEBUG_BGQ
    printf( "_common_rebuildEventgroup\n" );
#endif  
    int i, retval;
    
    // rebuild BGPM EventGroup
    for ( i = 0; i < count; i++ ) {
        retval = Bgpm_AddEvent( *EventGroup_ptr, EventGroup_local[i] );
        retval = _check_BGPM_error( retval, "Bgpm_AddEvent" );
        if ( retval < 0 ) return retval;

#ifdef DEBUG_BGQ
        printf( "_common_rebuildEventgroup: After emptying EventGroup, event re-added: %d\n",
                EventGroup_local[i] );
#endif
    }
    return PAPI_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _common_set_overflow_BGPM ( int  EventGroup,
int  evt_idx,
int  threshold,
void(*)(int, uint64_t, uint64_t, const ucontext_t *)  handler 
)

Definition at line 121 of file linux-bgq-common.c.

{
    int retval;
    uint64_t threshold_for_bgpm;
    
    /* convert threadhold value assigned by PAPI user to value that is
     * programmed into the counter. This value is required by Bgpm_SetOverflow() */ 
    threshold_for_bgpm = BGPM_PERIOD2THRES( threshold );
    
#ifdef DEBUG_BGQ
    printf("_common_set_overflow_BGPM\n");
    
    int i;
    int numEvts = Bgpm_NumEvents( EventGroup );
    for ( i = 0; i < numEvts; i++ ) {
        printf("_common_set_overflow_BGPM: %d = %s\n", i, Bgpm_GetEventLabel( EventGroup, i) );
    }
#endif  
    
    
    retval = Bgpm_SetOverflow( EventGroup, 
                               evt_idx,
                               threshold_for_bgpm );
    retval = _check_BGPM_error( retval, "Bgpm_SetOverflow" );
    if ( retval < 0 ) return retval;

    retval = Bgpm_SetEventUser1( EventGroup, 
                                 evt_idx,
                                 1024 );
    retval = _check_BGPM_error( retval, "Bgpm_SetEventUser1" );
    if ( retval < 0 ) return retval;

    /* user signal handler for overflow case */
    retval = Bgpm_SetOverflowHandler( EventGroup, 
                                      handler );
    retval = _check_BGPM_error( retval, "Bgpm_SetOverflowHandler" );    
    if ( retval < 0 ) return retval;

    return PAPI_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int _papi_hwi_publish_error ( char *  error)

Definition at line 294 of file papi_internal.c.

{
    int error_code = -1;

    if ( (error_code = _papi_hwi_lookup_error( error )) < 0 )
        error_code = _papi_hwi_add_error(error);

    return (-error_code); /* internally error_code is an index, externally, it should be <= 0 */
}

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines