src/components/sde/sde.c
static int
_sde_ntv_code_to_descr( unsigned int EventCode, char *descr, int len )
{
    unsigned int code = EventCode & PAPI_NATIVE_AND_MASK;
    SUBDBG("_sde_ntv_code_to_descr %u\n", code);

    papisde_control_t *gctl = _papisde_global_control; 

    // Lock before we read num_reg_events and the hash-tables.
    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->description) ){
        papi_sde_unlock();
        return PAPI_ENOEVNT;
    }
    SUBDBG("Event (unique id = %d) description: %s\n", counter->glb_uniq_id, counter->description); 

    (void)strncpy( descr, counter->description, len );  
    descr[len] = '\0';

    papi_sde_unlock();
    return PAPI_OK;
}
/** Takes a native event code and passes back the event description
 * @param EventCode is the native event code
 * @param descr is a pointer for the description to be copied to
 * @param len is the size of the descr string
 */
Takes a native event code and passes back the event description
@param EventCode is the native event code
@param descr is a pointer for the description to be copied to
@param len is the size of the descr string
Takes a native event code and passes back the event description @param EventCode is the native event code @param descr is a pointer for the description to be copied to @param len is the size of the descr string
static int
_sde_ntv_code_to_descr( unsigned int EventCode, char *descr, int len )
{
    unsigned int code = EventCode & PAPI_NATIVE_AND_MASK;
    SUBDBG("_sde_ntv_code_to_descr %u\n", code);
    papisde_control_t *gctl = _papisde_global_control; 
    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->description) ){
        papi_sde_unlock();
        return PAPI_ENOEVNT;
    }
    SUBDBG("Event (unique id = %d) description: %s\n", counter->glb_uniq_id, counter->description); 
    (void)strncpy( descr, counter->description, len );  
    descr[len] = '\0';
    papi_sde_unlock();
    return PAPI_OK;
}
static int _sde_ntv_code_to_descr ( unsigned int EventCode , char * descr , int len ) { unsigned int code = EventCode & PAPI_NATIVE_AND_MASK ; SUBDBG ( " \n " , code ) ; papisde_control_t * gctl = _papisde_global_control ; 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 -> description ) ) { papi_sde_unlock ( ) ; return PAPI_ENOEVNT ; } SUBDBG ( " \n " , counter -> glb_uniq_id , counter -> description ) ; ( void ) strncpy ( descr , counter -> description , len ) ; descr [ len ] = ' \0 ' ; papi_sde_unlock ( ) ; return PAPI_OK ; }
Takes a native event code and passes back the event description
 @param EventCode is the native event code
 @param descr is a pointer for the description to be copied to
 @param len is the size of the descr string
Takes a native event code and passes back the event description @param EventCode is the native event code @param descr is a pointer for the description to be copied to @param len is the size of the descr string
// Lock before we read num_reg_events and the hash-tables.