diff options
author | Fangrui Song <i@maskray.me> | 2025-01-10 20:46:57 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2025-01-10 20:46:57 -0800 |
commit | 24bd9bc0b59d51c82e9a4d84c21d86d58d0ef6ce (patch) | |
tree | adce014d614918f76cb5c148dfdd87b578f1f0b3 /llvm/lib/Support/Timer.cpp | |
parent | 799955eb176042999b4d12a901b1c33b42035014 (diff) | |
download | llvm-24bd9bc0b59d51c82e9a4d84c21d86d58d0ef6ce.zip llvm-24bd9bc0b59d51c82e9a4d84c21d86d58d0ef6ce.tar.gz llvm-24bd9bc0b59d51c82e9a4d84c21d86d58d0ef6ce.tar.bz2 |
[Timer] Remove signpots overhead on unsupported systems
startTimer/stopTimer are frequently called. It's important to reduce
overhead.
Diffstat (limited to 'llvm/lib/Support/Timer.cpp')
-rw-r--r-- | llvm/lib/Support/Timer.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp index fbf3bec..089dae2 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() { |