src/components/sde/sde.c
/** Triggered by PAPI_reset() but only if the EventSet is currently running */
/*  If the eventset is not currently running, then the saved value in the   */
/*  EventSet is set to zero without calling this routine.                   */
Triggered by PAPI_reset() but only if the EventSet is currently running
If the eventset is not currently running, then the saved value in the
EventSet is set to zero without calling this routine.
Triggered by PAPI_reset () but only if the EventSet is currently running If the eventset is not currently running then the saved value in the EventSet is set to zero without calling this routine .
static int
_sde_reset( hwd_context_t *ctx, hwd_control_state_t *ctl )
{
    int i;
    (void) ctx;
    SUBDBG( "_sde_reset ctx=%p ctrl=%p...\n", ctx, ctl );
    papisde_control_t *gctl = _papisde_global_control;   
    sde_control_state_t *sde_ctl = ( sde_control_state_t * ) ctl;   
    papi_sde_lock();
    for( i = 0; i < sde_ctl->num_events; i++ ) {
        int ret_val;
        unsigned int counter_uniq_id = sde_ctl->which_counter[i];
        if( counter_uniq_id >= gctl->num_reg_events ){
            PAPIERROR("_sde_reset(): Event at index %d does not correspond to a registered counter.\n",i);
            continue;
        }
        sde_counter_t *counter = ht_lookup_by_id(gctl->all_reg_counters, counter_uniq_id);
        if( NULL == counter ){
            PAPIERROR("_sde_reset(): Event at index %d corresponds to a clobbered counter.\n",i);
            continue;
        }
        if( NULL != counter->counter_group_head ){
            continue;
        }
        if( (NULL == counter->data) && (NULL == counter->func_ptr) ){
            PAPIERROR("_sde_reset(): Attempted read on a placeholder: %s.\n",counter->name);
            continue;
        }
        ret_val = sde_hardware_read_and_store( counter, 0, &(counter->previous_data) );
        if( PAPI_OK != ret_val ){
            PAPIERROR("_sde_reset(): Error occured when resetting counter: %s.\n",counter->name);
        }
    }
    papi_sde_unlock();
    return PAPI_OK;
}
static int _sde_reset ( hwd_context_t * ctx , hwd_control_state_t * ctl ) { int i ; ( void ) ctx ; SUBDBG ( " \n " , ctx , ctl ) ; papisde_control_t * gctl = _papisde_global_control ; sde_control_state_t * sde_ctl = ( sde_control_state_t * ) ctl ; papi_sde_lock ( ) ; for ( i = 0 ; i < sde_ctl -> num_events ; i ++ ) { int ret_val ; unsigned int counter_uniq_id = sde_ctl -> which_counter [ i ] ; if ( counter_uniq_id >= gctl -> num_reg_events ) { PAPIERROR ( " \n " , i ) ; continue ; } sde_counter_t * counter = ht_lookup_by_id ( gctl -> all_reg_counters , counter_uniq_id ) ; if ( NULL == counter ) { PAPIERROR ( " \n " , i ) ; continue ; } if ( NULL != counter -> counter_group_head ) { continue ; } if ( ( NULL == counter -> data ) && ( NULL == counter -> func_ptr ) ) { PAPIERROR ( " \n " , counter -> name ) ; continue ; } ret_val = sde_hardware_read_and_store ( counter , 0 , & ( counter -> previous_data ) ) ; if ( PAPI_OK != ret_val ) { PAPIERROR ( " \n " , counter -> name ) ; } } papi_sde_unlock ( ) ; return PAPI_OK ; }
Triggered by PAPI_reset() but only if the EventSet is currently running
If the eventset is not currently running, then the saved value in the
EventSet is set to zero without calling this routine.
Triggered by PAPI_reset () but only if the EventSet is currently running If the eventset is not currently running then the saved value in the EventSet is set to zero without calling this routine .
// Lock before we read num_reg_events and the hash-tables. // If the counter represents a counter group then we do not need to record the current value, // because when we read the real value we will keep track of all the previous values of the // individual counters (if they are DELTA), or not (if they are INSTANT) // we are done with this one, move to the next. // Our convention is that read attempts on a placeholder will not return an error // to avoid breaking existing programs that do something funny when an error is returned.