memprof_flags.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //===-- memprof_flags.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, a memory profiler.
  10. //
  11. // MemProf runtime flags.
  12. //===----------------------------------------------------------------------===//
  13. #ifndef MEMPROF_FLAGS_H
  14. #define MEMPROF_FLAGS_H
  15. #include "sanitizer_common/sanitizer_flag_parser.h"
  16. #include "sanitizer_common/sanitizer_internal_defs.h"
  17. // MemProf flag values can be defined in four ways:
  18. // 1) initialized with default values at startup.
  19. // 2) overriden during compilation of MemProf runtime by providing
  20. // compile definition MEMPROF_DEFAULT_OPTIONS.
  21. // 3) overriden from string returned by user-specified function
  22. // __memprof_default_options().
  23. // 4) overriden from env variable MEMPROF_OPTIONS.
  24. namespace __memprof {
  25. struct Flags {
  26. #define MEMPROF_FLAG(Type, Name, DefaultValue, Description) Type Name;
  27. #include "memprof_flags.inc"
  28. #undef MEMPROF_FLAG
  29. void SetDefaults();
  30. };
  31. extern Flags memprof_flags_dont_use_directly;
  32. inline Flags *flags() { return &memprof_flags_dont_use_directly; }
  33. void InitializeFlags();
  34. } // namespace __memprof
  35. #endif // MEMPROF_FLAGS_H