Fix BLS/BLS_DKG benchs after 15788

This commit is contained in:
UdjinM6 2021-10-25 20:07:03 +03:00 committed by Kittywhiskers Van Gogh
parent 046fcc2060
commit 5ea0ae28a9
3 changed files with 11 additions and 17 deletions

View File

@ -18,9 +18,6 @@
static const char* DEFAULT_BENCH_FILTER = ".*";
void InitBLSTests();
void CleanupBLSTests();
static void SetupBenchArgs()
{
gArgs.AddArg("-?", "Print this help message and exit", false, OptionsCategory::OPTIONS);

View File

@ -9,18 +9,6 @@
#include <iostream>
CBLSWorker blsWorker;
void InitBLSTests()
{
blsWorker.Start();
}
void CleanupBLSTests()
{
blsWorker.Stop();
}
static void BuildTestVectors(size_t count, size_t invalidCount,
BLSPublicKeyVector& pubKeys, BLSSecretKeyVector& secKeys, BLSSignatureVector& sigs,
std::vector<uint256>& msgHashes,
@ -327,6 +315,9 @@ static void BLS_Verify_BatchedParallel(benchmark::Bench& bench)
return cancel;
};
CBLSWorker blsWorker;
blsWorker.Start();
// Benchmark.
size_t i = 0;
bench.minEpochIterations(1000).run([&] {
@ -358,6 +349,8 @@ static void BLS_Verify_BatchedParallel(benchmark::Bench& bench)
{
UninterruptibleSleep(std::chrono::milliseconds{100});
}
blsWorker.Stop();
}
BENCHMARK(BLS_PubKeyAggregate_Normal)

View File

@ -6,8 +6,6 @@
#include <random.h>
#include <bls/bls_worker.h>
extern CBLSWorker blsWorker;
struct Member {
CBLSId id;
@ -24,6 +22,7 @@ private:
BLSSecretKeyVector receivedSkShares;
BLSVerificationVectorPtr quorumVvec;
CBLSWorker blsWorker;
void ReceiveVvecs()
{
@ -67,10 +66,15 @@ public:
ids.emplace_back(id);
}
blsWorker.Start();
for (int i = 0; i < quorumSize; i++) {
blsWorker.GenerateContributions(quorumSize / 2 + 1, ids, members[i].vvec, members[i].skShares);
}
}
~DKG()
{
blsWorker.Stop();
}
void Bench_BuildQuorumVerificationVectors(benchmark::Bench& bench, uint32_t epoch_iters)
{