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