VOID Fini(int, VOID * v) { ComputeGlobalStats(); *out << "#\n" "#pattern-type count percent\n" "#\n"; *out << "All Threads" << endl; COUNTER total = 0; for (int i = PATTERN_INVALID+1; i < PATTERN_LAST; i++) total += GlobalStats.pattern[i]; *out << std::setprecision(4) << showpoint; for (int i = PATTERN_INVALID+1; i < PATTERN_LAST; i++) *out << ljstr(pattern_t2str(static_cast<pattern_t>(i)),15) << decstr( GlobalStats.pattern[i],12) << "\t" << std::setw(10) << 100.0*GlobalStats.pattern[i]/total << std::endl; *out<< endl; EmitPerThreadStats(out); *out << "# eof" << endl; out->close(); }
/* ===================================================================== */ VOID EmitPerThreadStats(ostream* out) { *out << std::setprecision(4) << showpoint; for(UINT32 thd = 0 ; thd < numThreads; thd++) { STATS ThreadStats; for(UINT32 i=0;i<PATTERN_LAST;i++) ThreadStats.pattern[i] = 0; for (list<const BBLSTATS*>::iterator bi = statsList.begin(); bi != statsList.end(); bi++) for (const UINT16 * stats = (*bi)->_stats; *stats; stats++) ThreadStats.pattern[*stats] += (*bi)->_counter[thd]; COUNTER total = 0; for (int i = PATTERN_INVALID+1; i < PATTERN_LAST; i++) total += ThreadStats.pattern[i]; *out << "Thread " << thd << endl; for (int i = PATTERN_INVALID+1; i < PATTERN_LAST; i++) *out << ljstr(pattern_t2str(static_cast<pattern_t>(i)),15) << decstr( ThreadStats.pattern[i],12) << "\t" << std::setw(10) << 100.0*ThreadStats.pattern[i]/total << std::endl; *out << endl; } }
/* ===================================================================== */ VOID DumpStats(ofstream& out, STATS& stats, const string& title) { out << "#\n" "# " << title << "\n" "#\n" "#num category count-unpredicated count-predicated count-predicated-true\n" "#\n"; for ( UINT32 i = 0; i < MAX_INDEX; i++) { if( stats.unpredicated[i] == 0 && stats.predicated[i] == 0 ) continue; out << decstr(i,3) << " " << ljstr(CATEGORY_StringShort(i),15) << decstr( stats.unpredicated[i],12) << decstr( stats.predicated[i],12) << decstr( stats.predicated_true[i],12) << endl; } }
VOID Fini(int, VOID * v) { ComputeGlobalStats(); *out << "#\n" "#num reg count-read count-written\n" "#\n"; for ( UINT32 i = 0; i < MAX_REG; i++) { if( GlobalStats.reg_w[i] == 0 && GlobalStats.reg_r[i] == 0 ) continue; *out << decstr(i,3) << " " << ljstr(REG_StringShort(REG(i)),15) << decstr( GlobalStats.reg_r[i],12) << decstr( GlobalStats.reg_w[i],12) << endl; } *out << "# eof" << endl; out->close(); }