OLD | NEW |
1 //===- subzero/src/IceDefs.h - Common Subzero declaraions -------*- C++ -*-===// | 1 //===- subzero/src/IceDefs.h - Common Subzero declaraions -------*- 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 various useful types and classes that have | 10 // This file declares various useful types and classes that have |
(...skipping 83 matching lines...) Loading... |
94 IceV_Deleted = 1 << 1, | 94 IceV_Deleted = 1 << 1, |
95 IceV_InstNumbers = 1 << 2, | 95 IceV_InstNumbers = 1 << 2, |
96 IceV_Preds = 1 << 3, | 96 IceV_Preds = 1 << 3, |
97 IceV_Succs = 1 << 4, | 97 IceV_Succs = 1 << 4, |
98 IceV_Liveness = 1 << 5, | 98 IceV_Liveness = 1 << 5, |
99 IceV_RegManager = 1 << 6, | 99 IceV_RegManager = 1 << 6, |
100 IceV_RegOrigins = 1 << 7, | 100 IceV_RegOrigins = 1 << 7, |
101 IceV_LinearScan = 1 << 8, | 101 IceV_LinearScan = 1 << 8, |
102 IceV_Frame = 1 << 9, | 102 IceV_Frame = 1 << 9, |
103 IceV_Timing = 1 << 10, | 103 IceV_Timing = 1 << 10, |
| 104 IceV_Random = 1 << 11, |
104 IceV_All = ~IceV_None | 105 IceV_All = ~IceV_None |
105 }; | 106 }; |
106 typedef uint32_t VerboseMask; | 107 typedef uint32_t VerboseMask; |
107 | 108 |
108 typedef llvm::raw_ostream Ostream; | 109 typedef llvm::raw_ostream Ostream; |
109 | 110 |
110 // TODO: Implement in terms of std::chrono after switching to C++11. | 111 // TODO: Implement in terms of std::chrono after switching to C++11. |
111 class Timer { | 112 class Timer { |
112 public: | 113 public: |
113 Timer() : Start(llvm::TimeRecord::getCurrentTime(false)) {} | 114 Timer() : Start(llvm::TimeRecord::getCurrentTime(false)) {} |
114 uint64_t getElapsedNs() const { return getElapsedSec() * 1000 * 1000 * 1000; } | 115 uint64_t getElapsedNs() const { return getElapsedSec() * 1000 * 1000 * 1000; } |
115 uint64_t getElapsedUs() const { return getElapsedSec() * 1000 * 1000; } | 116 uint64_t getElapsedUs() const { return getElapsedSec() * 1000 * 1000; } |
116 uint64_t getElapsedMs() const { return getElapsedSec() * 1000; } | 117 uint64_t getElapsedMs() const { return getElapsedSec() * 1000; } |
117 double getElapsedSec() const { | 118 double getElapsedSec() const { |
118 llvm::TimeRecord End = llvm::TimeRecord::getCurrentTime(false); | 119 llvm::TimeRecord End = llvm::TimeRecord::getCurrentTime(false); |
119 return End.getWallTime() - Start.getWallTime(); | 120 return End.getWallTime() - Start.getWallTime(); |
120 } | 121 } |
121 void printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const; | 122 void printElapsedUs(GlobalContext *Ctx, const IceString &Tag) const; |
122 | 123 |
123 private: | 124 private: |
124 const llvm::TimeRecord Start; | 125 const llvm::TimeRecord Start; |
125 Timer(const Timer &) LLVM_DELETED_FUNCTION; | 126 Timer(const Timer &) LLVM_DELETED_FUNCTION; |
126 Timer &operator=(const Timer &) LLVM_DELETED_FUNCTION; | 127 Timer &operator=(const Timer &) LLVM_DELETED_FUNCTION; |
127 }; | 128 }; |
128 | 129 |
129 } // end of namespace Ice | 130 } // end of namespace Ice |
130 | 131 |
131 #endif // SUBZERO_SRC_ICEDEFS_H | 132 #endif // SUBZERO_SRC_ICEDEFS_H |
OLD | NEW |