Signposts.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- llvm/Support/Signposts.h - Interval debug annotations ---*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. /// \file Some OS's provide profilers that allow applications to provide custom
  15. /// annotations to the profiler. For example, on Xcode 10 and later 'signposts'
  16. /// can be emitted by the application and these will be rendered to the Points
  17. /// of Interest track on the instruments timeline.
  18. //
  19. //===----------------------------------------------------------------------===//
  20. #ifndef LLVM_SUPPORT_SIGNPOSTS_H
  21. #define LLVM_SUPPORT_SIGNPOSTS_H
  22. #include <memory>
  23. namespace llvm {
  24. class SignpostEmitterImpl;
  25. class StringRef;
  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. public:
  31. SignpostEmitter();
  32. ~SignpostEmitter();
  33. bool isEnabled() const;
  34. /// Begin a signposted interval for a given object.
  35. void startInterval(const void *O, StringRef Name);
  36. /// End a signposted interval for a given object.
  37. void endInterval(const void *O, StringRef Name);
  38. };
  39. } // end namespace llvm
  40. #endif // LLVM_SUPPORT_SIGNPOSTS_H
  41. #ifdef __GNUC__
  42. #pragma GCC diagnostic pop
  43. #endif