Skip to content

Commit 8f667c4

Browse files
craig[bot]wenyihu6
andcommitted
Merge #150234
150234: roachtests/allocation_bench: improve logging in runAllocationBench r=tbg a=wenyihu6 Previously, the logs from allocation_bench were difficult to interpret. This commit improves clarity by making the log messages more descriptive. Epic: none Release note: none Co-authored-by: wenyihu6 <[email protected]>
2 parents 627907a + 61113ac commit 8f667c4

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

pkg/cmd/roachtest/tests/allocation_bench.go

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"fmt"
1111
"math"
1212
"sort"
13+
"strings"
1314
"time"
1415

1516
"github.com/cockroachdb/cockroach/pkg/cmd/roachtest/cluster"
@@ -330,13 +331,18 @@ func runAllocationBench(
330331
}
331332
samples := make([]*clusterstats.ClusterStatRun, spec.samples)
332333

334+
t.L().Printf("cpu(%) means: average of (max-min) node cpu utilization across intervals")
335+
t.L().Printf("write(%) means: average of (max-min) write disk utilization across intervals")
336+
t.L().Printf("cost(gb) means: GBs sent for rebalancing operations between initial and end")
337+
333338
for i := 0; i < spec.samples; i++ {
334339
statCollector, cleanupFunc := setupAllocationBench(ctx, t, c, spec)
335340
stats, err := runAllocationBenchSample(ctx, t, c, spec, statCollector)
336341
if err != nil {
337342
t.L().PrintfCtx(ctx, "unable to collect allocation bench sample %s", err.Error())
338343
} else {
339344
samples[i] = stats
345+
t.L().Printf("sample %d: %v", i+1, stats.Total)
340346
}
341347
// Completely wipe the cluster after each go. This avoid spurious
342348
// results where prior information / statistics could influence the
@@ -544,11 +550,21 @@ func findMinDistanceClusterStatRun(
544550
}
545551
}
546552

547-
t.L().Printf("Selected row(%d) %v from samples (normalized) %v", minSample, samples[minSample].Total, resultMatrix)
548-
t.L().Printf("Sample range %v", minMaxs)
549-
t.L().Printf("Sample stddev %v", stddevs)
550-
for _, sample := range samples {
551-
t.L().Printf("%v", sample.Total)
553+
t.L().Printf("normalized result matrix:")
554+
var buf strings.Builder
555+
for i := 0; i < n; i++ {
556+
fmt.Fprintf(&buf, "\tsample run %v [", i+1)
557+
for j := 0; j < len(resultMatrix[i]); j++ {
558+
if j > 0 {
559+
fmt.Fprintf(&buf, ", ")
560+
}
561+
fmt.Fprintf(&buf, "%v: %.3f", tags[j], resultMatrix[i][j])
562+
}
563+
fmt.Fprintf(&buf, "]\n")
552564
}
565+
t.L().Printf(buf.String())
566+
t.L().Printf("selected sample %v (1-indexed) with total %v", minSample+1, samples[minSample].Total)
567+
t.L().Printf("max-min differences across samples per tag: %v", minMaxs)
568+
t.L().Printf("standard deviations across samples per tag: %v", stddevs)
553569
return samples[minSample], stddevs
554570
}

0 commit comments

Comments
 (0)