File: sample-profile-basic.test

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (35 lines) | stat: -rw-r--r-- 1,723 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Basic tests for sample profiles.

1- Show all functions
RUN: llvm-profdata show --sample %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=SHOW1
SHOW1-DAG: Function: main: 184019, 0, 7 sampled lines
SHOW1-DAG: 9: 2064, calls: _Z3bari:1471 _Z3fooi:631
SHOW1-DAG: Function: _Z3fooi: 7711, 610, 1 sampled lines
SHOW1-DAG: Function: _Z3bari: 20301, 1437, 1 sampled lines
SHOW1-DAG: 1: 1437

2- Show only bar
RUN: llvm-profdata show --sample --function=_Z3bari %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=SHOW2
SHOW2: Function: _Z3bari: 20301, 1437, 1 sampled lines
SHOW2: 1: 1437
SHOW2-NOT: Function: main: 184019, 0, 7 sampled lines
SHOW2-NOT: Function: _Z3fooi: 7711, 610, 1 sampled lines

3- Convert the profile to binary encoding and check that they are both
   identical.
RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --binary -o - | llvm-profdata show --sample - -o %t-binary
RUN: llvm-profdata show --sample %p/Inputs/sample-profile.proftext -o %t-text
RUN: diff %t-binary %t-text

4- Merge the binary and text encodings of the profile and check that the
   counters have doubled.
RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext -o %t-binprof
RUN: llvm-profdata merge --sample --text %p/Inputs/sample-profile.proftext %t-binprof -o - | FileCheck %s --check-prefix=MERGE1
MERGE1: main:368038:0
MERGE1: 9: 4128 _Z3bari:2942 _Z3fooi:1262
MERGE1: _Z3bari:40602:2874
MERGE1: _Z3fooi:15422:1220

5- Detect invalid text encoding (e.g. instrumentation profile text format).
RUN: not llvm-profdata show --sample %p/Inputs/foo3bar3-1.proftext 2>&1 | FileCheck %s --check-prefix=BADTEXT
BADTEXT: error: {{.+}}: Unrecognized sample profile encoding format