Skip to content

Commit d0bc960

Browse files
committed
Cosmetics: reorder plots, rename stuff and move functions
1 parent 10d9eb7 commit d0bc960

File tree

2 files changed

+102
-94
lines changed

2 files changed

+102
-94
lines changed

internal/plot/layouts.go

Lines changed: 77 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ import (
44
"runtime/metrics"
55
)
66

7+
func floatseq(n int) []float64 {
8+
seq := make([]float64, n)
9+
for i := range n {
10+
seq[i] = float64(i)
11+
}
12+
return seq
13+
}
14+
715
var garbageCollectionLayout = Scatter{
816
Name: "garbage collection",
917
Title: "GC Memory Summary",
@@ -202,38 +210,6 @@ func sizeClassesLayout(samples []metrics.Sample) Heatmap {
202210
}
203211
}
204212

205-
func gcPausesLayout(samples []metrics.Sample) Heatmap {
206-
idxgcpauses := metricIdx["/sched/pauses/total/gc:seconds"]
207-
208-
gcpauses := samples[idxgcpauses].Value.Float64Histogram()
209-
histfactor := downsampleFactor(len(gcpauses.Buckets), maxBuckets)
210-
buckets := downsampleBuckets(gcpauses, histfactor)
211-
212-
return Heatmap{
213-
Name: "TODO(set later)",
214-
Title: "Stop-the-world Pause Latencies",
215-
Type: "heatmap",
216-
UpdateFreq: 5,
217-
Colorscale: PinkShades,
218-
Buckets: floatseq(len(buckets)),
219-
CustomData: buckets,
220-
Hover: HeapmapHover{
221-
YName: "pause duration",
222-
YUnit: "duration",
223-
ZName: "pauses",
224-
},
225-
Layout: HeatmapLayout{
226-
YAxis: HeatmapYaxis{
227-
Title: "pause duration",
228-
TickMode: "array",
229-
TickVals: []float64{6, 13, 20, 26, 33, 39.5, 46, 53, 60, 66, 73, 79, 86},
230-
TickText: []float64{1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 5e-3, 1e-2, 5e-2, 1e-1, 5e-1, 1, 5, 10},
231-
},
232-
},
233-
InfoText: `This heatmap shows the distribution of individual GC-related stop-the-world pause latencies, uses <b>/sched/pauses/total/gc:seconds</b>,.`,
234-
}
235-
}
236-
237213
func runnableTimeLayout(samples []metrics.Sample) Heatmap {
238214
idxschedlat := metricIdx["/sched/latencies:seconds"]
239215

@@ -599,48 +575,86 @@ var allocFreeRatesLayout = Scatter{
599575
<i>Frees per second</i> is similarly derived from <b>/gc/heap/frees:objects</b>.`,
600576
}
601577

602-
func stoppingPausesGCLayout(samples []metrics.Sample) Heatmap {
603-
idxstoppinggc := metricIdx["/sched/pauses/stopping/gc:seconds"]
578+
func gcTotalPausesLayout(samples []metrics.Sample) Heatmap {
579+
idxgcpauses := metricIdx["/sched/pauses/total/gc:seconds"]
604580

605-
stoppinggc := samples[idxstoppinggc].Value.Float64Histogram()
606-
histfactor := downsampleFactor(len(stoppinggc.Buckets), maxBuckets)
607-
buckets := downsampleBuckets(stoppinggc, histfactor)
581+
gcpauses := samples[idxgcpauses].Value.Float64Histogram()
582+
histfactor := downsampleFactor(len(gcpauses.Buckets), maxBuckets)
583+
buckets := downsampleBuckets(gcpauses, histfactor)
608584

609585
return Heatmap{
610586
Name: "TODO(set later)",
611-
Title: "Stop-the-world Stopping Latencies (GC)",
587+
Title: "Stop-the-world Pause Latencies (Total)",
612588
Type: "heatmap",
613589
UpdateFreq: 5,
614590
Colorscale: PinkShades,
615591
Buckets: floatseq(len(buckets)),
616592
CustomData: buckets,
617593
Hover: HeapmapHover{
618-
YName: "stopping duration",
594+
YName: "pause duration",
619595
YUnit: "duration",
620596
ZName: "pauses",
621597
},
622598
Layout: HeatmapLayout{
623599
YAxis: HeatmapYaxis{
624-
Title: "stopping duration",
600+
Title: "pause duration",
625601
TickMode: "array",
626602
TickVals: []float64{6, 13, 20, 26, 33, 39.5, 46, 53, 60, 66, 73, 79, 86},
627603
TickText: []float64{1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 5e-3, 1e-2, 5e-2, 1e-1, 5e-1, 1, 5, 10},
628604
},
629605
},
630-
InfoText: `This heatmap shows the distribution of individual GC-related stop-the-world stopping latencies. This is the time it takes from deciding to stop the world until all Ps are stopped. This is a subset of the total GC-related stop-the-world time. During this time, some threads may be executing. Uses <b>/sched/pauses/stopping/gc:seconds</b>.`,
606+
InfoText: `This heatmap shows the distribution of individual <b>GC-related</b> stop-the-world <i>pause latencies</i>.
607+
This is the time from deciding to stop the world until the world is started again.
608+
Some of this time is spent getting all threads to stop (this is measured directly in <i>/sched/pauses/stopping/gc:seconds</i>), during which some threads may still be running.
609+
Uses <b>/sched/pauses/total/gc:seconds</b>.`,
631610
}
632611
}
633612

634-
func stoppingPausesOtherLayout(samples []metrics.Sample) Heatmap {
635-
idxstoppingother := metricIdx["/sched/pauses/stopping/other:seconds"]
613+
func otherTotalPausesLayout(samples []metrics.Sample) Heatmap {
614+
idxtotalother := metricIdx["/sched/pauses/total/other:seconds"]
636615

637-
stoppingother := samples[idxstoppingother].Value.Float64Histogram()
638-
histfactor := downsampleFactor(len(stoppingother.Buckets), maxBuckets)
639-
buckets := downsampleBuckets(stoppingother, histfactor)
616+
totalother := samples[idxtotalother].Value.Float64Histogram()
617+
histfactor := downsampleFactor(len(totalother.Buckets), maxBuckets)
618+
buckets := downsampleBuckets(totalother, histfactor)
640619

641620
return Heatmap{
642621
Name: "TODO(set later)",
643-
Title: "Stop-the-world Stopping Latencies (Other)",
622+
Title: "Stop-the-world Pause Latencies (Other)",
623+
Type: "heatmap",
624+
UpdateFreq: 5,
625+
Colorscale: PinkShades,
626+
Buckets: floatseq(len(buckets)),
627+
CustomData: buckets,
628+
Hover: HeapmapHover{
629+
YName: "pause duration",
630+
YUnit: "duration",
631+
ZName: "pauses",
632+
},
633+
Layout: HeatmapLayout{
634+
YAxis: HeatmapYaxis{
635+
Title: "pause duration",
636+
TickMode: "array",
637+
TickVals: []float64{6, 13, 20, 26, 33, 39.5, 46, 53, 60, 66, 73, 79, 86},
638+
TickText: []float64{1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 5e-3, 1e-2, 5e-2, 1e-1, 5e-1, 1, 5, 10},
639+
},
640+
},
641+
InfoText: `This heatmap shows the distribution of individual <b>non-GC-related</b> stop-the-world <i>pause latencies</i>.
642+
This is the time from deciding to stop the world until the world is started again.
643+
Some of this time is spent getting all threads to stop (measured directly in <i>/sched/pauses/stopping/other:seconds</i>).
644+
Uses <b>/sched/pauses/total/other:seconds</b>.`,
645+
}
646+
}
647+
648+
func gcStoppingPausesLayout(samples []metrics.Sample) Heatmap {
649+
idxstoppinggc := metricIdx["/sched/pauses/stopping/gc:seconds"]
650+
651+
stoppinggc := samples[idxstoppinggc].Value.Float64Histogram()
652+
histfactor := downsampleFactor(len(stoppinggc.Buckets), maxBuckets)
653+
buckets := downsampleBuckets(stoppinggc, histfactor)
654+
655+
return Heatmap{
656+
Name: "TODO(set later)",
657+
Title: "Stop-the-world Stopping Latencies (GC)",
644658
Type: "heatmap",
645659
UpdateFreq: 5,
646660
Colorscale: PinkShades,
@@ -659,38 +673,44 @@ func stoppingPausesOtherLayout(samples []metrics.Sample) Heatmap {
659673
TickText: []float64{1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 5e-3, 1e-2, 5e-2, 1e-1, 5e-1, 1, 5, 10},
660674
},
661675
},
662-
InfoText: `This heatmap shows the distribution of individual non-GC-related stop-the-world stopping latencies. This is the time it takes from deciding to stop the world until all Ps are stopped. This is a subset of the total non-GC-related stop-the-world time. During this time, some threads may be executing. Uses <b>/sched/pauses/stopping/other:seconds</b>.`,
676+
InfoText: `This heatmap shows the distribution of individual <b>GC-related</b> stop-the-world <i>stopping latencies</i>.
677+
This is the time it takes from deciding to stop the world until all Ps are stopped.
678+
During this time, some threads may be executing.
679+
Uses <b>/sched/pauses/stopping/gc:seconds</b>.`,
663680
}
664681
}
665682

666-
func totalPausesOtherLayout(samples []metrics.Sample) Heatmap {
667-
idxtotalother := metricIdx["/sched/pauses/total/other:seconds"]
683+
func otherStoppingPausesLayout(samples []metrics.Sample) Heatmap {
684+
idxstoppingother := metricIdx["/sched/pauses/stopping/other:seconds"]
668685

669-
totalother := samples[idxtotalother].Value.Float64Histogram()
670-
histfactor := downsampleFactor(len(totalother.Buckets), maxBuckets)
671-
buckets := downsampleBuckets(totalother, histfactor)
686+
stoppingother := samples[idxstoppingother].Value.Float64Histogram()
687+
histfactor := downsampleFactor(len(stoppingother.Buckets), maxBuckets)
688+
buckets := downsampleBuckets(stoppingother, histfactor)
672689

673690
return Heatmap{
674691
Name: "TODO(set later)",
675-
Title: "Stop-the-world Pause Latencies (Other)",
692+
Title: "Stop-the-world Stopping Latencies (Other)",
676693
Type: "heatmap",
677694
UpdateFreq: 5,
678695
Colorscale: PinkShades,
679696
Buckets: floatseq(len(buckets)),
680697
CustomData: buckets,
681698
Hover: HeapmapHover{
682-
YName: "pause duration",
699+
YName: "stopping duration",
683700
YUnit: "duration",
684701
ZName: "pauses",
685702
},
686703
Layout: HeatmapLayout{
687704
YAxis: HeatmapYaxis{
688-
Title: "pause duration",
705+
Title: "stopping duration",
689706
TickMode: "array",
690707
TickVals: []float64{6, 13, 20, 26, 33, 39.5, 46, 53, 60, 66, 73, 79, 86},
691708
TickText: []float64{1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 5e-3, 1e-2, 5e-2, 1e-1, 5e-1, 1, 5, 10},
692709
},
693710
},
694-
InfoText: `This heatmap shows the distribution of individual non-GC-related stop-the-world pause latencies. This is the time from deciding to stop the world until the world is started again. Some of this time is spent getting all threads to stop. Uses <b>/sched/pauses/total/other:seconds</b>.`,
711+
InfoText: `This heatmap shows the distribution of individual <b>non-GC-related</b> stop-the-world <i>stopping latencies</i>.
712+
This is the time it takes from deciding to stop the world until all Ps are stopped.
713+
This is a subset of the total non-GC-related stop-the-world time. During this time, some threads may be executing.
714+
Uses <b>/sched/pauses/stopping/other:seconds</b>.`,
695715
}
696716
}

internal/plot/plots.go

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,6 @@ func init() {
113113
layout: sizeClassesLayout(samples),
114114
make: makeSizeClasses,
115115
},
116-
{
117-
name: "gc-pauses",
118-
tags: []string{"scheduler"},
119-
metrics: []string{
120-
"/sched/pauses/total/gc:seconds",
121-
},
122-
layout: gcPausesLayout(samples),
123-
make: makeGCPauses,
124-
},
125116
{
126117
name: "runnable-time",
127118
tags: []string{"scheduler"},
@@ -248,31 +239,40 @@ func init() {
248239
make: makeAllocFreeRates,
249240
},
250241
{
251-
name: "stopping-pauses-gc",
242+
name: "total-pauses-gc",
252243
tags: []string{"scheduler"},
253244
metrics: []string{
254-
"/sched/pauses/stopping/gc:seconds",
245+
"/sched/pauses/total/gc:seconds",
255246
},
256-
layout: stoppingPausesGCLayout(samples),
257-
make: makeStoppingPausesGC,
247+
layout: gcTotalPausesLayout(samples),
248+
make: makeGCTotalPauses,
258249
},
259250
{
260-
name: "stopping-pauses-other",
251+
name: "total-pauses-other",
261252
tags: []string{"scheduler"},
262253
metrics: []string{
263-
"/sched/pauses/stopping/other:seconds",
254+
"/sched/pauses/total/other:seconds",
264255
},
265-
layout: stoppingPausesOtherLayout(samples),
266-
make: makeStoppingPausesOther,
256+
layout: otherTotalPausesLayout(samples),
257+
make: makeOtherTotalPauses,
267258
},
268259
{
269-
name: "total-pauses-other",
260+
name: "stopping-pauses-gc",
270261
tags: []string{"scheduler"},
271262
metrics: []string{
272-
"/sched/pauses/total/other:seconds",
263+
"/sched/pauses/stopping/gc:seconds",
264+
},
265+
layout: gcStoppingPausesLayout(samples),
266+
make: makeGCStoppingPauses,
267+
},
268+
{
269+
name: "stopping-pauses-other",
270+
tags: []string{"scheduler"},
271+
metrics: []string{
272+
"/sched/pauses/stopping/other:seconds",
273273
},
274-
layout: totalPausesOtherLayout(samples),
275-
make: makeTotalPausesOther,
274+
layout: otherStoppingPausesLayout(samples),
275+
make: makeGCStoppingOther,
276276
},
277277
}
278278
}
@@ -486,7 +486,7 @@ type gcpauses struct {
486486
idxgcpauses int
487487
}
488488

489-
func makeGCPauses(indices ...int) metricsGetter {
489+
func makeGCTotalPauses(indices ...int) metricsGetter {
490490
return &gcpauses{
491491
idxgcpauses: indices[0],
492492
}
@@ -970,18 +970,6 @@ func (p *allocFreeRates) values(samples []metrics.Sample) any {
970970
}
971971
}
972972

973-
/*
974-
* helpers
975-
*/
976-
977-
func floatseq(n int) []float64 {
978-
seq := make([]float64, n)
979-
for i := range n {
980-
seq[i] = float64(i)
981-
}
982-
return seq
983-
}
984-
985973
// stopping pauses (GC)
986974

987975
type stoppingPausesGC struct {
@@ -991,7 +979,7 @@ type stoppingPausesGC struct {
991979
idxstoppinggc int
992980
}
993981

994-
func makeStoppingPausesGC(indices ...int) metricsGetter {
982+
func makeGCStoppingPauses(indices ...int) metricsGetter {
995983
return &stoppingPausesGC{
996984
idxstoppinggc: indices[0],
997985
}
@@ -1016,7 +1004,7 @@ type stoppingPausesOther struct {
10161004
idxstoppingother int
10171005
}
10181006

1019-
func makeStoppingPausesOther(indices ...int) metricsGetter {
1007+
func makeGCStoppingOther(indices ...int) metricsGetter {
10201008
return &stoppingPausesOther{
10211009
idxstoppingother: indices[0],
10221010
}
@@ -1041,7 +1029,7 @@ type totalPausesOther struct {
10411029
idxtotalother int
10421030
}
10431031

1044-
func makeTotalPausesOther(indices ...int) metricsGetter {
1032+
func makeOtherTotalPauses(indices ...int) metricsGetter {
10451033
return &totalPausesOther{
10461034
idxtotalother: indices[0],
10471035
}

0 commit comments

Comments
 (0)