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

tpcc: calculate tpmTotal and show it in summary #143

Merged
merged 1 commit into from
Sep 27, 2022
Merged
Changes from all commits
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
25 changes: 19 additions & 6 deletions tpcc/workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,25 +408,38 @@ func (w *Workloader) OutputStats(ifSummaryReport bool) {
w.waitTimeMeasurement.Output(ifSummaryReport, w.cfg.OutputStyle, outputWaitTimesMeasurement)
}
if ifSummaryReport {
hist, e := w.rtMeasurement.OpSumMeasurement["new_order"]
if e && !hist.Empty() {
result := hist.GetInfo()
var (
newOrderHist *measurement.Histogram
totalOps float64
)
for name, hist := range w.rtMeasurement.OpSumMeasurement {
if name == "new_order" {
newOrderHist = hist
}
if !strings.HasSuffix(name, "_ERR") {
totalOps += hist.GetInfo().Ops
}
}
if newOrderHist != nil && !newOrderHist.Empty() {
result := newOrderHist.GetInfo()
const specWarehouseFactor = 12.86
tpmC := result.Ops * 60
tpmTotal := totalOps * 60
efc := 100 * tpmC / (specWarehouseFactor * float64(w.cfg.Warehouses))
lines := [][]string{
{
util.FloatToOneString(tpmC),
util.FloatToOneString(tpmTotal),
util.FloatToOneString(efc) + "%",
},
}
switch w.cfg.OutputStyle {
case util.OutputStylePlain:
util.RenderString("tpmC: %s, efficiency: %s\n", nil, lines)
util.RenderString("tpmC: %s, tpmTotal: %s, efficiency: %s\n", nil, lines)
case util.OutputStyleTable:
util.RenderTable([]string{"tpmC", "efficiency"}, lines)
util.RenderTable([]string{"tpmC", "tpmTotal", "efficiency"}, lines)
case util.OutputStyleJson:
util.RenderJson([]string{"tpmC", "efficiency"}, lines)
util.RenderJson([]string{"tpmC", "tpmTotal", "efficiency"}, lines)
}
}
}
Expand Down