summaryrefslogtreecommitdiff
path: root/bench1.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-11-27 11:38:15 -0500
committerJeffrey Walton <noloader@gmail.com>2017-11-27 11:38:15 -0500
commit45db15e51be05f000d52e52b03a24ced1e1496ac (patch)
tree7bb83ee08496551883d2bf4fcf9acb0939737af7 /bench1.cpp
parenta29b36c19745e2b47cd9ad82d384cb37db21354c (diff)
downloadcryptopp-git-45db15e51be05f000d52e52b03a24ced1e1496ac.tar.gz
Increase precision of cpb
When cpb is less than 24 or so print two decimal places
Diffstat (limited to 'bench1.cpp')
-rw-r--r--bench1.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/bench1.cpp b/bench1.cpp
index 510cd81c..b4f7263d 100644
--- a/bench1.cpp
+++ b/bench1.cpp
@@ -63,7 +63,13 @@ void OutputResultBytes(const char *name, double length, double timeTaken)
std::cout << std::setiosflags(std::ios::fixed);
std::cout << "<TD>" << std::setprecision(0) << std::setiosflags(std::ios::fixed) << mbs;
if (g_hertz > 1.0f)
- std::cout << "<TD>" << std::setprecision(1) << std::setiosflags(std::ios::fixed) << timeTaken * g_hertz / length;
+ {
+ const double cpb = timeTaken * g_hertz / length;
+ if (cpb < 24.0f)
+ std::cout << "<TD>" << std::setprecision(2) << std::setiosflags(std::ios::fixed) << cpb;
+ else
+ std::cout << "<TD>" << std::setprecision(1) << std::setiosflags(std::ios::fixed) << cpb;
+ }
g_logTotal += ::log(mbs);
g_logCount++;
}
@@ -98,7 +104,10 @@ void OutputResultOperations(const char *name, const char *operation, bool pc, un
// Coverity finding
if (g_hertz > 1.0f)
- std::cout << "<TD>" << std::setprecision(2) << std::setiosflags(std::ios::fixed) << timeTaken * g_hertz / iterations / 1000000;
+ {
+ const double t = timeTaken * g_hertz / iterations / 1000000;
+ std::cout << "<TD>" << std::setprecision(2) << std::setiosflags(std::ios::fixed) << t;
+ }
g_logTotal += ::log(iterations/timeTaken);
g_logCount++;