diff options
Diffstat (limited to 'src/benchmark/benchmark.cpp')
-rw-r--r-- | src/benchmark/benchmark.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/benchmark/benchmark.cpp b/src/benchmark/benchmark.cpp index 5c812d732..af3ef656c 100644 --- a/src/benchmark/benchmark.cpp +++ b/src/benchmark/benchmark.cpp @@ -33,13 +33,13 @@ std::pair<u64bit, u64bit> bench_buf_comp(BufferedComputation* buf_comp, std::chrono::nanoseconds max_time(nanoseconds_max); std::chrono::nanoseconds time_used(0); - auto start = benchmark_clock::now(); - while(time_used < max_time) { + auto start = benchmark_clock::now(); buf_comp->update(buf, buf_len); + time_used += benchmark_clock::now() - start; + ++reps; - time_used = benchmark_clock::now() - start; } u64bit ns_taken = @@ -63,15 +63,15 @@ bench_block_cipher(BlockCipher* block_cipher, std::chrono::nanoseconds max_time(nanoseconds_max); std::chrono::nanoseconds time_used(0); - auto start = benchmark_clock::now(); - block_cipher->set_key(buf, block_cipher->MAXIMUM_KEYLENGTH); while(time_used < max_time) { + auto start = benchmark_clock::now(); block_cipher->encrypt_n(buf, buf, in_blocks); + time_used += benchmark_clock::now() - start; + ++reps; - time_used = benchmark_clock::now() - start; } u64bit ns_taken = @@ -96,13 +96,13 @@ bench_stream_cipher(StreamCipher* stream_cipher, std::chrono::nanoseconds max_time(nanoseconds_max); std::chrono::nanoseconds time_used(0); - auto start = benchmark_clock::now(); - while(time_used < max_time) { + auto start = benchmark_clock::now(); stream_cipher->cipher1(buf, buf_len); + time_used += benchmark_clock::now() - start; + ++reps; - time_used = benchmark_clock::now() - start; } u64bit ns_taken = |