memprof_interface.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //===-- sanitizer/memprof_interface.h --------------------------*- 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. // This file is a part of MemProfiler (MemProf).
  10. //
  11. // Public interface header.
  12. //===----------------------------------------------------------------------===//
  13. #ifndef SANITIZER_MEMPROF_INTERFACE_H
  14. #define SANITIZER_MEMPROF_INTERFACE_H
  15. #include <sanitizer/common_interface_defs.h>
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /// Records access to a memory region (<c>[addr, addr+size)</c>).
  20. ///
  21. /// This memory must be previously allocated by your program.
  22. ///
  23. /// \param addr Start of memory region.
  24. /// \param size Size of memory region.
  25. void __memprof_record_access_range(void const volatile *addr, size_t size);
  26. /// Records access to a memory address <c><i>addr</i></c>.
  27. ///
  28. /// This memory must be previously allocated by your program.
  29. ///
  30. /// \param addr Accessed memory address
  31. void __memprof_record_access(void const volatile *addr);
  32. /// User-provided callback on MemProf errors.
  33. ///
  34. /// You can provide a function that would be called immediately when MemProf
  35. /// detects an error. This is useful in cases when MemProf detects an error but
  36. /// your program crashes before the MemProf report is printed.
  37. void __memprof_on_error(void);
  38. /// Prints accumulated statistics to <c>stderr</c> (useful for calling from the
  39. /// debugger).
  40. void __memprof_print_accumulated_stats(void);
  41. /// User-provided default option settings.
  42. ///
  43. /// You can provide your own implementation of this function to return a string
  44. /// containing MemProf runtime options (for example,
  45. /// <c>verbosity=1:print_stats=1</c>).
  46. ///
  47. /// \returns Default options string.
  48. const char *__memprof_default_options(void);
  49. /// Prints the memory profile to the current profile file.
  50. ///
  51. /// \returns 0 on success.
  52. int __memprof_profile_dump(void);
  53. #ifdef __cplusplus
  54. } // extern "C"
  55. #endif
  56. #endif // SANITIZER_MEMPROF_INTERFACE_H