Skip to content

Commit 24bd9bc

Browse files
committed
[Timer] Remove signpots overhead on unsupported systems
startTimer/stopTimer are frequently called. It's important to reduce overhead.
1 parent 799955e commit 24bd9bc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

llvm/lib/Support/Timer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class Name2PairMap;
5353
static std::string &libSupportInfoOutputFilename();
5454
static bool trackSpace();
5555
static bool sortTimers();
56+
[[maybe_unused]]
5657
static SignpostEmitter &signposts();
5758
static sys::SmartMutex<true> &timerLock();
5859
static TimerGroup &defaultTimerGroup();
@@ -149,7 +150,9 @@ TimeRecord TimeRecord::getCurrentTime(bool Start) {
149150
void Timer::startTimer() {
150151
assert(!Running && "Cannot start a running timer");
151152
Running = Triggered = true;
153+
#if LLVM_SUPPORT_XCODE_SIGNPOSTS
152154
signposts().startInterval(this, getName());
155+
#endif
153156
StartTime = TimeRecord::getCurrentTime(true);
154157
}
155158

@@ -158,7 +161,9 @@ void Timer::stopTimer() {
158161
Running = false;
159162
Time += TimeRecord::getCurrentTime(false);
160163
Time -= StartTime;
164+
#if LLVM_SUPPORT_XCODE_SIGNPOSTS
161165
signposts().endInterval(this, getName());
166+
#endif
162167
}
163168

164169
void Timer::clear() {

0 commit comments

Comments
 (0)