INLINE void PROFILER_PCONTROL(int ctrl) { if(isMaster) { printf("Pcontrol change from %d to %d\n",curset,ctrl); } if(isZero) { if(ctrl == 0 && curset == 0) return; /* Save the current counter values and change curset to the new value of ctrl */ if(curset != 0) { values[curset].time += MPI_Wtime(); unsigned int cnt = 0; uint64_t val; unsigned int numEvts = Bgpm_NumEvents(hNWSet); assert(numEvts == numevents); for(unsigned int i = 0; i < NUM_TORUS_LINKS; i++) { for(unsigned int j = 0; j < numevents; j++) { Bgpm_NW_ReadLinkEvent(hNWSet, j, linkmask[i], &val); values[curset].counters[cnt++] += val; } } } if(ctrl != 0) { Bgpm_ResetStart(hNWSet); values[ctrl].time -= MPI_Wtime(); } curset = ctrl; if(curset > maxset) maxset = ctrl; } }
int IOUNIT_start( hwd_context_t * ctx, hwd_control_state_t * ptr ) { #ifdef DEBUG_BGQ printf( "IOUNIT_start\n" ); #endif ( void ) ctx; int retval; IOUNIT_control_state_t * this_state = ( IOUNIT_control_state_t * ) ptr; retval = Bgpm_ResetStart( this_state->EventGroup ); CHECK_BGPM_ERROR( retval, "Bgpm_ResetStart" ); return ( PAPI_OK ); }
int NWUNIT_start( hwd_context_t * ctx, hwd_control_state_t * ptr ) { #ifdef DEBUG_BGQ printf( "NWUNIT_start\n" ); #endif ( void ) ctx; int retval; NWUNIT_control_state_t * this_state = ( NWUNIT_control_state_t * ) ptr; retval = Bgpm_Attach( this_state->EventGroup, UPC_NW_ALL_LINKS, 0); retval = _check_BGPM_error( retval, "Bgpm_Attach" ); if ( retval < 0 ) return retval; retval = Bgpm_ResetStart( this_state->EventGroup ); retval = _check_BGPM_error( retval, "Bgpm_ResetStart" ); if ( retval < 0 ) return retval; return ( PAPI_OK ); }
int IOUNIT_reset( hwd_context_t * ctx, hwd_control_state_t * ptr ) { #ifdef DEBUG_BGQ printf( "IOUNIT_reset\n" ); #endif ( void ) ctx; int retval; IOUNIT_control_state_t * this_state = ( IOUNIT_control_state_t * ) ptr; /* we can't simply call Bgpm_Reset() since PAPI doesn't have the restriction that an EventSet has to be stopped before resetting is possible. However, BGPM does have this restriction. Hence we need to stop, reset and start */ retval = Bgpm_Stop( this_state->EventGroup ); CHECK_BGPM_ERROR( retval, "Bgpm_Stop" ); retval = Bgpm_ResetStart( this_state->EventGroup ); CHECK_BGPM_ERROR( retval, "Bgpm_ResetStart" ); return ( PAPI_OK ); }