[llvm] 24bd9bc - [Timer] Remove signpots overhead on unsupported systems
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 10 20:47:03 PST 2025
Author: Fangrui Song
Date: 2025-01-10T20:46:57-08:00
New Revision: 24bd9bc0b59d51c82e9a4d84c21d86d58d0ef6ce
URL: https://github.com/llvm/llvm-project/commit/24bd9bc0b59d51c82e9a4d84c21d86d58d0ef6ce
DIFF: https://github.com/llvm/llvm-project/commit/24bd9bc0b59d51c82e9a4d84c21d86d58d0ef6ce.diff
LOG: [Timer] Remove signpots overhead on unsupported systems
startTimer/stopTimer are frequently called. It's important to reduce
overhead.
Added:
Modified:
llvm/lib/Support/Timer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp
index fbf3becf39fa13..089dae2886f228 100644
--- a/llvm/lib/Support/Timer.cpp
+++ b/llvm/lib/Support/Timer.cpp
@@ -53,6 +53,7 @@ class Name2PairMap;
static std::string &libSupportInfoOutputFilename();
static bool trackSpace();
static bool sortTimers();
+[[maybe_unused]]
static SignpostEmitter &signposts();
static sys::SmartMutex<true> &timerLock();
static TimerGroup &defaultTimerGroup();
@@ -149,7 +150,9 @@ TimeRecord TimeRecord::getCurrentTime(bool Start) {
void Timer::startTimer() {
assert(!Running && "Cannot start a running timer");
Running = Triggered = true;
+#if LLVM_SUPPORT_XCODE_SIGNPOSTS
signposts().startInterval(this, getName());
+#endif
StartTime = TimeRecord::getCurrentTime(true);
}
@@ -158,7 +161,9 @@ void Timer::stopTimer() {
Running = false;
Time += TimeRecord::getCurrentTime(false);
Time -= StartTime;
+#if LLVM_SUPPORT_XCODE_SIGNPOSTS
signposts().endInterval(this, getName());
+#endif
}
void Timer::clear() {
More information about the llvm-commits
mailing list