blob: 8036b1f53663458b9d7d68dd9b7849057bb8835c [file] [log] [blame]
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001//===-- 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 Deprezf4ef2d02021-04-20 13:36:24 +020020#include "llvm/ADT/StringRef.h"
21
Andrew Walbran3d2c1972020-04-07 12:24:26 +010022namespace llvm {
23class SignpostEmitterImpl;
Andrew Walbran3d2c1972020-04-07 12:24:26 +010024
25/// Manages the emission of signposts into the recording method supported by
26/// the OS.
27class SignpostEmitter {
28 SignpostEmitterImpl *Impl;
29
30public:
31 SignpostEmitter();
32 ~SignpostEmitter();
33
34 bool isEnabled() const;
35
Olivier Deprezf4ef2d02021-04-20 13:36:24 +020036 /// 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 Walbran3d2c1972020-04-07 12:24:26 +010040};
41
42} // end namespace llvm
43
44#endif // ifndef LLVM_SUPPORT_SIGNPOSTS_H