Signposts.h 1.4 KB

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