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

Unified Diff: src/IceTimerTree.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
Index: src/IceTimerTree.h
diff --git a/src/IceTimerTree.h b/src/IceTimerTree.h
new file mode 100644
index 0000000000000000000000000000000000000000..3162587aed191081878a8064a9e2741351d48c59
--- /dev/null
+++ b/src/IceTimerTree.h
@@ -0,0 +1,68 @@
+//===- subzero/src/IceTimerTree.h - Pass timer defs -------------*- C++ -*-===//
+//
+// The Subzero Code Generator
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares the TimerTree class, which allows flat and
+// cumulative execution time collection of call chains.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SUBZERO_SRC_ICETIMERTREE_H
+#define SUBZERO_SRC_ICETIMERTREE_H
+
+namespace Ice {
+
+class TimerTreeNode;
+
+// Timer tree index type
+typedef std::vector<TimerTreeNode>::size_type TTindex;
+
+// TimerTreeNode represents an interior or leaf node in the call tree.
+// It contains a list of children, a pointer to its parent, and the
+// timer ID for the node. It also holds the cumulative time spent at
+// this node and below. The children are always at a higher index in
+// the TimerTreeNode::Nodes array, and the parent is always at a lower
+// index.
+class TimerTreeNode {
+public:
+ TimerTreeNode() : Parent(0), Interior(0), Time(0) {}
+ std::vector<TTindex> Children; // indexed by TimerIdT
+ TTindex Parent;
+ TimerIdT Interior;
+ double Time;
+};
+
+class TimerStack {
+ TimerStack(const TimerStack &) LLVM_DELETED_FUNCTION;
+ TimerStack &operator=(const TimerStack &) LLVM_DELETED_FUNCTION;
+
+public:
+ TimerStack(const IceString &TopLevelName);
+ static TimerIdT getTimerID(const IceString &Name);
+ void push(TimerIdT ID);
+ void pop(TimerIdT ID);
+ void dump(Ostream &Str);
+
+private:
+ void update();
+ static double timestamp() {
+ // TODO: Implement in terms of std::chrono for C++11.
+ return llvm::TimeRecord::getCurrentTime(false).getWallTime();
+ }
+ const double FirstTimestamp;
+ double LastTimestamp;
+ uint64_t StateChangeCount;
+ static std::vector<IceString> IDs; // indexed by TimerIdT
+ std::vector<TimerTreeNode> Nodes; // indexed by TTindex
+ std::vector<double> LeafTimes; // indexed by TimerIdT
+ TTindex StackTop;
+};
+
+} // end of namespace Ice
+
+#endif // SUBZERO_SRC_ICETIMERTREE_H
« src/IceOperand.cpp ('K') | « src/IceTargetLoweringX8632.cpp ('k') | src/IceTimerTree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698