File: inline-samples.test

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (31 lines) | stat: -rw-r--r-- 1,519 bytes parent folder | download | duplicates (28)
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
Tests for conversion between text and binary encoded sample profiles.

1- Encode the original profile into binary form. All the tests below will use
   the binary profile.
RUN: llvm-profdata merge --sample %p/Inputs/inline-samples.afdo -o %t.profbin

2- Show all functions. This profile has a single main() function with several
   inlined callees.
RUN: llvm-profdata show --sample %t.profbin | FileCheck %s --check-prefix=SHOW1
SHOW1: Function: main: 366846, 0, 6 sampled lines
SHOW1: 2.3: inlined callee: _Z3fool: 246044, 0, 3 sampled lines
SHOW1:   1.3: inlined callee: _Z3bari: 0, 0, 2 sampled lines
SHOW1:   1.7: inlined callee: _Z3bari: 99492, 0, 2 sampled lines
SHOW1:     1.2: 46732
SHOW1:   1.8: inlined callee: _Z3bari: 0, 0, 2 sampled lines

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

4- Merge the binary and text encodings of the profile and check that the
   counters have doubled.
RUN: llvm-profdata merge --sample --text %t.profbin %p/Inputs/inline-samples.afdo -o - | FileCheck %s --check-prefix=MERGE1
RUN: llvm-profdata merge --sample --text - < %t.profbin %p/Inputs/inline-samples.afdo -o - | FileCheck %s --check-prefix=MERGE1
MERGE1: main:733692:0
MERGE1: 2.3: 120802
MERGE1: 2.3: _Z3fool:492088
MERGE1: 1.7: _Z3bari:198984
MERGE1: 1.1: 105520