| 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 /// \file | 10 /// \file |
| 11 /// This file declares the TimerTree class, which allows flat and | 11 /// This file declares the TimerTree class, which allows flat and cumulative |
| 12 /// cumulative execution time collection of call chains. | 12 /// execution time collection of call chains. |
| 13 /// | 13 /// |
| 14 //===----------------------------------------------------------------------===// | 14 //===----------------------------------------------------------------------===// |
| 15 | 15 |
| 16 #ifndef SUBZERO_SRC_ICETIMERTREE_H | 16 #ifndef SUBZERO_SRC_ICETIMERTREE_H |
| 17 #define SUBZERO_SRC_ICETIMERTREE_H | 17 #define SUBZERO_SRC_ICETIMERTREE_H |
| 18 | 18 |
| 19 // TODO(jpp): Refactor IceDefs. | 19 // TODO(jpp): Refactor IceDefs. |
| 20 #include "IceDefs.h" | 20 #include "IceDefs.h" |
| 21 #include "IceTimerTree.def" | 21 #include "IceTimerTree.def" |
| 22 | 22 |
| 23 namespace Ice { | 23 namespace Ice { |
| 24 | 24 |
| 25 class TimerStack { | 25 class TimerStack { |
| 26 TimerStack() = delete; | 26 TimerStack() = delete; |
| 27 TimerStack &operator=(const TimerStack &) = delete; | 27 TimerStack &operator=(const TimerStack &) = delete; |
| 28 | 28 |
| 29 /// Timer tree index type. A variable of this type is used to access | 29 /// Timer tree index type. A variable of this type is used to access an |
| 30 /// an interior, not-necessarily-leaf node of the tree. | 30 /// interior, not-necessarily-leaf node of the tree. |
| 31 using TTindex = std::vector<class TimerTreeNode>::size_type; | 31 using TTindex = std::vector<class TimerTreeNode>::size_type; |
| 32 /// Representation of a path of leaf values leading to a particular | 32 /// Representation of a path of leaf values leading to a particular node. The |
| 33 /// node. The representation happens to be in "reverse" order, | 33 /// representation happens to be in "reverse" order, i.e. from leaf/interior |
| 34 /// i.e. from leaf/interior to root, for implementation efficiency. | 34 /// to root, for implementation efficiency. |
| 35 using PathType = llvm::SmallVector<TTindex, 8>; | 35 using PathType = llvm::SmallVector<TTindex, 8>; |
| 36 /// Representation of a mapping of leaf node indexes from one timer | 36 /// Representation of a mapping of leaf node indexes from one timer stack to |
| 37 /// stack to another. | 37 /// another. |
| 38 using TranslationType = std::vector<TimerIdT>; | 38 using TranslationType = std::vector<TimerIdT>; |
| 39 | 39 |
| 40 /// TimerTreeNode represents an interior or leaf node in the call tree. | 40 /// TimerTreeNode represents an interior or leaf node in the call tree. It |
| 41 /// It contains a list of children, a pointer to its parent, and the | 41 /// contains a list of children, a pointer to its parent, and the timer ID for |
| 42 /// timer ID for the node. It also holds the cumulative time spent at | 42 /// the node. It also holds the cumulative time spent at this node and below. |
| 43 /// this node and below. The children are always at a higher index in | 43 /// The children are always at a higher index in the TimerTreeNode::Nodes |
| 44 /// the TimerTreeNode::Nodes array, and the parent is always at a lower | 44 /// array, and the parent is always at a lower index. |
| 45 /// index. | |
| 46 class TimerTreeNode { | 45 class TimerTreeNode { |
| 47 TimerTreeNode &operator=(const TimerTreeNode &) = delete; | 46 TimerTreeNode &operator=(const TimerTreeNode &) = delete; |
| 48 | 47 |
| 49 public: | 48 public: |
| 50 TimerTreeNode() = default; | 49 TimerTreeNode() = default; |
| 51 TimerTreeNode(const TimerTreeNode &) = default; | 50 TimerTreeNode(const TimerTreeNode &) = default; |
| 52 std::vector<TTindex> Children; // indexed by TimerIdT | 51 std::vector<TTindex> Children; // indexed by TimerIdT |
| 53 TTindex Parent = 0; | 52 TTindex Parent = 0; |
| 54 TimerIdT Interior = 0; | 53 TimerIdT Interior = 0; |
| 55 double Time = 0; | 54 double Time = 0; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 std::vector<IceString> IDs; /// indexed by TimerIdT | 89 std::vector<IceString> IDs; /// indexed by TimerIdT |
| 91 std::vector<TimerTreeNode> Nodes; /// indexed by TTindex | 90 std::vector<TimerTreeNode> Nodes; /// indexed by TTindex |
| 92 std::vector<double> LeafTimes; /// indexed by TimerIdT | 91 std::vector<double> LeafTimes; /// indexed by TimerIdT |
| 93 std::vector<size_t> LeafCounts; /// indexed by TimerIdT | 92 std::vector<size_t> LeafCounts; /// indexed by TimerIdT |
| 94 TTindex StackTop = 0; | 93 TTindex StackTop = 0; |
| 95 }; | 94 }; |
| 96 | 95 |
| 97 } // end of namespace Ice | 96 } // end of namespace Ice |
| 98 | 97 |
| 99 #endif // SUBZERO_SRC_ICETIMERTREE_H | 98 #endif // SUBZERO_SRC_ICETIMERTREE_H |
| OLD | NEW |