summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cov/CoverageSummaryInfo.h
diff options
context:
space:
mode:
authorMax Moroz <mmoroz@chromium.org>2018-01-05 16:15:07 +0000
committerMax Moroz <mmoroz@chromium.org>2018-01-05 16:15:07 +0000
commitcc254ba4a7ed7287bf2fcdd2b482089240c4cd2b (patch)
tree2a9f2653f20efae3b733fd40208e3c9a833f7cef /llvm/tools/llvm-cov/CoverageSummaryInfo.h
parente565ebcdad01888233d61514d8c98c2ff894e37e (diff)
downloadbcm5719-llvm-cc254ba4a7ed7287bf2fcdd2b482089240c4cd2b.tar.gz
bcm5719-llvm-cc254ba4a7ed7287bf2fcdd2b482089240c4cd2b.zip
[llvm-cov] Multi-threaded implementation of prepareFileReports method.
Summary: Local testing has demonstrated a great speed improvement, compare the following: 1) Existing version: ``` $ time llvm-cov show -format=html -output-dir=report -instr-profile=... ... The tool has been launched: 00:00:00 Loading coverage data: 00:00:00 Get unique source files: 00:00:33 Creating an index out of the source files: 00:00:34 Going into prepareFileReports: 00:00:34 Going to emit summary information for each file: 00:28:55 <-- 28:21 min! Going to emit links to files with no function: 00:28:55 Launching 32 threads for generating HTML files: 00:28:55 real 37m43.651s user 112m5.540s sys 7m39.872s ``` 2) Multi-threaded version with 32 CPUs: ``` $ time llvm-cov show -format=html -output-dir=report -instr-profile=... ... The tool has been launched: 00:00:00 Loading coverage data: 00:00:00 Get unique source files: 00:00:38 Creating an index out of the source files: 00:00:40 Going into prepareFileReports: 00:00:40 Preparing file reports using 32 threads: 00:00:40 # Creating thread tasks for the following number of files: 16422 Going to emit summary information for each file: 00:01:57 <-- 1:17 min! Going to emit links to files with no function: 00:01:58 Launching 32 threads for generating HTML files: 00:01:58 real 11m2.044s user 134m48.124s sys 7m53.388s ``` Reviewers: vsk, morehouse Reviewed By: vsk Subscribers: Dor1s, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D41206 llvm-svn: 321871
Diffstat (limited to 'llvm/tools/llvm-cov/CoverageSummaryInfo.h')
-rw-r--r--llvm/tools/llvm-cov/CoverageSummaryInfo.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/tools/llvm-cov/CoverageSummaryInfo.h b/llvm/tools/llvm-cov/CoverageSummaryInfo.h
index 8eae0b7fec9..1235350b91b 100644
--- a/llvm/tools/llvm-cov/CoverageSummaryInfo.h
+++ b/llvm/tools/llvm-cov/CoverageSummaryInfo.h
@@ -116,6 +116,12 @@ public:
FunctionCoverageInfo(size_t Executed, size_t NumFunctions)
: Executed(Executed), NumFunctions(NumFunctions) {}
+ FunctionCoverageInfo &operator+=(const FunctionCoverageInfo &RHS) {
+ Executed += RHS.Executed;
+ NumFunctions += RHS.NumFunctions;
+ return *this;
+ }
+
void addFunction(bool Covered) {
if (Covered)
++Executed;
@@ -176,6 +182,14 @@ struct FileCoverageSummary {
: Name(Name), RegionCoverage(), LineCoverage(), FunctionCoverage(),
InstantiationCoverage() {}
+ FileCoverageSummary &operator+=(const FileCoverageSummary &RHS) {
+ RegionCoverage += RHS.RegionCoverage;
+ LineCoverage += RHS.LineCoverage;
+ FunctionCoverage += RHS.FunctionCoverage;
+ InstantiationCoverage += RHS.InstantiationCoverage;
+ return *this;
+ }
+
void addFunction(const FunctionCoverageSummary &Function) {
RegionCoverage += Function.RegionCoverage;
LineCoverage += Function.LineCoverage;
OpenPOWER on IntegriCloud