OLD | NEW |
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" | 18 #include "IceTimerTree.def" |
19 | 19 |
20 namespace Ice { | 20 namespace Ice { |
21 | 21 |
22 class TimerTreeNode; | 22 class TimerStack { |
| 23 TimerStack &operator=(const TimerStack &) = delete; |
23 | 24 |
24 // Timer tree index type | 25 // Timer tree index type |
25 typedef std::vector<TimerTreeNode>::size_type TTindex; | 26 typedef std::vector<class TimerTreeNode>::size_type TTindex; |
26 | 27 |
27 // TimerTreeNode represents an interior or leaf node in the call tree. | 28 // TimerTreeNode represents an interior or leaf node in the call tree. |
28 // It contains a list of children, a pointer to its parent, and the | 29 // It contains a list of children, a pointer to its parent, and the |
29 // timer ID for the node. It also holds the cumulative time spent at | 30 // timer ID for the node. It also holds the cumulative time spent at |
30 // this node and below. The children are always at a higher index in | 31 // this node and below. The children are always at a higher index in |
31 // the TimerTreeNode::Nodes array, and the parent is always at a lower | 32 // the TimerTreeNode::Nodes array, and the parent is always at a lower |
32 // index. | 33 // index. |
33 class TimerTreeNode { | 34 class TimerTreeNode { |
34 // TimerTreeNode(const TimerTreeNode &) = delete; | 35 TimerTreeNode &operator=(const TimerTreeNode &) = delete; |
35 TimerTreeNode &operator=(const TimerTreeNode &) = delete; | |
36 | 36 |
37 public: | 37 public: |
38 TimerTreeNode() : Parent(0), Interior(0), Time(0), UpdateCount(0) {} | 38 TimerTreeNode() : Parent(0), Interior(0), Time(0), UpdateCount(0) {} |
39 std::vector<TTindex> Children; // indexed by TimerIdT | 39 TimerTreeNode(const TimerTreeNode &) = default; |
40 TTindex Parent; | 40 std::vector<TTindex> Children; // indexed by TimerIdT |
41 TimerIdT Interior; | 41 TTindex Parent; |
42 double Time; | 42 TimerIdT Interior; |
43 size_t UpdateCount; | 43 double Time; |
44 }; | 44 size_t UpdateCount; |
45 | 45 }; |
46 class TimerStack { | |
47 // TimerStack(const TimerStack &) = delete; | |
48 TimerStack &operator=(const TimerStack &) = delete; | |
49 | 46 |
50 public: | 47 public: |
51 enum TimerTag { | 48 enum TimerTag { |
52 #define X(tag) TT_##tag, | 49 #define X(tag) TT_##tag, |
53 TIMERTREE_TABLE | 50 TIMERTREE_TABLE |
54 #undef X | 51 #undef X |
55 TT__num | 52 TT__num |
56 }; | 53 }; |
57 TimerStack(const IceString &Name); | 54 TimerStack(const IceString &Name); |
| 55 TimerStack(const TimerStack &) = default; |
58 TimerIdT getTimerID(const IceString &Name); | 56 TimerIdT getTimerID(const IceString &Name); |
59 void setName(const IceString &NewName) { Name = NewName; } | 57 void setName(const IceString &NewName) { Name = NewName; } |
60 void push(TimerIdT ID); | 58 void push(TimerIdT ID); |
61 void pop(TimerIdT ID); | 59 void pop(TimerIdT ID); |
62 void reset(); | 60 void reset(); |
63 void dump(Ostream &Str, bool DumpCumulative); | 61 void dump(Ostream &Str, bool DumpCumulative); |
64 | 62 |
65 private: | 63 private: |
66 void update(bool UpdateCounts); | 64 void update(bool UpdateCounts); |
67 static double timestamp(); | 65 static double timestamp(); |
68 IceString Name; | 66 IceString Name; |
69 double FirstTimestamp; | 67 double FirstTimestamp; |
70 double LastTimestamp; | 68 double LastTimestamp; |
71 uint64_t StateChangeCount; | 69 uint64_t StateChangeCount; |
72 // IDsIndex maps a symbolic timer name to its integer ID. | 70 // IDsIndex maps a symbolic timer name to its integer ID. |
73 std::map<IceString, TimerIdT> IDsIndex; | 71 std::map<IceString, TimerIdT> IDsIndex; |
74 std::vector<IceString> IDs; // indexed by TimerIdT | 72 std::vector<IceString> IDs; // indexed by TimerIdT |
75 std::vector<TimerTreeNode> Nodes; // indexed by TTindex | 73 std::vector<TimerTreeNode> Nodes; // indexed by TTindex |
76 std::vector<double> LeafTimes; // indexed by TimerIdT | 74 std::vector<double> LeafTimes; // indexed by TimerIdT |
77 std::vector<size_t> LeafCounts; // indexed by TimerIdT | 75 std::vector<size_t> LeafCounts; // indexed by TimerIdT |
78 TTindex StackTop; | 76 TTindex StackTop; |
79 }; | 77 }; |
80 | 78 |
81 } // end of namespace Ice | 79 } // end of namespace Ice |
82 | 80 |
83 #endif // SUBZERO_SRC_ICETIMERTREE_H | 81 #endif // SUBZERO_SRC_ICETIMERTREE_H |
OLD | NEW |