src/components/sde/sde.c
/** Takes a native event code and passes back the name 
 * @param EventCode is the native event code
 * @param name is a pointer for the name to be copied to
 * @param len is the size of the name string
 */
Takes a native event code and passes back the name
@param EventCode is the native event code
@param name is a pointer for the name to be copied to
@param len is the size of the name string
Takes a native event code and passes back the name @param EventCode is the native event code @param name is a pointer for the name to be copied to @param len is the size of the name string
static int
_sde_ntv_code_to_name( unsigned int EventCode, char *name, int len )
{
    papisde_control_t *gctl = _papisde_global_control; 
    unsigned int code = EventCode & PAPI_NATIVE_AND_MASK;
    SUBDBG("_sde_ntv_code_to_name %u\n", code);
    papi_sde_lock();
    if( (NULL == gctl) || (code > gctl->num_reg_events) ){
        papi_sde_unlock();
        return PAPI_ENOEVNT;
    }
    sde_counter_t *counter = ht_lookup_by_id(gctl->all_reg_counters, code);
    if( (NULL == counter) || (NULL == counter->name) ){
        papi_sde_unlock();
        return PAPI_ENOEVNT;
    }
    SUBDBG("Event name = %s (unique id = %d)\n", counter->name, counter->glb_uniq_id); 
    (void)strncpy( name, counter->name, len );  
    papi_sde_unlock();
    return PAPI_OK;
}
static int _sde_ntv_code_to_name ( unsigned int EventCode , char * name , int len ) { papisde_control_t * gctl = _papisde_global_control ; unsigned int code = EventCode & PAPI_NATIVE_AND_MASK ; SUBDBG ( " \n " , code ) ; papi_sde_lock ( ) ; if ( ( NULL == gctl ) || ( code > gctl -> num_reg_events ) ) { papi_sde_unlock ( ) ; return PAPI_ENOEVNT ; } sde_counter_t * counter = ht_lookup_by_id ( gctl -> all_reg_counters , code ) ; if ( ( NULL == counter ) || ( NULL == counter -> name ) ) { papi_sde_unlock ( ) ; return PAPI_ENOEVNT ; } SUBDBG ( " \n " , counter -> name , counter -> glb_uniq_id ) ; ( void ) strncpy ( name , counter -> name , len ) ; papi_sde_unlock ( ) ; return PAPI_OK ; }
Takes a native event code and passes back the name
 @param EventCode is the native event code
 @param name is a pointer for the name to be copied to
 @param len is the size of the name string
Takes a native event code and passes back the name @param EventCode is the native event code @param name is a pointer for the name to be copied to @param len is the size of the name string
// Lock before we read num_reg_events and the hash-tables.