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

Side by Side Diff: src/IceTimerTree.h

Issue 620373004: Subzero: Add a few performance measurement tools. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Improve the use of containers Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | src/IceTimerTree.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTimerTree.h - Pass timer defs -------------*- C++ -*-===// 1 //===- subzero/src/IceTimerTree.h - Pass timer defs -------------*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file declares the TimerTree class, which allows flat and 10 // This file declares the TimerTree class, which allows flat and
11 // cumulative execution time collection of call chains. 11 // cumulative execution time collection of call chains.
12 // 12 //
13 //===----------------------------------------------------------------------===// 13 //===----------------------------------------------------------------------===//
14 14
15 #ifndef SUBZERO_SRC_ICETIMERTREE_H 15 #ifndef SUBZERO_SRC_ICETIMERTREE_H
16 #define SUBZERO_SRC_ICETIMERTREE_H 16 #define SUBZERO_SRC_ICETIMERTREE_H
17 17
18 #include "IceTimerTree.def"
19
18 namespace Ice { 20 namespace Ice {
19 21
20 class TimerTreeNode; 22 class TimerTreeNode;
21 23
22 // Timer tree index type 24 // Timer tree index type
23 typedef std::vector<TimerTreeNode>::size_type TTindex; 25 typedef std::vector<TimerTreeNode>::size_type TTindex;
24 26
25 // TimerTreeNode represents an interior or leaf node in the call tree. 27 // TimerTreeNode represents an interior or leaf node in the call tree.
26 // It contains a list of children, a pointer to its parent, and the 28 // It contains a list of children, a pointer to its parent, and the
27 // timer ID for the node. It also holds the cumulative time spent at 29 // timer ID for the node. It also holds the cumulative time spent at
28 // this node and below. The children are always at a higher index in 30 // this node and below. The children are always at a higher index in
29 // the TimerTreeNode::Nodes array, and the parent is always at a lower 31 // the TimerTreeNode::Nodes array, and the parent is always at a lower
30 // index. 32 // index.
31 class TimerTreeNode { 33 class TimerTreeNode {
32 public: 34 public:
33 TimerTreeNode() : Parent(0), Interior(0), Time(0) {} 35 TimerTreeNode() : Parent(0), Interior(0), Time(0) {}
34 std::vector<TTindex> Children; // indexed by TimerIdT 36 std::vector<TTindex> Children; // indexed by TimerIdT
35 TTindex Parent; 37 TTindex Parent;
36 TimerIdT Interior; 38 TimerIdT Interior;
37 double Time; 39 double Time;
38 }; 40 };
39 41
40 class TimerStack { 42 class TimerStack {
41 TimerStack(const TimerStack &) = delete; 43 // TimerStack(const TimerStack &) = delete;
42 TimerStack &operator=(const TimerStack &) = delete; 44 TimerStack &operator=(const TimerStack &) = delete;
43 45
44 public: 46 public:
45 TimerStack(const IceString &TopLevelName); 47 enum TimerTag {
46 static TimerIdT getTimerID(const IceString &Name); 48 #define X(tag) TT_##tag,
49 TIMERTREE_TABLE
50 #undef X
51 TT__num
52 };
53 TimerStack(const IceString &Name);
54 TimerIdT getTimerID(const IceString &Name);
47 void push(TimerIdT ID); 55 void push(TimerIdT ID);
48 void pop(TimerIdT ID); 56 void pop(TimerIdT ID);
49 void dump(Ostream &Str); 57 void dump(Ostream &Str, bool DumpCumulative);
50 58
51 private: 59 private:
52 void update(); 60 void update();
53 static double timestamp(); 61 static double timestamp();
62 const IceString Name;
54 const double FirstTimestamp; 63 const double FirstTimestamp;
55 double LastTimestamp; 64 double LastTimestamp;
56 uint64_t StateChangeCount; 65 uint64_t StateChangeCount;
57 static std::vector<IceString> IDs; // indexed by TimerIdT 66 // IDsIndex maps a symbolic timer name to its integer ID.
67 std::map<IceString, TimerIdT> IDsIndex;
68 std::vector<IceString> IDs; // indexed by TimerIdT
58 std::vector<TimerTreeNode> Nodes; // indexed by TTindex 69 std::vector<TimerTreeNode> Nodes; // indexed by TTindex
59 std::vector<double> LeafTimes; // indexed by TimerIdT 70 std::vector<double> LeafTimes; // indexed by TimerIdT
60 TTindex StackTop; 71 TTindex StackTop;
61 }; 72 };
62 73
63 } // end of namespace Ice 74 } // end of namespace Ice
64 75
65 #endif // SUBZERO_SRC_ICETIMERTREE_H 76 #endif // SUBZERO_SRC_ICETIMERTREE_H
OLDNEW
« no previous file with comments | « src/IceTargetLoweringX8632.cpp ('k') | src/IceTimerTree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698