diff options
author | Vedant Kumar <vsk@apple.com> | 2016-07-19 01:17:20 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2016-07-19 01:17:20 +0000 |
commit | e3a0bf504859c95513d75df06aca1a6d38c44d60 (patch) | |
tree | b98db977f7a0aa95ee9bde587472456dc8855404 /llvm/test/tools/llvm-profdata/multiple-inputs.test | |
parent | 21ab20e0050d18185f6020a32aadd73c351a7e1d (diff) | |
download | bcm5719-llvm-e3a0bf504859c95513d75df06aca1a6d38c44d60.tar.gz bcm5719-llvm-e3a0bf504859c95513d75df06aca1a6d38c44d60.zip |
Retry: [llvm-profdata] Speed up merging by using a thread pool
Add a "-j" option to llvm-profdata to control the number of threads used.
Auto-detect NumThreads when it isn't specified, and avoid spawning threads when
they wouldn't be beneficial.
I tested this patch using a raw profile produced by clang (147MB). Here is the
time taken to merge 4 copies together on my laptop:
No thread pool: 112.87s user 5.92s system 97% cpu 2:01.08 total
With 2 threads: 134.99s user 26.54s system 164% cpu 1:33.31 total
Changes since the initial commit:
- When handling odd-length inputs, call ThreadPool::wait() before merging the
last profile. Should fix a race/off-by-one (see r275937).
Differential Revision: https://reviews.llvm.org/D22438
llvm-svn: 275938
Diffstat (limited to 'llvm/test/tools/llvm-profdata/multiple-inputs.test')
-rw-r--r-- | llvm/test/tools/llvm-profdata/multiple-inputs.test | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-profdata/multiple-inputs.test b/llvm/test/tools/llvm-profdata/multiple-inputs.test index 40d11083c0c..399438a4d2d 100644 --- a/llvm/test/tools/llvm-profdata/multiple-inputs.test +++ b/llvm/test/tools/llvm-profdata/multiple-inputs.test @@ -51,3 +51,43 @@ DISJOINT-2: Block counts: [2, 3] DISJOINT: Total functions: 2 DISJOINT: Maximum function count: 1 DISJOINT: Maximum internal block count: 3 + +RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ +RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ +RUN: -num-threads 2 -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO4 +RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ +RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ +RUN: -j 3 -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO4 +FOO4: foo: +FOO4: Counters: 3 +FOO4: Function count: 4 +FOO4: Block counts: [8, 12] +FOO4: Total functions: 1 +FOO4: Maximum function count: 4 +FOO4: Maximum internal block count: 12 + +RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ +RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ +RUN: %p/Inputs/foo3-1.proftext -j 2 -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO5 +RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ +RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ +RUN: %p/Inputs/foo3-1.proftext -j 3 -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO5 +RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ +RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ +RUN: %p/Inputs/foo3-1.proftext -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO5 +RUN: llvm-profdata merge %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ +RUN: %p/Inputs/foo3-1.proftext %p/Inputs/foo3-1.proftext \ +RUN: %p/Inputs/foo3-1.proftext -j 1 -o %t +RUN: llvm-profdata show %t -all-functions -counts | FileCheck %s --check-prefix=FOO5 +FOO5: foo: +FOO5: Counters: 3 +FOO5: Function count: 5 +FOO5: Block counts: [10, 15] +FOO5: Total functions: 1 +FOO5: Maximum function count: 5 +FOO5: Maximum internal block count: 15 |