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 <memory>
20 
21 namespace llvm {
22 class SignpostEmitterImpl;
23 class StringRef;
24 
25 /// Manages the emission of signposts into the recording method supported by
26 /// the OS.
27 class SignpostEmitter {
28   std::unique_ptr<SignpostEmitterImpl> Impl;
29 
30 public:
31   SignpostEmitter();
32   ~SignpostEmitter();
33 
34   bool isEnabled() const;
35 
36   /// Begin a signposted interval for a given object.
37   void startInterval(const void *O, StringRef Name);
38   /// End a signposted interval for a given object.
39   void endInterval(const void *O, StringRef Name);
40 };
41 
42 } // end namespace llvm
43 
44 #endif // LLVM_SUPPORT_SIGNPOSTS_H
45