1// REQUIRES: linux || windows
2
3// RUN: %clang -fprofile-instr-generate -fcoverage-mapping -mllvm -runtime-counter-relocation=true -o %t.exe %s
4// RUN: echo "garbage" > %t.profraw
5// RUN: env LLVM_PROFILE_FILE="%c%t.profraw" %run %t.exe
6// RUN: llvm-profdata show --counts --all-functions %t.profraw | FileCheck %s -check-prefix=CHECK-COUNTS
7// RUN: llvm-profdata merge -o %t.profdata %t.profraw
8// RUN: llvm-cov report %t.exe -instr-profile %t.profdata | FileCheck %s -check-prefix=CHECK-COVERAGE
9
10// CHECK-COUNTS: Counters:
11// CHECK-COUNTS-NEXT: main:
12// CHECK-COUNTS-NEXT: Hash: 0x{{.*}}
13// CHECK-COUNTS-NEXT: Counters: 2
14// CHECK-COUNTS-NEXT: Function count: 1
15// CHECK-COUNTS-NEXT: Block counts: [1]
16// CHECK-COUNTS-NEXT: Instrumentation level: Front-end
17// CHECK-COUNTS-NEXT: Functions shown: 1
18// CHECK-COUNTS-NEXT: Total functions: 1
19// CHECK-COUNTS-NEXT: Maximum function count: 1
20// CHECK-COUNTS-NEXT: Maximum internal block count: 1
21
22// CHECK-COVERAGE: Filename Regions Missed Regions Cover Functions Missed Functions Executed Lines Missed Lines Cover
23// CHECK-COVERAGE-NEXT: ---
24// CHECK-COVERAGE-NEXT: runtime-counter-relocation.c 4 1 75.00% 1 0 100.00% 5 1 80.00%
25// CHECK-COVERAGE-NEXT: ---
26// CHECK-COVERAGE-NEXT: TOTAL 4 1 75.00% 1 0 100.00% 5 1 80.00%
27
28extern int __llvm_profile_is_continuous_mode_enabled(void);
29
30int main() {
31 if (__llvm_profile_is_continuous_mode_enabled())
32 return 0;
33 return 1;
34}
35

source code of compiler-rt/test/profile/ContinuousSyncMode/runtime-counter-relocation.c