/* * Returns all event values from the BGPM eventGroup */ long_long _common_getEventValue( unsigned event_id, int EventGroup ) { uint64_t value; int retval; retval = Bgpm_ReadEvent( EventGroup, event_id, &value ); retval = _check_BGPM_error( retval, "Bgpm_ReadEvent" ); if ( retval < 0 ) return retval; return ( ( long_long ) value ); }
void PrintCounts(unsigned hEvtSet) { Bgpm_MuxStats_t mStats; Bgpm_GetMultiplex(hEvtSet, &mStats); printf("\nMux Stats: numGrps=%d, numSwitches=%d, elapsedCycles=0x%016lx\n", mStats.numGrps, mStats.numSwitches, mStats.elapsedCycles); int i; printf("grpCycles: \n"); for (i=0; i<mStats.numGrps; i++) { printf(" cycles[%02d]=0x%016lx\n", i, Bgpm_GetMuxElapsedCycles(hEvtSet, i)); } printf("Counter Results:\n"); int numEvts = Bgpm_NumEvents(hEvtSet); uint64_t cnt; for (i=0; i<numEvts; i++) { Bgpm_ReadEvent(hEvtSet, i, &cnt); const char *label = Bgpm_GetEventLabel(hEvtSet, i); printf(" 0x%016lx <= %s\n", cnt, label); } }
void tw_run(void) { tw_pe *me; late_sanity_check(); me = setup_pes(); #ifdef USE_BGPM Bgpm_Init(BGPM_MODE_SWDISTRIB); // Create event set and add events needed to calculate CPI, int hEvtSet = Bgpm_CreateEventSet(); // Change the type here to get the other performance monitor sets -- defaults to instList set // Sets need to be different because there are conflicts when mixing certain events. Bgpm_AddEventList(hEvtSet, instList, sizeof(instList)/sizeof(unsigned) ); if( me->id == 0) { printf("***************************************************************************************** \n"); printf("* NOTICE: Build configured with Blue Gene/Q specific, BGPM performance monitoring code!!* \n"); printf("***************************************************************************************** \n"); } Bgpm_Apply(hEvtSet); Bgpm_Start(hEvtSet); #endif tw_sched_init(me); switch(g_tw_synchronization_protocol) { case SEQUENTIAL: // case 1 tw_scheduler_sequential(me); break; case CONSERVATIVE: // case 2 tw_scheduler_conservative(me); break; case OPTIMISTIC: // case 3 tw_scheduler_optimistic(me); break; case OPTIMISTIC_DEBUG: // case 4 tw_scheduler_optimistic_debug(me); break; default: tw_error(TW_LOC, "No Synchronization Protocol Specified! \n"); } #ifdef USE_BGPM Bgpm_Stop(hEvtSet); if( me->id == 0 ) { // Have only RANK 0 output stats int i; uint64_t cnt; int numEvts = Bgpm_NumEvents(hEvtSet); printf("\n \n ================================= \n"); printf( "Performance Counter Results:\n"); printf("--------------------------------- \n"); for (i=0; i<numEvts; i++) { Bgpm_ReadEvent(hEvtSet, i, &cnt); printf(" %40s = %20llu\n", Bgpm_GetEventLabel(hEvtSet, i), cnt); } printf("================================= \n"); } #endif }