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" | 15 #include "llvm/Support/Timer.h" |
16 | 16 |
17 #include "IceDefs.h" | 17 #include "IceDefs.h" |
18 #include "IceTimerTree.h" | 18 #include "IceTimerTree.h" |
19 | 19 |
20 namespace Ice { | 20 namespace Ice { |
21 | 21 |
22 TimerStack::TimerStack(const IceString &Name) | 22 TimerStack::TimerStack(const IceString &Name) |
23 : Name(Name), FirstTimestamp(timestamp()), LastTimestamp(FirstTimestamp), | 23 : Name(Name), FirstTimestamp(timestamp()), LastTimestamp(FirstTimestamp) { |
24 StateChangeCount(0), StackTop(0) { | |
25 if (!ALLOW_DUMP) | 24 if (!ALLOW_DUMP) |
26 return; | 25 return; |
27 Nodes.resize(1); // Reserve Nodes[0] for the root node (sentinel). | 26 Nodes.resize(1); // Reserve Nodes[0] for the root node (sentinel). |
28 IDs.resize(TT__num); | 27 IDs.resize(TT__num); |
29 LeafTimes.resize(TT__num); | 28 LeafTimes.resize(TT__num); |
30 LeafCounts.resize(TT__num); | 29 LeafCounts.resize(TT__num); |
31 #define STR(s) #s | 30 #define STR(s) #s |
32 #define X(tag) \ | 31 #define X(tag) \ |
33 IDs[TT_##tag] = STR(tag); \ | 32 IDs[TT_##tag] = STR(tag); \ |
34 IDsIndex[STR(tag)] = TT_##tag; | 33 IDsIndex[STR(tag)] = TT_##tag; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 dumpHelper(Str, FlatMap, TotalTime); | 298 dumpHelper(Str, FlatMap, TotalTime); |
300 Str << "Number of timer updates: " << StateChangeCount << "\n"; | 299 Str << "Number of timer updates: " << StateChangeCount << "\n"; |
301 } | 300 } |
302 | 301 |
303 double TimerStack::timestamp() { | 302 double TimerStack::timestamp() { |
304 // TODO: Implement in terms of std::chrono for C++11. | 303 // TODO: Implement in terms of std::chrono for C++11. |
305 return llvm::TimeRecord::getCurrentTime(false).getWallTime(); | 304 return llvm::TimeRecord::getCurrentTime(false).getWallTime(); |
306 } | 305 } |
307 | 306 |
308 } // end of namespace Ice | 307 } // end of namespace Ice |
OLD | NEW |