diff options
| author | Diego Novillo <dnovillo@google.com> | 2014-11-01 00:56:55 +0000 |
|---|---|---|
| committer | Diego Novillo <dnovillo@google.com> | 2014-11-01 00:56:55 +0000 |
| commit | d5336ae269d86af133cb465e1b0dba38121f11c2 (patch) | |
| tree | 705c53dae847beba892284f1db28aa96b31d93e3 /llvm/test | |
| parent | a33cd6aa27ab02514224dd461504e10cc0e14fac (diff) | |
| download | bcm5719-llvm-d5336ae269d86af133cb465e1b0dba38121f11c2.tar.gz bcm5719-llvm-d5336ae269d86af133cb465e1b0dba38121f11c2.zip | |
Add show and merge tools for sample PGO profiles.
Summary:
This patch extends the 'show' and 'merge' commands in llvm-profdata to handle
sample PGO formats. Using the 'merge' command it is now possible to convert
one sample PGO format to another.
The only format that is currently not working is 'gcc'. I still need to
implement support for it in lib/ProfileData.
The changes in the sample profile support classes are needed for the
merge operation.
Reviewers: bogner
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D6065
llvm-svn: 221032
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/tools/llvm-profdata/Inputs/sample-profile.proftext | 12 | ||||
| -rw-r--r-- | llvm/test/tools/llvm-profdata/sample-profile-basic.test | 30 |
2 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-profdata/Inputs/sample-profile.proftext b/llvm/test/tools/llvm-profdata/Inputs/sample-profile.proftext new file mode 100644 index 00000000000..9dc6d4310da --- /dev/null +++ b/llvm/test/tools/llvm-profdata/Inputs/sample-profile.proftext @@ -0,0 +1,12 @@ +_Z3bari:20301:1437 +1: 1437 +_Z3fooi:7711:610 +1: 610 +main:184019:0 +4: 534 +4.2: 534 +5: 1075 +5.1: 1075 +6: 2080 +7: 534 +9: 2064 _Z3bari:1471 _Z3fooi:631 diff --git a/llvm/test/tools/llvm-profdata/sample-profile-basic.test b/llvm/test/tools/llvm-profdata/sample-profile-basic.test new file mode 100644 index 00000000000..0651c513e96 --- /dev/null +++ b/llvm/test/tools/llvm-profdata/sample-profile-basic.test @@ -0,0 +1,30 @@ +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: Function: main: 184019, 0, 7 sampled lines +SHOW1: line offset: 9, discriminator: 0, number of samples: 2064, calls: _Z3fooi:631 _Z3bari:1471 +SHOW1: Function: _Z3fooi: 7711, 610, 1 sampled lines +SHOW1: Function: _Z3bari: 20301, 1437, 1 sampled lines +SHOW1: line offset: 1, discriminator: 0, number of samples: 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: line offset: 1, discriminator: 0, number of samples: 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 _Z3fooi:1262 _Z3bari:2942 +MERGE1: _Z3fooi:15422:1220 |

