Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 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 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 20 | #include "llvm/ADT/StringRef.h" |
| 21 | |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 22 | namespace llvm { |
| 23 | class SignpostEmitterImpl; |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 24 | |
| 25 | /// Manages the emission of signposts into the recording method supported by |
| 26 | /// the OS. |
| 27 | class SignpostEmitter { |
| 28 | SignpostEmitterImpl *Impl; |
| 29 | |
| 30 | public: |
| 31 | SignpostEmitter(); |
| 32 | ~SignpostEmitter(); |
| 33 | |
| 34 | bool isEnabled() const; |
| 35 | |
Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 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); |
Andrew Walbran | 3d2c197 | 2020-04-07 12:24:26 +0100 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | } // end namespace llvm |
| 43 | |
| 44 | #endif // ifndef LLVM_SUPPORT_SIGNPOSTS_H |