| Index: src/IceGlobalContext.cpp
|
| diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
|
| index 7ea7e5dd02d10eaa64310926fb54b3cc9d3d4efc..4a7b6b576a37616050be0cb0f5793598aa6f90ff 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::NumTimerStacks = GlobalContext::TSK_Num;
|
|
|
| -void GlobalContext::popTimer(TimerIdT ID) { Timers->pop(ID); }
|
| +TimerStackIdT GlobalContext::getTimerStackID() { return NumTimerStacks++; }
|
| +
|
| +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);
|
| +}
|
| +
|
| +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
|
|
|