sample-profile-basic.test 1.5 KB

123456789101112131415161718192021222324252627282930
  1. Basic tests for sample profiles.
  2. 1- Show all functions
  3. RUN: llvm-profdata show --sample %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=SHOW1
  4. SHOW1: Function: main: 184019, 0, 7 sampled lines
  5. SHOW1: line offset: 9, discriminator: 0, number of samples: 2064, calls: _Z3fooi:631 _Z3bari:1471
  6. SHOW1: Function: _Z3fooi: 7711, 610, 1 sampled lines
  7. SHOW1: Function: _Z3bari: 20301, 1437, 1 sampled lines
  8. SHOW1: line offset: 1, discriminator: 0, number of samples: 1437
  9. 2- Show only bar
  10. RUN: llvm-profdata show --sample --function=_Z3bari %p/Inputs/sample-profile.proftext | FileCheck %s --check-prefix=SHOW2
  11. SHOW2: Function: _Z3bari: 20301, 1437, 1 sampled lines
  12. SHOW2: line offset: 1, discriminator: 0, number of samples: 1437
  13. SHOW2-NOT: Function: main: 184019, 0, 7 sampled lines
  14. SHOW2-NOT: Function: _Z3fooi: 7711, 610, 1 sampled lines
  15. 3- Convert the profile to binary encoding and check that they are both
  16. identical.
  17. RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext --binary -o - | llvm-profdata show --sample - -o %t-binary
  18. RUN: llvm-profdata show --sample %p/Inputs/sample-profile.proftext -o %t-text
  19. RUN: diff %t-binary %t-text
  20. 4- Merge the binary and text encodings of the profile and check that the
  21. counters have doubled.
  22. RUN: llvm-profdata merge --sample %p/Inputs/sample-profile.proftext -o %t-binprof
  23. RUN: llvm-profdata merge --sample --text %p/Inputs/sample-profile.proftext %t-binprof -o - | FileCheck %s --check-prefix=MERGE1
  24. MERGE1: main:368038:0
  25. MERGE1: 9: 4128 _Z3fooi:1262 _Z3bari:2942
  26. MERGE1: _Z3fooi:15422:1220