xref: /freebsd/contrib/llvm-project/llvm/include/llvm/Support/Signposts.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
1 //===-- llvm/Support/Signposts.h - Interval debug annotations ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file Some OS's provide profilers that allow applications to provide custom
10 /// annotations to the profiler. For example, on Xcode 10 and later 'signposts'
11 /// can be emitted by the application and these will be rendered to the Points
12 /// of Interest track on the instruments timeline.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_SUPPORT_SIGNPOSTS_H
17 #define LLVM_SUPPORT_SIGNPOSTS_H
18 
19 #include "llvm/Support/Compiler.h"
20 #include <memory>
21 
22 namespace llvm {
23 class SignpostEmitterImpl;
24 class StringRef;
25 
26 /// Manages the emission of signposts into the recording method supported by
27 /// the OS.
28 class SignpostEmitter {
29   std::unique_ptr<SignpostEmitterImpl> Impl;
30 
31 public:
32   LLVM_ABI SignpostEmitter();
33   LLVM_ABI ~SignpostEmitter();
34 
35   LLVM_ABI bool isEnabled() const;
36 
37   /// Begin a signposted interval for a given object.
38   LLVM_ABI void startInterval(const void *O, StringRef Name);
39   /// End a signposted interval for a given object.
40   LLVM_ABI void endInterval(const void *O, StringRef Name);
41 };
42 
43 } // end namespace llvm
44 
45 #endif // LLVM_SUPPORT_SIGNPOSTS_H
46