int _papi_hwd_read( hwd_context_t * ctx, hwd_control_state_t * spc, long long **dp, int flags ) { pmc_read_state( _papi_hwi_system_info.num_cntrs, &spc->state ); *dp = ( long long * ) spc->state.sum.pmc; #ifdef DEBUG { if ( ISLEVEL( DEBUG_SUBSTRATE ) ) { unsigned int i; for ( i = 0; i < spc->control.cpu_control.nractrs; i++ ) { SUBDBG( "raw val hardware index %d is %lld\n", i, ( long long ) spc->state.sum.pmc[i] ); } } } #endif return ( PAPI_OK ); }
inline_static int update_global_hwcounters(EventSetInfo_t *global) { hwd_control_state_t *machdep = &global->machdep; struct pmc_state state; int i; memset(&state, 0, sizeof(struct pmc_state)); // clear all the accumulated counters pmc_read_state(_papi_hwi_system_info.num_cntrs + 1, &state); for (i=0;i<_papi_hwi_system_info.num_cntrs;i++) { DBG((stderr, "update_global_hwcounters() %d: G%I64d = G%I64d + C%I64d\n",i, global->hw_start[i]+state.sum.ctr[i+1], global->hw_start[i],state.sum.ctr[i+1])); global->hw_start[i] = global->hw_start[i] + state.sum.ctr[i+1]; } if (pmc_control(machdep->self, &machdep->counter_cmd) < 0) return(PAPI_ESYS); return(PAPI_OK); }