xref: /netbsd-src/external/apache2/llvm/dist/llvm/include/llvm/Support/Signposts.h (revision 82d56013d7b633d116a93943de88e08335357a7c)
1 //===-- llvm/Support/Signposts.h - Interval debug annotations ---*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 /// \file Some OS's provide profilers that allow applications to provide custom
11 /// annotations to the profiler. For example, on Xcode 10 and later 'signposts'
12 /// can be emitted by the application and these will be rendered to the Points
13 /// of Interest track on the instruments timeline.
14 //
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef LLVM_SUPPORT_SIGNPOSTS_H
18 #define LLVM_SUPPORT_SIGNPOSTS_H
19 
20 #include "llvm/ADT/StringRef.h"
21 #include <memory>
22 
23 namespace llvm {
24 class SignpostEmitterImpl;
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   SignpostEmitter();
33   ~SignpostEmitter();
34 
35   bool isEnabled() const;
36 
37   /// Begin a signposted interval for a given object.
38   void startInterval(const void *O, StringRef Name);
39   /// End a signposted interval for a given object.
40   void endInterval(const void *O, StringRef Name);
41 };
42 
43 } // end namespace llvm
44 
45 #endif // LLVM_SUPPORT_SIGNPOSTS_H
46