Increase precision of cpb

When cpb is less than 24 or so print two decimal places
pull/548/head
Jeffrey Walton 2017-11-27 11:38:15 -05:00
parent a29b36c197
commit 45db15e51b
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 11 additions and 2 deletions

View File

@ -63,7 +63,13 @@ void OutputResultBytes(const char *name, double length, double timeTaken)
std::cout << std::setiosflags(std::ios::fixed); std::cout << std::setiosflags(std::ios::fixed);
std::cout << "<TD>" << std::setprecision(0) << std::setiosflags(std::ios::fixed) << mbs; std::cout << "<TD>" << std::setprecision(0) << std::setiosflags(std::ios::fixed) << mbs;
if (g_hertz > 1.0f) 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_logTotal += ::log(mbs);
g_logCount++; g_logCount++;
} }
@ -98,7 +104,10 @@ void OutputResultOperations(const char *name, const char *operation, bool pc, un
// Coverity finding // Coverity finding
if (g_hertz > 1.0f) 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_logTotal += ::log(iterations/timeTaken);
g_logCount++; g_logCount++;