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