11#include "llvm/Config/config.h"
13#if LLVM_SUPPORT_XCODE_SIGNPOSTS
16#include <Availability.h>
17#include <os/signpost.h>
22#if LLVM_SUPPORT_XCODE_SIGNPOSTS
23#define SIGNPOSTS_AVAILABLE() \
24 __builtin_available(macos 10.14, iOS 12, tvOS 12, watchOS 5, *)
26os_log_t *LogCreator() {
27 os_log_t *
X =
new os_log_t;
28 *
X = os_log_create(
"org.llvm.signposts",
"toolchain");
32 void operator()(os_log_t *
X)
const {
41 using LogPtrTy = std::unique_ptr<os_log_t, LogDeleter>;
42 using LogTy = LogPtrTy::element_type;
48 LogTy &getLogger()
const {
return *SignpostLog; }
49 os_signpost_id_t getSignpostForObject(
const void *O) {
54 os_signpost_id_t
ID = {};
55 if (SIGNPOSTS_AVAILABLE()) {
56 ID = os_signpost_id_make_with_pointer(getLogger(), O);
65 bool isEnabled()
const {
66 if (SIGNPOSTS_AVAILABLE())
67 return os_signpost_enabled(*SignpostLog);
73 if (SIGNPOSTS_AVAILABLE()) {
75 os_signpost_interval_begin(getLogger(), getSignpostForObject(O),
76 "LLVM Timers",
"%s",
Name.data());
83 if (SIGNPOSTS_AVAILABLE()) {
85 os_signpost_interval_end(getLogger(), getSignpostForObject(O),
97#if LLVM_SUPPORT_XCODE_SIGNPOSTS
98#define HAVE_ANY_SIGNPOST_IMPL 1
100#define HAVE_ANY_SIGNPOST_IMPL 0
104#if HAVE_ANY_SIGNPOST_IMPL
105 Impl = std::make_unique<SignpostEmitterImpl>();
112#if HAVE_ANY_SIGNPOST_IMPL
113 return Impl->isEnabled();
120#if HAVE_ANY_SIGNPOST_IMPL
123 return Impl->startInterval(O,
Name);
128#if HAVE_ANY_SIGNPOST_IMPL
131 Impl->endInterval(O,
Name);
This file defines the DenseMap class.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static ManagedStatic< SignpostEmitter > Signposts
Allows llvm::Timer to emit signposts when supported.
Definition necessary for use of std::unique_ptr in SignpostEmitter::Impl.
void endInterval(const void *O, StringRef Name)
End a signposted interval for a given object.
void startInterval(const void *O, StringRef Name)
Begin a signposted interval for a given object.
StringRef - Represent a constant reference to a string, i.e.
SmartMutex - A mutex with a compile time constant parameter that indicates whether this mutex should ...
SmartMutex< false > Mutex
Mutex - A standard, always enforced mutex.
std::lock_guard< SmartMutex< mt_only > > SmartScopedLock
This is an optimization pass for GlobalISel generic memory operations.