summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2016-03-03 21:24:13 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2016-03-03 21:24:13 +0000
commitc1a7c97c1b5f62f918faee0ccf190c53ad519de1 (patch)
treefdb1a7c20093e9e87976cdcade668d08d01e0e44 /openmp/runtime/src
parent3b514554a2ab643813c91f161d69c5a5c305efcf (diff)
downloadbcm5719-llvm-c1a7c97c1b5f62f918faee0ccf190c53ad519de1.tar.gz
bcm5719-llvm-c1a7c97c1b5f62f918faee0ccf190c53ad519de1.zip
[STATS] fix output formatting when sample count is 0
Force 0.0 to be displayed for all statistics which have sample count equal to 0 llvm-svn: 262658
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r--openmp/runtime/src/kmp_stats.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/openmp/runtime/src/kmp_stats.cpp b/openmp/runtime/src/kmp_stats.cpp
index d1f43afe4ae..b249e2e635c 100644
--- a/openmp/runtime/src/kmp_stats.cpp
+++ b/openmp/runtime/src/kmp_stats.cpp
@@ -129,14 +129,25 @@ void statistic::scale(double factor)
std::string statistic::format(char unit, bool total) const
{
std::string result = formatSI(sampleCount,9,' ');
-
- result = result + std::string(", ") + formatSI(minVal, 9, unit);
- result = result + std::string(", ") + formatSI(meanVal, 9, unit);
- result = result + std::string(", ") + formatSI(maxVal, 9, unit);
- if (total)
- result = result + std::string(", ") + formatSI(meanVal*sampleCount, 9, unit);
- result = result + std::string(", ") + formatSI(getSD(), 9, unit);
-
+
+ if (sampleCount == 0)
+ {
+ result = result + std::string(", ") + formatSI(0.0, 9, unit);
+ result = result + std::string(", ") + formatSI(0.0, 9, unit);
+ result = result + std::string(", ") + formatSI(0.0, 9, unit);
+ if (total)
+ result = result + std::string(", ") + formatSI(0.0, 9, unit);
+ result = result + std::string(", ") + formatSI(0.0, 9, unit);
+ }
+ else
+ {
+ result = result + std::string(", ") + formatSI(minVal, 9, unit);
+ result = result + std::string(", ") + formatSI(meanVal, 9, unit);
+ result = result + std::string(", ") + formatSI(maxVal, 9, unit);
+ if (total)
+ result = result + std::string(", ") + formatSI(meanVal*sampleCount, 9, unit);
+ result = result + std::string(", ") + formatSI(getSD(), 9, unit);
+ }
return result;
}
OpenPOWER on IntegriCloud