blob: 421f002da9f98ef0ae5a76b6f30bd8c4c4f5acfa [file] [log] [blame]
Diego Novilloa7f1e8e2015-10-09 17:54:24 +00001Tests for conversion between text and binary encoded sample profiles.
2
31- Encode the original profile into binary form. All the tests below will use
4 the binary profile.
5RUN: llvm-profdata merge --sample %p/Inputs/inline-samples.afdo -o %t.profbin
6
72- Show all functions. This profile has a single main() function with several
8 inlined callees.
9RUN: llvm-profdata show --sample %t.profbin | FileCheck %s --check-prefix=SHOW1
10SHOW1: Function: main: 366846, 0, 6 sampled lines
Diego Novillo8e415a82015-11-13 20:24:28 +000011SHOW1: 2.3: inlined callee: _Z3fool: 246044, 0, 3 sampled lines
12SHOW1: 1.3: inlined callee: _Z3bari: 0, 0, 2 sampled lines
Diego Novillo8e415a82015-11-13 20:24:28 +000013SHOW1: 1.7: inlined callee: _Z3bari: 99492, 0, 2 sampled lines
14SHOW1: 1.2: 46732
Diego Novilloef548d22015-11-19 15:33:08 +000015SHOW1: 1.8: inlined callee: _Z3bari: 0, 0, 2 sampled lines
Diego Novilloa7f1e8e2015-10-09 17:54:24 +000016
173- Convert the binary profile to text encoding and check that they are both
18 identical.
19RUN: llvm-profdata merge --sample %t.profbin --text -o - | llvm-profdata show --sample - -o %t-bintext
20RUN: llvm-profdata show --sample %p/Inputs/inline-samples.afdo -o %t-text
21RUN: diff %t-bintext %t-text
22
234- Merge the binary and text encodings of the profile and check that the
24 counters have doubled.
25RUN: llvm-profdata merge --sample --text %t.profbin %p/Inputs/inline-samples.afdo -o - | FileCheck %s --check-prefix=MERGE1
26MERGE1: main:733692:0
27MERGE1: 2.3: 120802
28MERGE1: 2.3: _Z3fool:492088
29MERGE1: 1.7: _Z3bari:198984
30MERGE1: 1.1: 105520