Index: src/IceCfg.cpp |
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp |
index f6deda0651fdc4cb382cf757230d6966ada495ad..53f9a9f76a46f7f0752c349540c246757a378fe5 100644 |
--- a/src/IceCfg.cpp |
+++ b/src/IceCfg.cpp |
@@ -81,13 +81,21 @@ bool Cfg::hasComputedFrame() const { return getTarget()->hasComputedFrame(); } |
void Cfg::translate() { |
if (hasError()) |
return; |
+ // FunctionTimer conditionally pushes/pops a TimerMarker if |
+ // TimeEachFunction is enabled. |
+ std::unique_ptr<TimerMarker> FunctionTimer; |
if (ALLOW_DUMP) { |
const IceString &TimingFocusOn = getContext()->getFlags().TimingFocusOn; |
- if (TimingFocusOn == "*" || TimingFocusOn == getFunctionName()) { |
+ const IceString &Name = getFunctionName(); |
+ if (TimingFocusOn == "*" || TimingFocusOn == Name) { |
setFocusedTiming(); |
getContext()->resetTimer(GlobalContext::TSK_Default); |
- getContext()->setTimerName(GlobalContext::TSK_Default, getFunctionName()); |
+ getContext()->setTimerName(GlobalContext::TSK_Default, Name); |
} |
+ if (getContext()->getFlags().TimeEachFunction) |
+ FunctionTimer.reset(new TimerMarker( |
+ getContext()->getTimerID(GlobalContext::TSK_Funcs, Name), |
+ getContext(), GlobalContext::TSK_Funcs)); |
} |
TimerMarker T(TimerStack::TT_translate, this); |