| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 Prefix = Next; | 94 Prefix = Next; |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 namespace { | 98 namespace { |
| 99 | 99 |
| 100 typedef std::multimap<double, IceString> DumpMapType; | 100 typedef std::multimap<double, IceString> DumpMapType; |
| 101 | 101 |
| 102 // Dump the Map items in reverse order of their time contribution. | 102 // Dump the Map items in reverse order of their time contribution. |
| 103 void dumpHelper(Ostream &Str, const DumpMapType &Map, double TotalTime) { | 103 void dumpHelper(Ostream &Str, const DumpMapType &Map, double TotalTime) { |
| 104 for (DumpMapType::const_reverse_iterator I = Map.rbegin(), E = Map.rend(); | 104 // TODO(stichnot): Use llvm::make_range with LLVM 3.5. |
| 105 I != E; ++I) { | 105 for (auto I = Map.rbegin(), E = Map.rend(); I != E; ++I) { |
| 106 char buf[80]; | 106 char buf[80]; |
| 107 snprintf(buf, llvm::array_lengthof(buf), " %10.6f (%4.1f%%): ", I->first, | 107 snprintf(buf, llvm::array_lengthof(buf), " %10.6f (%4.1f%%): ", I->first, |
| 108 I->first * 100 / TotalTime); | 108 I->first * 100 / TotalTime); |
| 109 Str << buf << I->second << "\n"; | 109 Str << buf << I->second << "\n"; |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // end of anonymous namespace | 113 } // end of anonymous namespace |
| 114 | 114 |
| 115 void TimerStack::dump(Ostream &Str) { | 115 void TimerStack::dump(Ostream &Str) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 140 dumpHelper(Str, FlatMap, TotalTime); | 140 dumpHelper(Str, FlatMap, TotalTime); |
| 141 Str << "Number of timer updates: " << StateChangeCount << "\n"; | 141 Str << "Number of timer updates: " << StateChangeCount << "\n"; |
| 142 } | 142 } |
| 143 | 143 |
| 144 double TimerStack::timestamp() { | 144 double TimerStack::timestamp() { |
| 145 // TODO: Implement in terms of std::chrono for C++11. | 145 // TODO: Implement in terms of std::chrono for C++11. |
| 146 return llvm::TimeRecord::getCurrentTime(false).getWallTime(); | 146 return llvm::TimeRecord::getCurrentTime(false).getWallTime(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // end of namespace Ice | 149 } // end of namespace Ice |
| OLD | NEW |