Skip to content

Commit f779a75

Browse files
committed
Merge bitcoin#26158: bench: add "priority level" to the benchmark framework
Backports bitcoin#26158
1 parent 9cf919c commit f779a75

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+249
-250
lines changed

src/Makefile.test.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ if TARGET_WINDOWS
417417
else
418418
if ENABLE_BENCH
419419
@echo "Running bench/bench_dash (one iteration sanity check, only high priority)..."
420-
$(BENCH_BINARY) -sanity-check -priority-level=high
420+
$(BENCH_BINARY) -sanity-check -priority-level=high > /dev/null
421421
endif
422422
endif
423423
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check

src/bench/addrman.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ static void AddrManAddThenGood(benchmark::Bench& bench)
167167
});
168168
}
169169

170-
BENCHMARK(AddrManAdd);
171-
BENCHMARK(AddrManSelect);
172-
BENCHMARK(AddrManSelectFromAlmostEmpty);
173-
BENCHMARK(AddrManSelectByNetwork);
174-
BENCHMARK(AddrManGetAddr);
175-
BENCHMARK(AddrManAddThenGood);
170+
BENCHMARK(AddrManAdd, benchmark::PriorityLevel::HIGH);
171+
BENCHMARK(AddrManSelect, benchmark::PriorityLevel::HIGH);
172+
BENCHMARK(AddrManSelectFromAlmostEmpty, benchmark::PriorityLevel::HIGH);
173+
BENCHMARK(AddrManSelectByNetwork, benchmark::PriorityLevel::HIGH);
174+
BENCHMARK(AddrManGetAddr, benchmark::PriorityLevel::HIGH);
175+
BENCHMARK(AddrManAddThenGood, benchmark::PriorityLevel::HIGH);

src/bench/base58.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ static void Base58Decode(benchmark::Bench& bench)
5050
}
5151

5252

53-
BENCHMARK(Base58Encode);
54-
BENCHMARK(Base58CheckEncode);
55-
BENCHMARK(Base58Decode);
53+
BENCHMARK(Base58Encode, benchmark::PriorityLevel::HIGH);
54+
BENCHMARK(Base58CheckEncode, benchmark::PriorityLevel::HIGH);
55+
BENCHMARK(Base58Decode, benchmark::PriorityLevel::HIGH);

src/bench/bech32.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ static void Bech32Decode(benchmark::Bench& bench)
3232
}
3333

3434

35-
BENCHMARK(Bech32Encode);
36-
BENCHMARK(Bech32Decode);
35+
BENCHMARK(Bech32Encode, benchmark::PriorityLevel::HIGH);
36+
BENCHMARK(Bech32Decode, benchmark::PriorityLevel::HIGH);

src/bench/bench.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ class BenchRunner
7575
};
7676
} // namespace benchmark
7777

78-
// BENCHMARK(foo) expands to: benchmark::BenchRunner bench_11foo("foo", foo, priority_level);
79-
#define BENCHMARK(n) \
80-
benchmark::BenchRunner PASTE2(bench_, PASTE2(__LINE__, n))(STRINGIZE(n), n, benchmark::PriorityLevel::HIGH);
78+
// BENCHMARK(foo, priority_level) expands to: benchmark::BenchRunner bench_11foo("foo", foo, priority_level);
79+
#define BENCHMARK(n, priority_level) \
80+
benchmark::BenchRunner PASTE2(bench_, PASTE2(__LINE__, n))(STRINGIZE(n), n, priority_level);
8181

8282
#endif // BITCOIN_BENCH_BENCH_H

src/bench/bench_bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static void SetupBenchArgs(ArgsManager& argsman)
3333
argsman.AddArg("-min-time=<milliseconds>", strprintf("Minimum runtime per benchmark, in milliseconds (default: %d)", DEFAULT_MIN_TIME_MS), ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION, OptionsCategory::OPTIONS);
3434
argsman.AddArg("-output-csv=<output.csv>", "Generate CSV file with the most important benchmark results", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
3535
argsman.AddArg("-output-json=<output.json>", "Generate JSON file with all benchmark results", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
36-
argsman.AddArg("-sanity-check", "Run benchmarks for only one iteration with no output", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
36+
argsman.AddArg("-sanity-check", "Run benchmarks for only one iteration", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
3737
argsman.AddArg("-priority-level=<l1,l2,l3>", strprintf("Run benchmarks of one or multiple priority level(s) (%s), default: '%s'",
3838
benchmark::ListPriorities(), DEFAULT_PRIORITY), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
3939
}

src/bench/bip324_ecdh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ static void BIP324_ECDH(benchmark::Bench& bench)
4848
ECC_Stop();
4949
}
5050

51-
BENCHMARK(BIP324_ECDH);
51+
BENCHMARK(BIP324_ECDH, benchmark::PriorityLevel::HIGH);

src/bench/block_assemble.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ static void AssembleBlock(benchmark::Bench& bench)
5252
});
5353
}
5454

55-
BENCHMARK(AssembleBlock);
55+
BENCHMARK(AssembleBlock, benchmark::PriorityLevel::HIGH);

src/bench/bls.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -358,17 +358,17 @@ static void BLS_Verify_BatchedParallel(benchmark::Bench& bench)
358358
blsWorker.Stop();
359359
}
360360

361-
BENCHMARK(BLS_PubKeyAggregate_Normal)
362-
BENCHMARK(BLS_SecKeyAggregate_Normal)
363-
BENCHMARK(BLS_SignatureAggregate_Normal)
364-
BENCHMARK(BLS_Sign_Normal)
365-
BENCHMARK(BLS_Verify_Normal)
366-
BENCHMARK(BLS_Verify_LargeBlock100)
367-
BENCHMARK(BLS_Verify_LargeBlock1000)
368-
BENCHMARK(BLS_Verify_LargeBlockSelfAggregated100)
369-
BENCHMARK(BLS_Verify_LargeBlockSelfAggregated1000)
370-
BENCHMARK(BLS_Verify_LargeAggregatedBlock100)
371-
BENCHMARK(BLS_Verify_LargeAggregatedBlock1000)
372-
BENCHMARK(BLS_Verify_LargeAggregatedBlock1000PreVerified)
373-
BENCHMARK(BLS_Verify_Batched)
374-
BENCHMARK(BLS_Verify_BatchedParallel)
361+
BENCHMARK(BLS_PubKeyAggregate_Normal, benchmark::PriorityLevel::HIGH);
362+
BENCHMARK(BLS_SecKeyAggregate_Normal, benchmark::PriorityLevel::HIGH);
363+
BENCHMARK(BLS_SignatureAggregate_Normal, benchmark::PriorityLevel::HIGH);
364+
BENCHMARK(BLS_Sign_Normal, benchmark::PriorityLevel::HIGH);
365+
BENCHMARK(BLS_Verify_Normal, benchmark::PriorityLevel::HIGH);
366+
BENCHMARK(BLS_Verify_LargeBlock100, benchmark::PriorityLevel::HIGH);
367+
BENCHMARK(BLS_Verify_LargeBlock1000, benchmark::PriorityLevel::HIGH);
368+
BENCHMARK(BLS_Verify_LargeBlockSelfAggregated100, benchmark::PriorityLevel::HIGH);
369+
BENCHMARK(BLS_Verify_LargeBlockSelfAggregated1000, benchmark::PriorityLevel::HIGH);
370+
BENCHMARK(BLS_Verify_LargeAggregatedBlock100, benchmark::PriorityLevel::HIGH);
371+
BENCHMARK(BLS_Verify_LargeAggregatedBlock1000, benchmark::PriorityLevel::HIGH);
372+
BENCHMARK(BLS_Verify_LargeAggregatedBlock1000PreVerified, benchmark::PriorityLevel::HIGH);
373+
BENCHMARK(BLS_Verify_Batched, benchmark::PriorityLevel::HIGH);
374+
BENCHMARK(BLS_Verify_BatchedParallel, benchmark::PriorityLevel::HIGH);

src/bench/bls_dkg.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static void BLSDKG_GenerateContributions(benchmark::Bench& bench, uint32_t epoch
136136
{ \
137137
BLSDKG_GenerateContributions(bench, epoch_iters, quorumSize); \
138138
} \
139-
BENCHMARK(BLSDKG_GenerateContributions_##name##_##quorumSize)
139+
BENCHMARK(BLSDKG_GenerateContributions_##name##_##quorumSize, benchmark::PriorityLevel::HIGH)
140140

141141
static void BLSDKG_InitDKG(benchmark::Bench& bench, uint32_t epoch_iters, int quorumSize)
142142
{
@@ -154,7 +154,7 @@ static void BLSDKG_InitDKG(benchmark::Bench& bench, uint32_t epoch_iters, int qu
154154
{ \
155155
BLSDKG_InitDKG(bench, epoch_iters, quorumSize); \
156156
} \
157-
BENCHMARK(BLSDKG_InitDKG_##name##_##quorumSize)
157+
BENCHMARK(BLSDKG_InitDKG_##name##_##quorumSize, benchmark::PriorityLevel::HIGH)
158158

159159
#define BENCH_BuildQuorumVerificationVectors(name, quorumSize, epoch_iters) \
160160
static void BLSDKG_BuildQuorumVerificationVectors_##name##_##quorumSize(benchmark::Bench& bench) \
@@ -169,7 +169,7 @@ static void BLSDKG_InitDKG(benchmark::Bench& bench, uint32_t epoch_iters, int qu
169169
ptr->Bench_BuildQuorumVerificationVectors(bench, epoch_iters); \
170170
ptr.reset(); \
171171
} \
172-
BENCHMARK(BLSDKG_BuildQuorumVerificationVectors_##name##_##quorumSize)
172+
BENCHMARK(BLSDKG_BuildQuorumVerificationVectors_##name##_##quorumSize, benchmark::PriorityLevel::HIGH)
173173

174174
#define BENCH_VerifyContributionShares(name, quorumSize, invalidCount, aggregated, epoch_iters) \
175175
static void BLSDKG_VerifyContributionShares_##name##_##quorumSize(benchmark::Bench& bench) \
@@ -184,7 +184,7 @@ static void BLSDKG_InitDKG(benchmark::Bench& bench, uint32_t epoch_iters, int qu
184184
ptr->Bench_VerifyContributionShares(bench, invalidCount, aggregated, epoch_iters); \
185185
ptr.reset(); \
186186
} \
187-
BENCHMARK(BLSDKG_VerifyContributionShares_##name##_##quorumSize)
187+
BENCHMARK(BLSDKG_VerifyContributionShares_##name##_##quorumSize, benchmark::PriorityLevel::HIGH)
188188

189189
BENCH_GenerateContributions(simple, 50, 50);
190190
BENCH_GenerateContributions(simple, 100, 5);

0 commit comments

Comments
 (0)