1// Check atexit option.
2
3// RUN: %clangxx_memprof -O0 %s -o %t
4// RUN: %env_memprof_opts=print_text=true:log_path=stderr:atexit=1 %run %t 2>&1 | FileCheck %s
5// RUN: %env_memprof_opts=print_text=true:log_path=stderr:atexit=0 %run %t 2>&1 | FileCheck %s --check-prefix=NOATEXIT
6
7// CHECK: MemProfiler exit stats:
8// CHECK: Stats: {{[0-9]+}}M malloced ({{[0-9]+}}M for overhead) by {{[0-9]+}} calls
9// CHECK: Stats: {{[0-9]+}}M realloced by {{[0-9]+}} calls
10// CHECK: Stats: {{[0-9]+}}M freed by {{[0-9]+}} calls
11// CHECK: Stats: {{[0-9]+}}M really freed by {{[0-9]+}} calls
12// CHECK: Stats: {{[0-9]+}}M ({{[0-9]+}}M-{{[0-9]+}}M) mmaped; {{[0-9]+}} maps, {{[0-9]+}} unmaps
13// CHECK: mallocs by size class:
14// CHECK: Stats: malloc large: {{[0-9]+}}
15
16// NOATEXIT-NOT: MemProfiler exit stats
17
18int main() {
19 return 0;
20}
21

source code of compiler-rt/test/memprof/TestCases/atexit_stats.cpp