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 |
11 // cumulative execution time collection of call chains. | 11 // cumulative execution time collection of call chains. |
12 // | 12 // |
13 //===----------------------------------------------------------------------===// | 13 //===----------------------------------------------------------------------===// |
14 | 14 |
| 15 #include "llvm/Support/Timer.h" |
| 16 |
15 #include "IceDefs.h" | 17 #include "IceDefs.h" |
16 #include "IceTimerTree.h" | 18 #include "IceTimerTree.h" |
17 | 19 |
18 namespace Ice { | 20 namespace Ice { |
19 | 21 |
20 std::vector<IceString> TimerStack::IDs; | 22 std::vector<IceString> TimerStack::IDs; |
21 | 23 |
22 TimerStack::TimerStack(const IceString &TopLevelName) | 24 TimerStack::TimerStack(const IceString &TopLevelName) |
23 : FirstTimestamp(timestamp()), LastTimestamp(FirstTimestamp), | 25 : FirstTimestamp(timestamp()), LastTimestamp(FirstTimestamp), |
24 StateChangeCount(0), StackTop(0) { | 26 StateChangeCount(0), StackTop(0) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 dumpHelper(Str, CumulativeMap, TotalTime); | 134 dumpHelper(Str, CumulativeMap, TotalTime); |
133 Str << "Flat function times:\n"; | 135 Str << "Flat function times:\n"; |
134 DumpMapType FlatMap; | 136 DumpMapType FlatMap; |
135 for (TimerIdT i = 0; i < LeafTimes.size(); ++i) { | 137 for (TimerIdT i = 0; i < LeafTimes.size(); ++i) { |
136 FlatMap.insert(std::make_pair(LeafTimes[i], IDs[i])); | 138 FlatMap.insert(std::make_pair(LeafTimes[i], IDs[i])); |
137 } | 139 } |
138 dumpHelper(Str, FlatMap, TotalTime); | 140 dumpHelper(Str, FlatMap, TotalTime); |
139 Str << "Number of timer updates: " << StateChangeCount << "\n"; | 141 Str << "Number of timer updates: " << StateChangeCount << "\n"; |
140 } | 142 } |
141 | 143 |
| 144 double TimerStack::timestamp() { |
| 145 // TODO: Implement in terms of std::chrono for C++11. |
| 146 return llvm::TimeRecord::getCurrentTime(false).getWallTime(); |
| 147 } |
| 148 |
142 } // end of namespace Ice | 149 } // end of namespace Ice |
OLD | NEW |