Chromium Code Reviews| Index: src/IceGlobalContext.cpp |
| diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp |
| index 7ea7e5dd02d10eaa64310926fb54b3cc9d3d4efc..02c8f089d44ed7d04feb9b1ca33109d7ad6b73c3 100644 |
| --- a/src/IceGlobalContext.cpp |
| +++ b/src/IceGlobalContext.cpp |
| @@ -119,7 +119,7 @@ GlobalContext::GlobalContext(llvm::raw_ostream *OsDump, |
| : StrDump(OsDump), StrEmit(OsEmit), VMask(Mask), |
| ConstPool(new ConstantPool()), Arch(Arch), Opt(Opt), |
| TestPrefix(TestPrefix), Flags(Flags), HasEmittedFirstMethod(false), |
| - RNG(""), Timers(new TimerStack("main")) {} |
| + RNG("") {} |
| // Scan a string for S[0-9A-Z]*_ patterns and replace them with |
| // S<num>_ where <num> is the next base-36 value. If a type name |
| @@ -385,9 +385,20 @@ TimerIdT GlobalContext::getTimerID(const IceString &Name) { |
| return TimerStack::getTimerID(Name); |
| } |
| -void GlobalContext::pushTimer(TimerIdT ID) { Timers->push(ID); } |
| +TimerStackIdT GlobalContext::NumTimerStackIds = GlobalContext::TSK_Num; |
| -void GlobalContext::popTimer(TimerIdT ID) { Timers->pop(ID); } |
| +TimerStackIdT GlobalContext::getTimerStackID() { return NumTimerStackIds++; } |
| + |
| +void GlobalContext::pushTimer(TimerIdT ID, TimerStackIdT StackID) { |
| + if (Timers.size() <= StackID) |
| + Timers.resize(StackID + 1); |
| + Timers[StackID].push(ID); |
| +} |
| + |
| +void GlobalContext::popTimer(TimerIdT ID, TimerStackIdT StackID) { |
| + assert(Timers.size() > StackID); |
| + Timers[StackID].pop(ID); |
| +} |
| void GlobalContext::dumpStats(const IceString &Name, bool Final) { |
| if (Flags.DumpStats) { |
| @@ -400,6 +411,16 @@ void GlobalContext::dumpStats(const IceString &Name, bool Final) { |
| } |
| } |
| -void GlobalContext::dumpTimers() { Timers->dump(getStrDump()); } |
| +void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) { |
| + assert(Timers.size() > StackID); |
| + Timers[StackID].dump(getStrDump(), DumpCumulative); |
|
jvoung (off chromium)
2014/10/06 16:30:56
Maybe the dump() can indicate which StackID the du
Jim Stichnoth
2014/10/06 21:29:57
Done.
|
| +} |
| + |
| +TimerMarker::TimerMarker(TimerIdT ID, const Cfg *Func) |
| + : ID(ID), Ctx(Func->getContext()), |
| + Active(Func->getFocusedTiming() || Ctx->getFlags().SubzeroTimingEnabled) { |
| + if (Active) |
| + Ctx->pushTimer(ID); |
| +} |
| } // end of namespace Ice |