Skip to content

Commit

Permalink
Fix layout of metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
nakabonne committed Oct 1, 2020
1 parent c9d4086 commit 406501e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions gui/drawer.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ Out:
Total: %v
Mean: %v`

othersTextFormat = `Earliest: %v
Latest: %v
End: %v
Duration: %v
othersTextFormat = `Duration: %v
Wait: %v
Requests: %d
Rate: %f
Throughput: %f
Success: %f`
Success: %f
Earliest: %v
Latest: %v
End: %v`
)

func (d *drawer) redrawMetrics(ctx context.Context) {
Expand Down Expand Up @@ -132,20 +132,20 @@ func (d *drawer) redrawMetrics(ctx context.Context) {
), text.WriteReplace())

d.widgets.othersText.Write(fmt.Sprintf(othersTextFormat,
metrics.Earliest,
metrics.Latest,
metrics.End,
metrics.Duration,
metrics.Wait,
metrics.Requests,
metrics.Rate,
metrics.Throughput,
metrics.Success,
metrics.Earliest,
metrics.Latest,
metrics.End,
), text.WriteReplace())

codesText := ""
for code, n := range metrics.StatusCodes {
codesText += fmt.Sprintf(`%s: %d
codesText += fmt.Sprintf(`%q: %d
`, code, n)
}
d.widgets.statusCodesText.Write(codesText, text.WriteReplace())
Expand Down
12 changes: 6 additions & 6 deletions gui/drawer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ Out:

statusCodesText: func() Text {
t := NewMockText(ctrl)
t.EXPECT().Write(`200: 2
t.EXPECT().Write(`"200": 2
`, gomock.Any())
return t
}(),
Expand All @@ -230,15 +230,15 @@ Out:

othersText: func() Text {
t := NewMockText(ctrl)
t.EXPECT().Write(`Earliest: 2009-11-10 23:00:00 +0000 UTC
Latest: 2009-11-10 23:00:00 +0000 UTC
End: 2009-11-10 23:00:00 +0000 UTC
Duration: 1ns
t.EXPECT().Write(`Duration: 1ns
Wait: 1ns
Requests: 1
Rate: 1.000000
Throughput: 1.000000
Success: 1.000000`, gomock.Any())
Success: 1.000000
Earliest: 2009-11-10 23:00:00 +0000 UTC
Latest: 2009-11-10 23:00:00 +0000 UTC
End: 2009-11-10 23:00:00 +0000 UTC`, gomock.Any())

return t
}(),
Expand Down

0 comments on commit 406501e

Please sign in to comment.