-
Notifications
You must be signed in to change notification settings - Fork 17
[bench] Replace AWK tx/s script with b.ReportMetric #515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -208,33 +208,33 @@ kill-test-docker: FORCE | |||||
| # Benchmarks | ||||||
| ######################### | ||||||
|
|
||||||
| # Run a load generation benchmarks with added TX/sec column. | ||||||
| # Run load generation benchmarks. | ||||||
| bench-loadgen: FORCE | ||||||
| $(go_cmd) test ./loadgen/... -bench "Benchmark.*" -run="^$$" | awk -f scripts/bench-tx-per-sec.awk | ||||||
| $(go_cmd) test ./loadgen/... -bench "Benchmark.*" -run="^$$" | ||||||
|
|
||||||
| # Run dependency detector benchmarks with added op/sec column. | ||||||
| # Run dependency detector benchmarks. | ||||||
| bench-dep: FORCE | ||||||
| $(go_cmd) test ./service/coordinator/dependencygraph/... -timeout 60m -bench "BenchmarkDependencyGraph.*" -run="^$$" | awk -f scripts/bench-tx-per-sec.awk | ||||||
| $(go_cmd) test ./service/coordinator/dependencygraph/... -timeout 60m -bench "BenchmarkDependencyGraph.*" -run="^$$" | ||||||
|
|
||||||
| # Run dependency detector benchmarks with added op/sec column. | ||||||
| # Run preparer benchmarks. | ||||||
| bench-preparer: FORCE | ||||||
| $(go_cmd) test ./service/vc/... -bench "BenchmarkPrepare.*" -run "^$$" | awk -f scripts/bench-tx-per-sec.awk | ||||||
| $(go_cmd) test ./service/vc/... -bench "BenchmarkPrepare.*" -run "^$$" | ||||||
|
|
||||||
| # Run signature benchmarks with added op/sec column. | ||||||
| # Run signature benchmarks. | ||||||
| bench-sign: FORCE | ||||||
| $(go_cmd) test ./utils/signature/... -bench ".*" -run "^$$" | awk -f scripts/bench-tx-per-sec.awk | ||||||
| $(go_cmd) test ./utils/signature/... -bench ".*" -run "^$$" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a: testsig should also call
Suggested change
|
||||||
|
|
||||||
| # Run sidecar benchmarks with added op/sec column. | ||||||
| # Run sidecar benchmarks. | ||||||
| bench-sidecar: FORCE | ||||||
| $(go_cmd) test ./service/sidecar/... -bench "Benchmark.*" -run "^$$" | awk -f scripts/bench-tx-per-sec.awk | ||||||
| $(go_cmd) test ./service/sidecar/... -bench "Benchmark.*" -run "^$$" | ||||||
|
|
||||||
| # Run serialization benchmarks. | ||||||
| bench-serialization: FORCE | ||||||
| $(go_cmd) test ./utils/serialization/... -bench "Benchmark.*" -run "^$$" | ||||||
|
|
||||||
| # Run deliver benchmarks with added op/sec column. | ||||||
| # Run deliver benchmarks. | ||||||
| bench-deliver: FORCE | ||||||
| $(go_cmd) test ./utils/deliverorderer/... -bench "Benchmark.*" -run "^$$" | awk -f scripts/bench-tx-per-sec.awk | ||||||
| $(go_cmd) test ./utils/deliverorderer/... -bench "Benchmark.*" -run "^$$" | ||||||
|
|
||||||
| ######################### | ||||||
| # Code Generation | ||||||
|
|
||||||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,7 +90,7 @@ func BenchmarkDependencyGraph(b *testing.B) { | |
| PrometheusMetricsProvider: monitoring.NewProvider(), | ||
| }) | ||
|
|
||
| txPoll := workload.GenerateTransactions(b, p, max(b.N*3, batchSize*3)) | ||
| txPoll := workload.GenerateTransactions(b, p, max(b.N, batchSize)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This benchmark is designed such that the dependency graph internal queue will not be empty during the benchmark. |
||
|
|
||
| ctx := b.Context() | ||
| outCtx := channel.NewReader(ctx, out) | ||
|
|
@@ -120,10 +120,12 @@ func BenchmarkDependencyGraph(b *testing.B) { | |
| // Generates the load to the manager's queue. | ||
| go func() { | ||
| var i uint64 | ||
| for ctx.Err() == nil && len(txPoll) > 0 { | ||
| take := min(batchSize, len(txPoll)) | ||
| remaining := b.N | ||
| for ctx.Err() == nil && remaining > 0 { | ||
| take := min(batchSize, len(txPoll), remaining) | ||
| batch := workload.MapToCoordinatorBatch(i, txPoll[:take]) | ||
| txPoll = txPoll[take:] | ||
| remaining -= take | ||
| inCtx.Write(&TransactionBatch{ | ||
| ID: i, | ||
| Txs: batch.Txs, | ||
|
|
@@ -145,6 +147,7 @@ func BenchmarkDependencyGraph(b *testing.B) { | |
| total += len(batch) | ||
| } | ||
| b.StopTimer() | ||
| test.ReportTxPerSecond(b) | ||
| }) | ||
| } | ||
| }) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /* | ||
| Copyright IBM Corp. All Rights Reserved. | ||
|
|
||
| SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package test | ||
|
|
||
| import "testing" | ||
|
|
||
| // ReportTxPerSecond reports a tx/s custom metric on the benchmark. | ||
| func ReportTxPerSecond(b *testing.B) { | ||
| b.Helper() | ||
| b.ReportMetric(float64(b.N)/b.Elapsed().Seconds(), "tx/s") | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated