1*9880d681SAndroid Build Coastguard WorkerTests for conversion between text and binary encoded sample profiles. 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker1- Encode the original profile into binary form. All the tests below will use 4*9880d681SAndroid Build Coastguard Worker the binary profile. 5*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata merge --sample %p/Inputs/inline-samples.afdo -o %t.profbin 6*9880d681SAndroid Build Coastguard Worker 7*9880d681SAndroid Build Coastguard Worker2- Show all functions. This profile has a single main() function with several 8*9880d681SAndroid Build Coastguard Worker inlined callees. 9*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata show --sample %t.profbin | FileCheck %s --check-prefix=SHOW1 10*9880d681SAndroid Build Coastguard WorkerSHOW1: Function: main: 366846, 0, 6 sampled lines 11*9880d681SAndroid Build Coastguard WorkerSHOW1: 2.3: inlined callee: _Z3fool: 246044, 0, 3 sampled lines 12*9880d681SAndroid Build Coastguard WorkerSHOW1: 1.3: inlined callee: _Z3bari: 0, 0, 2 sampled lines 13*9880d681SAndroid Build Coastguard WorkerSHOW1: 1.7: inlined callee: _Z3bari: 99492, 0, 2 sampled lines 14*9880d681SAndroid Build Coastguard WorkerSHOW1: 1.2: 46732 15*9880d681SAndroid Build Coastguard WorkerSHOW1: 1.8: inlined callee: _Z3bari: 0, 0, 2 sampled lines 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Worker3- Convert the binary profile to text encoding and check that they are both 18*9880d681SAndroid Build Coastguard Worker identical. 19*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata merge --sample %t.profbin --text -o - | llvm-profdata show --sample - -o %t-bintext 20*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata show --sample %p/Inputs/inline-samples.afdo -o %t-text 21*9880d681SAndroid Build Coastguard WorkerRUN: diff %t-bintext %t-text 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Worker4- Merge the binary and text encodings of the profile and check that the 24*9880d681SAndroid Build Coastguard Worker counters have doubled. 25*9880d681SAndroid Build Coastguard WorkerRUN: llvm-profdata merge --sample --text %t.profbin %p/Inputs/inline-samples.afdo -o - | FileCheck %s --check-prefix=MERGE1 26*9880d681SAndroid Build Coastguard WorkerMERGE1: main:733692:0 27*9880d681SAndroid Build Coastguard WorkerMERGE1: 2.3: 120802 28*9880d681SAndroid Build Coastguard WorkerMERGE1: 2.3: _Z3fool:492088 29*9880d681SAndroid Build Coastguard WorkerMERGE1: 1.7: _Z3bari:198984 30*9880d681SAndroid Build Coastguard WorkerMERGE1: 1.1: 105520 31