Path: blob/main/contrib/llvm-project/compiler-rt/include/sanitizer/memprof_interface.h
35236 views
//===-- sanitizer/memprof_interface.h --------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file is a part of MemProfiler (MemProf).9//10// Public interface header.11//===----------------------------------------------------------------------===//12#ifndef SANITIZER_MEMPROF_INTERFACE_H13#define SANITIZER_MEMPROF_INTERFACE_H1415#include <sanitizer/common_interface_defs.h>1617#ifdef __cplusplus18extern "C" {19#endif20/// Records access to a memory region (<c>[addr, addr+size)</c>).21///22/// This memory must be previously allocated by your program.23///24/// \param addr Start of memory region.25/// \param size Size of memory region.26void SANITIZER_CDECL __memprof_record_access_range(void const volatile *addr,27size_t size);2829/// Records access to a memory address <c><i>addr</i></c>.30///31/// This memory must be previously allocated by your program.32///33/// \param addr Accessed memory address34void SANITIZER_CDECL __memprof_record_access(void const volatile *addr);3536/// User-provided callback on MemProf errors.37///38/// You can provide a function that would be called immediately when MemProf39/// detects an error. This is useful in cases when MemProf detects an error but40/// your program crashes before the MemProf report is printed.41void SANITIZER_CDECL __memprof_on_error(void);4243/// Prints accumulated statistics to <c>stderr</c> (useful for calling from the44/// debugger).45void SANITIZER_CDECL __memprof_print_accumulated_stats(void);4647/// User-provided default option settings.48///49/// You can provide your own implementation of this function to return a string50/// containing MemProf runtime options (for example,51/// <c>verbosity=1:print_stats=1</c>).52///53/// \returns Default options string.54const char *SANITIZER_CDECL __memprof_default_options(void);5556/// Prints the memory profile to the current profile file.57///58/// \returns 0 on success.59int SANITIZER_CDECL __memprof_profile_dump(void);6061/// Closes the existing file descriptor, if it is valid and not stdout or62/// stderr, and resets the internal state such that the profile filename is63/// reopened on the next profile dump attempt. This can be used to enable64/// multiple rounds of profiling on the same binary.65void SANITIZER_CDECL __memprof_profile_reset(void);6667#ifdef __cplusplus68} // extern "C"69#endif7071#endif // SANITIZER_MEMPROF_INTERFACE_H727374