Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: src/IceGlobalContext.cpp

Issue 887213002: Subzero: Fix stats collection and output for multithreading. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Convert CodeStats to x-macros Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/IceGlobalContext.h ('K') | « src/IceGlobalContext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===// 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file defines aspects of the compilation that persist across 10 // This file defines aspects of the compilation that persist across
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 TypePool<IceType_i16, int16_t, ConstantInteger32> Integers16; 104 TypePool<IceType_i16, int16_t, ConstantInteger32> Integers16;
105 TypePool<IceType_i32, int32_t, ConstantInteger32> Integers32; 105 TypePool<IceType_i32, int32_t, ConstantInteger32> Integers32;
106 TypePool<IceType_i64, int64_t, ConstantInteger64> Integers64; 106 TypePool<IceType_i64, int64_t, ConstantInteger64> Integers64;
107 TypePool<IceType_i32, RelocatableTuple, ConstantRelocatable> Relocatables; 107 TypePool<IceType_i32, RelocatableTuple, ConstantRelocatable> Relocatables;
108 UndefPool Undefs; 108 UndefPool Undefs;
109 }; 109 };
110 110
111 void GlobalContext::CodeStats::dump(const IceString &Name, Ostream &Str) { 111 void GlobalContext::CodeStats::dump(const IceString &Name, Ostream &Str) {
112 if (!ALLOW_DUMP) 112 if (!ALLOW_DUMP)
113 return; 113 return;
114 Str << "|" << Name << "|Inst Count |" << InstructionsEmitted << "\n"; 114 #define X(str, tag) \
115 Str << "|" << Name << "|Regs Saved |" << RegistersSaved << "\n"; 115 Str << "|" << Name << "|" str "|" << Stats[CS_##tag] << "\n";
116 Str << "|" << Name << "|Frame Bytes |" << FrameBytes << "\n"; 116 CODESTATS_TABLE
117 Str << "|" << Name << "|Spills |" << Spills << "\n"; 117 #undef X
118 Str << "|" << Name << "|Fills |" << Fills << "\n"; 118 Str << "|" << Name << "|Spills+Fills|"
119 Str << "|" << Name << "|Spills+Fills|" << Spills + Fills << "\n"; 119 << Stats[CS_NumSpills] + Stats[CS_NumFills] << "\n";
120 Str << "|" << Name << "|Memory Usage|"; 120 Str << "|" << Name << "|Memory Usage|";
121 if (ssize_t MemUsed = llvm::TimeRecord::getCurrentTime(false).getMemUsed()) 121 if (ssize_t MemUsed = llvm::TimeRecord::getCurrentTime(false).getMemUsed())
122 Str << MemUsed; 122 Str << MemUsed;
123 else 123 else
124 Str << "(requires '-track-memory')"; 124 Str << "(requires '-track-memory')";
125 Str << "\n"; 125 Str << "\n";
126 } 126 }
127 127
128 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit, 128 GlobalContext::GlobalContext(Ostream *OsDump, Ostream *OsEmit,
129 ELFStreamer *ELFStr, VerboseMask Mask, 129 ELFStreamer *ELFStr, VerboseMask Mask,
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 } 536 }
537 537
538 void GlobalContext::dumpStats(const IceString &Name, bool Final) { 538 void GlobalContext::dumpStats(const IceString &Name, bool Final) {
539 if (!ALLOW_DUMP || !getFlags().DumpStats) 539 if (!ALLOW_DUMP || !getFlags().DumpStats)
540 return; 540 return;
541 OstreamLocker OL(this); 541 OstreamLocker OL(this);
542 if (Final) { 542 if (Final) {
543 getStatsCumulative()->dump(Name, getStrDump()); 543 getStatsCumulative()->dump(Name, getStrDump());
544 } else { 544 } else {
545 ICE_TLS_GET_FIELD(TLS)->StatsFunction.dump(Name, getStrDump()); 545 ICE_TLS_GET_FIELD(TLS)->StatsFunction.dump(Name, getStrDump());
546 getStatsCumulative()->dump("_TOTAL_", getStrDump());
547 } 546 }
548 } 547 }
549 548
550 void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) { 549 void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) {
551 if (!ALLOW_DUMP) 550 if (!ALLOW_DUMP)
552 return; 551 return;
553 auto Timers = getTimers(); 552 auto Timers = getTimers();
554 assert(Timers->size() > StackID); 553 assert(Timers->size() > StackID);
555 OstreamLocker L(this); 554 OstreamLocker L(this);
556 Timers->at(StackID).dump(getStrDump(), DumpCumulative); 555 Timers->at(StackID).dump(getStrDump(), DumpCumulative);
(...skipping 17 matching lines...) Expand all
574 void TimerMarker::pushCfg(const Cfg *Func) { 573 void TimerMarker::pushCfg(const Cfg *Func) {
575 Ctx = Func->getContext(); 574 Ctx = Func->getContext();
576 Active = Func->getFocusedTiming() || Ctx->getFlags().SubzeroTimingEnabled; 575 Active = Func->getFocusedTiming() || Ctx->getFlags().SubzeroTimingEnabled;
577 if (Active) 576 if (Active)
578 Ctx->pushTimer(ID, StackID); 577 Ctx->pushTimer(ID, StackID);
579 } 578 }
580 579
581 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); 580 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS);
582 581
583 } // end of namespace Ice 582 } // end of namespace Ice
OLDNEW
« src/IceGlobalContext.h ('K') | « src/IceGlobalContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698