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

Unified Diff: src/IceGlobalContext.h

Issue 610813002: Subzero: Rewrite the pass timing infrastructure. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Make the optimized overlaps() implementation actually correct Created 6 years, 3 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/IceDefs.h ('k') | src/IceGlobalContext.cpp » ('j') | src/IceOperand.cpp » ('J')
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 f997b65f1ba22e698bd5dc17ad1d649234dd9b57..3c5377304fd1171b87e1deaf951b96642712acf5 100644
--- a/src/IceGlobalContext.h
+++ b/src/IceGlobalContext.h
@@ -69,12 +69,8 @@ public:
// Returns true if any of the specified options in the verbose mask
// are set. If the argument is omitted, it checks if any verbose
- // options at all are set. IceV_Timing is treated specially, so
- // that running with just IceV_Timing verbosity doesn't trigger an
- // avalanche of extra output.
- bool isVerbose(VerboseMask Mask = (IceV_All & ~IceV_Timing)) const {
- return VMask & Mask;
- }
+ // options at all are set.
+ bool isVerbose(VerboseMask Mask = IceV_All) const { return VMask & Mask; }
void setVerbose(VerboseMask Mask) { VMask = Mask; }
void addVerbose(VerboseMask Mask) { VMask |= Mask; }
void subVerbose(VerboseMask Mask) { VMask &= ~Mask; }
@@ -154,6 +150,11 @@ public:
StatsCumulative.updateFills();
}
+ static TimerIdT getTimerID(const IceString &Name);
+ void pushTimer(TimerIdT ID);
+ void popTimer(TimerIdT ID);
+ void dumpTimers();
+
private:
Ostream *StrDump; // Stream for dumping / diagnostics
Ostream *StrEmit; // Stream for code emission
@@ -170,6 +171,7 @@ private:
RandomNumberGenerator RNG;
CodeStats StatsFunction;
CodeStats StatsCumulative;
+ llvm::OwningPtr<class TimerStack> Timers;
GlobalContext(const GlobalContext &) LLVM_DELETED_FUNCTION;
GlobalContext &operator=(const GlobalContext &) LLVM_DELETED_FUNCTION;
@@ -178,6 +180,30 @@ private:
void incrementSubstitutions(ManglerVector &OldName) const;
};
+// Helper class to push and pop a timer marker. The constructor
+// pushes a marker, and the destructor pops it. This is for
+// convenient timing of regions of code.
+class TimerMarker {
+ TimerMarker(const TimerMarker &) LLVM_DELETED_FUNCTION;
+ TimerMarker &operator=(const TimerMarker &) LLVM_DELETED_FUNCTION;
+
+public:
+ TimerMarker(TimerIdT ID, GlobalContext *Ctx)
+ : ID(ID), Ctx(Ctx), Active(Ctx->getFlags().SubzeroTimingEnabled) {
+ if (Active)
+ Ctx->pushTimer(ID);
+ }
+ ~TimerMarker() {
+ if (Active)
+ Ctx->popTimer(ID);
+ }
+
+private:
+ TimerIdT ID;
+ GlobalContext *const Ctx;
+ const bool Active;
+};
+
} // end of namespace Ice
#endif // SUBZERO_SRC_ICEGLOBALCONTEXT_H
« no previous file with comments | « src/IceDefs.h ('k') | src/IceGlobalContext.cpp » ('j') | src/IceOperand.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698