From f4aa9d3a9e01be44ba7f5104a3c19f101c148dd6 Mon Sep 17 00:00:00 2001 From: Jolene Tan Date: Fri, 6 Oct 2023 13:15:39 -0700 Subject: [PATCH] Count generateKeyPair in benchmark time in serverSharedSecretDerivationBench Summary: In `serverSharedSecretDerivationBench`, move generateKeyPair out of `BENCHMARK_SUSPEND` block so that it is also counted in the server operation time. Reviewed By: AjanthanAsogamoorthy Differential Revision: D49969436 fbshipit-source-id: a6b5dbf6416cb9caf18ce172afe4e6fbad296d0a --- fizz/experimental/protocol/test/HybridKeyExchangeBench.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fizz/experimental/protocol/test/HybridKeyExchangeBench.cpp b/fizz/experimental/protocol/test/HybridKeyExchangeBench.cpp index 0e72a7500f6..5d73bb9e5b1 100644 --- a/fizz/experimental/protocol/test/HybridKeyExchangeBench.cpp +++ b/fizz/experimental/protocol/test/HybridKeyExchangeBench.cpp @@ -42,7 +42,6 @@ void serverSharedSecretDerivationBench(uint64_t n, NamedGroup namedGroup) { BENCHMARK_SUSPEND { auto f = std::make_unique(); kex = f->makeKeyExchange(namedGroup, Factory::KeyExchangeMode::Server); - kex->generateKeyPair(); for (uint64_t i = 0; i < n; i++) { auto fakeClientKex = f->makeKeyExchange(namedGroup, Factory::KeyExchangeMode::Client); @@ -53,6 +52,7 @@ void serverSharedSecretDerivationBench(uint64_t n, NamedGroup namedGroup) { }; std::unique_ptr keyShare; for (uint64_t i = 0; i < n; i++) { + kex->generateKeyPair(); keyShare = kex->generateSharedSecret(clientKeyShare[i]); } folly::doNotOptimizeAway(keyShare);