OLD | NEW |
1 //===- subzero/src/IceTimerTree.cpp - Pass timer defs ---------------------===// | 1 //===- subzero/src/IceTimerTree.cpp - Pass timer defs ---------------------===// |
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 defines the TimerTree class, which tracks flat and | 10 // This file defines the TimerTree class, which tracks flat and |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 Prefix = Next; | 92 Prefix = Next; |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 namespace { | 96 namespace { |
97 | 97 |
98 typedef std::multimap<double, IceString> DumpMapType; | 98 typedef std::multimap<double, IceString> DumpMapType; |
99 | 99 |
100 // Dump the Map items in reverse order of their time contribution. | 100 // Dump the Map items in reverse order of their time contribution. |
101 void dumpHelper(Ostream &Str, const DumpMapType &Map, double TotalTime) { | 101 void dumpHelper(Ostream &Str, const DumpMapType &Map, double TotalTime) { |
102 for (DumpMapType::const_reverse_iterator I = Map.rbegin(), E = Map.rend(); | 102 for (auto I = Map.rbegin(), E = Map.rend(); I != E; ++I) { |
103 I != E; ++I) { | |
104 char buf[80]; | 103 char buf[80]; |
105 snprintf(buf, llvm::array_lengthof(buf), " %10.6f (%4.1f%%): ", I->first, | 104 snprintf(buf, llvm::array_lengthof(buf), " %10.6f (%4.1f%%): ", I->first, |
106 I->first * 100 / TotalTime); | 105 I->first * 100 / TotalTime); |
107 Str << buf << I->second << "\n"; | 106 Str << buf << I->second << "\n"; |
108 } | 107 } |
109 } | 108 } |
110 | 109 |
111 } // end of anonymous namespace | 110 } // end of anonymous namespace |
112 | 111 |
113 void TimerStack::dump(Ostream &Str) { | 112 void TimerStack::dump(Ostream &Str) { |
(...skipping 19 matching lines...) Expand all Loading... |
133 Str << "Flat function times:\n"; | 132 Str << "Flat function times:\n"; |
134 DumpMapType FlatMap; | 133 DumpMapType FlatMap; |
135 for (TimerIdT i = 0; i < LeafTimes.size(); ++i) { | 134 for (TimerIdT i = 0; i < LeafTimes.size(); ++i) { |
136 FlatMap.insert(std::make_pair(LeafTimes[i], IDs[i])); | 135 FlatMap.insert(std::make_pair(LeafTimes[i], IDs[i])); |
137 } | 136 } |
138 dumpHelper(Str, FlatMap, TotalTime); | 137 dumpHelper(Str, FlatMap, TotalTime); |
139 Str << "Number of timer updates: " << StateChangeCount << "\n"; | 138 Str << "Number of timer updates: " << StateChangeCount << "\n"; |
140 } | 139 } |
141 | 140 |
142 } // end of namespace Ice | 141 } // end of namespace Ice |
OLD | NEW |