1// REQUIRES: linux
2// RUN: %clang_profgen -O2 -o %t %s
3// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
4// RUN: llvm-profdata show --profile-version %t.profraw > %t.profraw.out
5// RUN: FileCheck %s --check-prefix=RAW-PROF < %t.profraw.out
6
7// RUN: rm -rf %t.profdir
8// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
9// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
10// RUN: env LLVM_PROFILE_FILE=%t.profdir/default_%m.profraw %run %t
11// RUN: llvm-profdata show --profile-version %t.profdir/default_*.profraw > %t.profraw.out
12// RUN: FileCheck %s --check-prefix=INDEXED-PROF < %t.profraw.out
13
14void foo() {}
15
16void bar() {}
17
18int main() {
19 foo();
20 bar();
21 return 0;
22}
23
24// RAW-PROF: Instrumentation level: Front-end
25// RAW-PROF-NEXT: Total functions: 3
26// RAW-PROF-NEXT: Maximum function count: 1
27// RAW-PROF-NEXT: Maximum internal block count: 0
28// RAW-PROF-NEXT: Profile version: {{[0-9]+}}
29
30// INDEXED-PROF: Instrumentation level: Front-end
31// INDEXED-PROF-NEXT: Total functions: 3
32// INDEXED-PROF-NEXT: Maximum function count: 3
33// INDEXED-PROF-NEXT: Maximum internal block count: 0
34// INDEXED-PROF-NEXT: Profile version: {{[0-9]+}}
35

source code of compiler-rt/test/profile/Linux/profile-version.c