Skip to content
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

Fix a bug in benchmark code. #2989

Merged
merged 3 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmark/benchresult/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func compareTwoMap(m1, m2 map[string]stats.BenchResults) {
changes += intChange("TotalOps", v1.Data.TotalOps, v2.Data.TotalOps)
changes += intChange("SendOps", v1.Data.SendOps, v2.Data.SendOps)
changes += intChange("RecvOps", v1.Data.RecvOps, v2.Data.RecvOps)
changes += intChange("Bytes/op", v1.Data.AllocedBytes, v2.Data.AllocedBytes)
changes += intChange("Allocs/op", v1.Data.Allocs, v2.Data.Allocs)
changes += floatChange("Bytes/op", v1.Data.AllocedBytes, v2.Data.AllocedBytes)
changes += floatChange("Allocs/op", v1.Data.Allocs, v2.Data.Allocs)
changes += floatChange("ReqT/op", v1.Data.ReqT, v2.Data.ReqT)
changes += floatChange("RespT/op", v1.Data.RespT, v2.Data.RespT)
changes += timeChange("50th-Lat", v1.Data.Fiftieth, v2.Data.Fiftieth)
Expand Down
12 changes: 6 additions & 6 deletions benchmark/stats/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ type RunData struct {
// run. Only makes sense for unconstrained workloads.
RecvOps uint64
// AllocedBytes is the average memory allocation in bytes per operation.
AllocedBytes uint64
AllocedBytes float64
// Allocs is the average number of memory allocations per operation.
Allocs uint64
Allocs float64
// ReqT is the average request throughput associated with this run.
ReqT float64
// RespT is the average response throughput associated with this run.
Expand Down Expand Up @@ -275,8 +275,8 @@ func (s *Stats) EndRun(count uint64) {
r := &s.results[len(s.results)-1]
r.Data = RunData{
TotalOps: count,
AllocedBytes: s.stopMS.TotalAlloc - s.startMS.TotalAlloc,
Allocs: s.stopMS.Mallocs - s.startMS.Mallocs,
AllocedBytes: float64(s.stopMS.TotalAlloc-s.startMS.TotalAlloc) / float64(count),
Allocs: float64(s.stopMS.Mallocs-s.startMS.Mallocs) / float64(count),
ReqT: float64(count) * float64(r.Features.ReqSizeBytes) * 8 / r.Features.BenchTime.Seconds(),
RespT: float64(count) * float64(r.Features.RespSizeBytes) * 8 / r.Features.BenchTime.Seconds(),
}
Expand All @@ -296,8 +296,8 @@ func (s *Stats) EndUnconstrainedRun(req uint64, resp uint64) {
r.Data = RunData{
SendOps: req,
RecvOps: resp,
AllocedBytes: (s.stopMS.TotalAlloc - s.startMS.TotalAlloc) / ((req + resp) / 2),
Allocs: (s.stopMS.Mallocs - s.startMS.Mallocs) / ((req + resp) / 2),
AllocedBytes: float64(s.stopMS.TotalAlloc-s.startMS.TotalAlloc) / float64((req+resp)/2),
Allocs: float64(s.stopMS.Mallocs-s.startMS.Mallocs) / float64((req+resp)/2),
ReqT: float64(req) * float64(r.Features.ReqSizeBytes) * 8 / r.Features.BenchTime.Seconds(),
RespT: float64(resp) * float64(r.Features.RespSizeBytes) * 8 / r.Features.BenchTime.Seconds(),
}
Expand Down