diff options
-rw-r--r-- | fbench/src/fbench/fbench.cpp | 43 | ||||
-rw-r--r-- | fbench/src/util/clientstatus.cpp | 6 |
2 files changed, 20 insertions, 29 deletions
diff --git a/fbench/src/fbench/fbench.cpp b/fbench/src/fbench/fbench.cpp index c2996eebb5c..365ae66eabd 100644 --- a/fbench/src/fbench/fbench.cpp +++ b/fbench/src/fbench/fbench.cpp @@ -227,13 +227,6 @@ FBench::PrintSummary() actualRate = (status._realTime > 0) ? realNumClients * 1000.0 * status._requestCnt / status._realTime : 0; - double p25 = status.GetPercentile(25); - double p50 = status.GetPercentile(50); - double p75 = status.GetPercentile(75); - double p90 = status.GetPercentile(90); - double p95 = status.GetPercentile(95); - double p99 = status.GetPercentile(99); - if (_keepAlive) { printf("*** HTTP keep-alive statistics ***\n"); printf("connection reuse count -- %" PRIu64 "\n", status._reuseCnt); @@ -250,24 +243,24 @@ FBench::PrintSummary() printf("minimum response time: %8.2f ms\n", status._minTime); printf("maximum response time: %8.2f ms\n", status._maxTime); printf("average response time: %8.2f ms\n", status.GetAverage()); - if (p25 > status._timetable.size() / status._timetableResolution - 1) - printf("25 percentile: %8.2f ms (approx)\n", p25); - else printf("25 percentile: %8.2f ms\n", p25); - if (p50 > status._timetable.size() / status._timetableResolution - 1) - printf("50 percentile: %8.2f ms (approx)\n", p50); - else printf("50 percentile: %8.2f ms\n", p50); - if (p75 > status._timetable.size() / status._timetableResolution - 1) - printf("75 percentile: %8.2f ms (approx)\n", p75); - else printf("75 percentile: %8.2f ms\n", p75); - if (p90 > status._timetable.size() / status._timetableResolution - 1) - printf("90 percentile: %8.2f ms (approx)\n", p90); - else printf("90 percentile: %8.2f ms\n", p90); - if (p95 > status._timetable.size() / status._timetableResolution - 1) - printf("95 percentile: %8.2f ms (approx)\n", p95); - else printf("95 percentile: %8.2f ms\n", p95); - if (p99 > status._timetable.size() / status._timetableResolution - 1) - printf("99 percentile: %8.2f ms (approx)\n", p99); - else printf("99 percentile: %8.2f ms\n", p99); + + for (double percentile : {25.0, 50.0, 75.0, 90.0, 98.0, 99.0, 99.5, 99.6, 99.7, 99.8, 99.9}) { + if (percentile <= 99.0) { + //Backwards compatible printing + if (percentile > (status._timetable.size() / status._timetableResolution - 1)) { + printf("%2d percentile: %8.2f ms (approx)\n", int(percentile), status.GetPercentile(percentile)); + } else { + printf("%2d percentile: %8.2f ms\n", int(percentile), status.GetPercentile(percentile)); + } + } else { + if (percentile > (status._timetable.size() / status._timetableResolution - 1)) { + printf("%2.1f percentile: %8.2f ms (approx)\n", percentile, status.GetPercentile(percentile)); + } else { + printf("%2.1f percentile: %8.2f ms\n", percentile, status.GetPercentile(percentile)); + } + } + } + printf("actual query rate: %8.2f Q/s\n", actualRate); printf("utilization: %8.2f %%\n", (maxRate > 0) ? 100 * (actualRate / maxRate) : 0); diff --git a/fbench/src/util/clientstatus.cpp b/fbench/src/util/clientstatus.cpp index 9e03068e13c..6ef188da201 100644 --- a/fbench/src/util/clientstatus.cpp +++ b/fbench/src/util/clientstatus.cpp @@ -1,6 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "clientstatus.h" -#include <string.h> +#include <cstring> #include <cmath> @@ -24,9 +24,7 @@ ClientStatus::ClientStatus() { } -ClientStatus::~ClientStatus() -{ -} +ClientStatus::~ClientStatus() = default; void ClientStatus::SetError(const char *errorMsg) |