diff options
author | Vedant Kumar <vsk@apple.com> | 2016-07-18 22:02:39 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2016-07-18 22:02:39 +0000 |
commit | 0bd990758184c47d006f0f4dbc0ab9ac74c39100 (patch) | |
tree | 7a2d132f5441ea0af839cfd721b80705995fd5da /llvm/test/tools/llvm-profdata/multiple-inputs.test | |
parent | 9f97dcb01869090f9dcafab2924e471a30fc80af (diff) | |
download | bcm5719-llvm-0bd990758184c47d006f0f4dbc0ab9ac74c39100.tar.gz bcm5719-llvm-0bd990758184c47d006f0f4dbc0ab9ac74c39100.zip |
[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
Differential Revision: https://reviews.llvm.org/D22438
llvm-svn: 275921
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 |