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

Unified Diff: src/IceGlobalContext.h

Issue 1784243006: Subzero: Improve the use of timers. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceELFObjectWriter.cpp ('k') | src/IceGlobalContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceGlobalContext.h
diff --git a/src/IceGlobalContext.h b/src/IceGlobalContext.h
index c8d86af669b4c725751609dc121b60138b0813d0..261f87ccad1a710cc316c2ba7db16cec73e6e693 100644
--- a/src/IceGlobalContext.h
+++ b/src/IceGlobalContext.h
@@ -118,7 +118,7 @@ class GlobalContext {
/// timers, in the same order, with the same names, but initially
/// empty of timing data.
void initInto(TimerList &Dest) const {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return;
Dest.clear();
for (const TimerStack &Stack : *this) {
@@ -126,7 +126,7 @@ class GlobalContext {
}
}
void mergeFrom(TimerList &Src) {
- if (!BuildDefs::dump())
+ if (!BuildDefs::timers())
return;
assert(size() == Src.size());
size_type i = 0;
@@ -381,7 +381,7 @@ public:
}
EmitterThreads.clear();
- if (BuildDefs::dump()) {
+ if (BuildDefs::timers()) {
auto Timers = getTimers();
for (ThreadContext *TLS : AllThreadContexts)
Timers->mergeFrom(TLS->Timers);
@@ -560,25 +560,33 @@ public:
TimerMarker(TimerIdT ID, GlobalContext *Ctx,
TimerStackIdT StackID = GlobalContext::TSK_Default)
: ID(ID), Ctx(Ctx), StackID(StackID) {
- if (BuildDefs::dump())
+ if (BuildDefs::timers())
push();
}
TimerMarker(TimerIdT ID, const Cfg *Func,
TimerStackIdT StackID = GlobalContext::TSK_Default)
: ID(ID), Ctx(nullptr), StackID(StackID) {
// Ctx gets set at the beginning of pushCfg().
- if (BuildDefs::dump())
+ if (BuildDefs::timers())
pushCfg(Func);
}
+ TimerMarker(GlobalContext *Ctx, const IceString &FuncName)
+ : ID(getTimerIdFromFuncName(Ctx, FuncName)), Ctx(Ctx),
+ StackID(GlobalContext::TSK_Funcs) {
+ if (BuildDefs::timers())
+ push();
+ }
~TimerMarker() {
- if (BuildDefs::dump() && Active)
+ if (BuildDefs::timers() && Active)
Ctx->popTimer(ID, StackID);
}
private:
void push();
void pushCfg(const Cfg *Func);
+ static TimerIdT getTimerIdFromFuncName(GlobalContext *Ctx,
+ const IceString &FuncName);
const TimerIdT ID;
GlobalContext *Ctx;
const TimerStackIdT StackID;
« no previous file with comments | « src/IceELFObjectWriter.cpp ('k') | src/IceGlobalContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698