aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
author0xdefaced <[email protected]>2017-06-26 17:10:55 +0200
committer0xdefaced <[email protected]>2017-06-26 17:10:55 +0200
commita3597cfb2a08c1e4f2b1caae5d065bad931f4563 (patch)
treecf680d6c7329ff42efaf49891b03ec10591361c6 /src
parenta51239a3992b3155bab30e4263e5eb7f8027d8df (diff)
use buffer sizes only once in performance tests
Remove duplicates from given buffer sizes in performance tests. Additionally, sort buffer sizes for better grouping in logs and add a colon before printing the measurements.
Diffstat (limited to 'src')
-rw-r--r--src/cli/speed.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/cli/speed.cpp b/src/cli/speed.cpp
index 397f0bde5..62edf0b75 100644
--- a/src/cli/speed.cpp
+++ b/src/cli/speed.cpp
@@ -320,7 +320,7 @@ std::string Timer::result_string_bps(const Timer& timer)
if(timer.buf_size() > 0)
{
- oss << " buffer size " << timer.buf_size();
+ oss << " buffer size " << timer.buf_size() << " bytes:";
}
oss << " " << std::fixed << std::setprecision(3) << MiB_per_sec << " MiB/sec";
@@ -648,7 +648,19 @@ class Speed final : public Command
{
try
{
- buf_sizes.push_back(static_cast<size_t>(std::stoul(size_str)));
+ auto new_buf_size = static_cast<size_t>(std::stoul(size_str));
+
+ auto it = std::find_if(buf_sizes.begin(), buf_sizes.end(),
+ [new_buf_size](size_t buf_size)
+ {
+ return buf_size == new_buf_size;
+ }
+ );
+
+ if(it == buf_sizes.end())
+ {
+ buf_sizes.insert(buf_sizes.end(), new_buf_size);
+ }
}
catch(std::exception&)
{
@@ -656,6 +668,8 @@ class Speed final : public Command
}
}
+ std::sort(buf_sizes.begin(), buf_sizes.end());
+
Botan::CPUID::initialize();
for(std::string cpuid_to_clear : Botan::split_on(get_arg("clear-cpuid"), ','))