Skip to content

Commit

Permalink
feat: add a metric on bench
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag authored and flemzord committed May 12, 2023
1 parent 89e2fd9 commit b05d9d2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions benchmarks/ledger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func BenchmarkParallelWrites(b *testing.B) {
totalDuration := atomic.Int64{}
b.SetParallelism(1000)
b.ResetTimer()
startOfBench := time.Now()
b.RunParallel(func(pb *testing.PB) {
buf := bytes.NewBufferString("")
for pb.Next() {
Expand Down Expand Up @@ -74,4 +75,5 @@ func BenchmarkParallelWrites(b *testing.B) {
})
b.StopTimer()
b.ReportMetric(float64(totalDuration.Load()/int64(b.N)), "ms/transaction")
b.ReportMetric((float64(time.Duration(b.N))/float64(time.Since(startOfBench)))*float64(time.Second), "t/s")
}

0 comments on commit b05d9d2

Please sign in to comment.