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