aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Signposts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/Signposts.cpp')
-rw-r--r--llvm/lib/Support/Signposts.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/llvm/lib/Support/Signposts.cpp b/llvm/lib/Support/Signposts.cpp
index aa159e1..91ce909 100644
--- a/llvm/lib/Support/Signposts.cpp
+++ b/llvm/lib/Support/Signposts.cpp
@@ -33,21 +33,20 @@ void LogDeleter(os_log_t *X) {
namespace llvm {
class SignpostEmitterImpl {
- using LogPtrTy =
- std::unique_ptr<os_log_t, std::function<void(os_log_t *)>>;
+ using LogPtrTy = std::unique_ptr<os_log_t, std::function<void(os_log_t *)>>;
using LogTy = LogPtrTy::element_type;
LogPtrTy SignpostLog;
- DenseMap<const Timer *, os_signpost_id_t> Signposts;
+ DenseMap<const void *, os_signpost_id_t> Signposts;
LogTy &getLogger() const { return *SignpostLog; }
- os_signpost_id_t getSignpostForTimer(const Timer *T) {
- const auto &I = Signposts.find(T);
+ os_signpost_id_t getSignpostForObject(const void *O) {
+ const auto &I = Signposts.find(O);
if (I != Signposts.end())
return I->second;
const auto &Inserted = Signposts.insert(
- std::make_pair(T, os_signpost_id_make_with_pointer(getLogger(), T)));
+ std::make_pair(O, os_signpost_id_make_with_pointer(getLogger(), O)));
return Inserted.first->second;
}
@@ -56,20 +55,19 @@ public:
bool isEnabled() const { return os_signpost_enabled(*SignpostLog); }
- void startTimerInterval(Timer *T) {
+ void startInterval(const void *O, llvm::StringRef Name) {
if (isEnabled()) {
- // Both strings used here are required to be constant literal strings
- os_signpost_interval_begin(getLogger(), getSignpostForTimer(T),
- "Pass Timers", "Begin %s",
- T->getName().c_str());
+ // Both strings used here are required to be constant literal strings.
+ os_signpost_interval_begin(getLogger(), getSignpostForObject(O),
+ "LLVM Timers", "Begin %s", Name.data());
}
}
- void endTimerInterval(Timer *T) {
+ void endInterval(const void *O, llvm::StringRef Name) {
if (isEnabled()) {
- // Both strings used here are required to be constant literal strings
- os_signpost_interval_end(getLogger(), getSignpostForTimer(T),
- "Pass Timers", "End %s", T->getName().c_str());
+ // Both strings used here are required to be constant literal strings.
+ os_signpost_interval_end(getLogger(), getSignpostForObject(O),
+ "LLVM Timers", "End %s", Name.data());
}
}
};
@@ -85,7 +83,7 @@ public:
SignpostEmitter::SignpostEmitter() {
#if HAVE_ANY_SIGNPOST_IMPL
Impl = new SignpostEmitterImpl();
-#else // if HAVE_ANY_SIGNPOST_IMPL
+#else // if HAVE_ANY_SIGNPOST_IMPL
Impl = nullptr;
#endif // if !HAVE_ANY_SIGNPOST_IMPL
}
@@ -104,18 +102,18 @@ bool SignpostEmitter::isEnabled() const {
#endif // if !HAVE_ANY_SIGNPOST_IMPL
}
-void SignpostEmitter::startTimerInterval(Timer *T) {
+void SignpostEmitter::startInterval(const void *O, StringRef Name) {
#if HAVE_ANY_SIGNPOST_IMPL
if (Impl == nullptr)
return;
- return Impl->startTimerInterval(T);
+ return Impl->startInterval(O, Name);
#endif // if !HAVE_ANY_SIGNPOST_IMPL
}
-void SignpostEmitter::endTimerInterval(Timer *T) {
+void SignpostEmitter::endInterval(const void *O, StringRef Name) {
#if HAVE_ANY_SIGNPOST_IMPL
if (Impl == nullptr)
return;
- Impl->endTimerInterval(T);
+ Impl->endInterval(O, Name);
#endif // if !HAVE_ANY_SIGNPOST_IMPL
}