Skip to content

Commit bb6aa8e

Browse files
committed
internal/plot: improve plot tooltips
1 parent d915f03 commit bb6aa8e

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

internal/plot/layouts.go

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ var garbageCollectionLayout = Scatter{
2222
{Name: "heap goal", Unitfmt: "%{y:.4s}B"},
2323
},
2424
InfoText: `
25-
<i>Memory limit</i> is <b>/gc/gomemlimit</b>, the total amount of memory that the Go runtime can use.
25+
<i>Memory limit</i> is <b>/gc/gomemlimit:bytes</b>, the Go runtime memory limit configured by the user (via GOMEMLIMIT or debug.SetMemoryLimt), otherwise 0.
2626
<i>In-use memory</i> is the total mapped memory minus released heap memory (<b>/memory/classes/total - /memory/classes/heap/released</b>).
27-
<i>Heap live</i> is <b>/gc/heap/live</b>, the current size of all live heap objects.
28-
<i>Heap goal</i> is <b>/gc/heap/goal</b>, the target heap size at the end of each GC cycle.`,
27+
<i>Heap live</i> is <b>/gc/heap/live:bytes</b>, heap memory occupied by live objects.
28+
<i>Heap goal</i> is <b>/gc/heap/goal:bytes</b>, the heap size target at the end of each GC cycle.`,
2929
}
3030

3131
var heapDetailslLayout = Scatter{
@@ -57,7 +57,8 @@ var heapDetailslLayout = Scatter{
5757
Unitfmt: "%{y:.4s}B",
5858
},
5959
},
60-
InfoText: `<i>Heap</i> sys is <b>/memory/classes/heap/objects + /memory/classes/heap/unused + /memory/classes/heap/released + /memory/classes/heap/free</b>. It's an estimate of all the heap memory obtained form the OS.
60+
InfoText: `
61+
<i>Heap</i> sys is <b>/memory/classes/heap/{objects + unused + released + free}</b>. It's an estimate of all the heap memory obtained from the OS.
6162
<i>Heap objects</i> is <b>/memory/classes/heap/objects</b>, the memory occupied by live objects and dead objects that have not yet been marked free by the GC.
6263
<i>Heap stacks</i> is <b>/memory/classes/heap/stacks</b>, the memory used for stack space.
6364
<i>Heap goal</i> is <b>gc/heap/goal</b>, the heap size target for the end of the GC cycle.`,
@@ -70,7 +71,7 @@ var liveObjectsLayout = Scatter{
7071
Events: "lastgc",
7172
Layout: ScatterLayout{
7273
Yaxis: ScatterYAxis{
73-
Title: "bytes",
74+
Title: "objects",
7475
},
7576
},
7677
Subplots: []Subplot{
@@ -132,18 +133,18 @@ var mspanMCacheLayout = Scatter{
132133
Unitfmt: "%{y:.4s}B",
133134
},
134135
},
135-
InfoText: `<i>Mspan in-use</i> is <b>/memory/classes/metadata/mspan/inuse</b>, the memory that is occupied by runtime mspan structures that are currently being used.
136+
InfoText: `
137+
<i>Mspan in-use</i> is <b>/memory/classes/metadata/mspan/inuse</b>, the memory that is occupied by runtime mspan structures that are currently being used.
136138
<i>Mspan free</i> is <b>/memory/classes/metadata/mspan/free</b>, the memory that is reserved for runtime mspan structures, but not in-use.
137139
<i>Mcache in-use</i> is <b>/memory/classes/metadata/mcache/inuse</b>, the memory that is occupied by runtime mcache structures that are currently being used.
138140
<i>Mcache free</i> is <b>/memory/classes/metadata/mcache/free</b>, the memory that is reserved for runtime mcache structures, but not in-use.
139141
`,
140142
}
141143

142144
var goroutinesLayout = Scatter{
143-
Name: "TODO(set later)",
144-
Title: "Goroutines",
145-
Type: "scatter",
146-
Events: "lastgc",
145+
Name: "TODO(set later)",
146+
Title: "Goroutines",
147+
Type: "scatter",
147148
Layout: ScatterLayout{
148149
Yaxis: ScatterYAxis{
149150
Title: "goroutines",
@@ -229,7 +230,7 @@ func gcPausesLayout(samples []metrics.Sample) Heatmap {
229230
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},
230231
},
231232
},
232-
InfoText: `This heatmap shows the distribution of individual GC-related stop-the-world pause latencies, uses <b>/gc/pauses:seconds</b>,.`,
233+
InfoText: `This heatmap shows the distribution of individual GC-related stop-the-world pause latencies, uses <b>/sched/pauses/total/gc:seconds</b>,.`,
233234
}
234235
}
235236

@@ -311,7 +312,7 @@ var cgoLayout = Scatter{
311312

312313
var gcStackSizeLayout = Scatter{
313314
Name: "TODO(set later)",
314-
Title: "Starting Size of Goroutines Stacks",
315+
Title: "Goroutine stack starting size",
315316
Type: "scatter",
316317
Layout: ScatterLayout{
317318
Yaxis: ScatterYAxis{
@@ -382,7 +383,8 @@ var memoryClassesLayout = Scatter{
382383
},
383384
},
384385

385-
InfoText: `<i>OS stacks</i> is <b>/memory/classes/os-stacks</b>, stack memory allocated by the underlying operating system.
386+
InfoText: `
387+
<i>OS stacks</i> is <b>/memory/classes/os-stacks</b>, stack memory allocated by the underlying operating system.
386388
<i>Other</i> is <b>/memory/classes/other</b>, memory used by execution trace buffers, structures for debugging the runtime, finalizer and profiler specials, and more.
387389
<i>Profiling buckets</i> is <b>/memory/classes/profiling/buckets</b>, memory that is used by the stack trace hash map used for profiling.
388390
<i>Total</i> is <b>/memory/classes/total</b>, all memory mapped by the Go runtime into the current process as read-write.`,
@@ -511,7 +513,7 @@ All metrics are rates in CPU-seconds per second.`,
511513

512514
var mutexWaitLayout = Scatter{
513515
Name: "TODO(set later)",
514-
Title: "Time Goroutines Spend Blocked on Mutexes",
516+
Title: "Mutex wait time",
515517
Type: "bar",
516518
Events: "lastgc",
517519
Layout: ScatterLayout{
@@ -563,7 +565,8 @@ var gcScanLayout = Scatter{
563565
Type: "bar",
564566
},
565567
},
566-
InfoText: `This plot shows the amount of memory that is scannable by the GC.
568+
InfoText: `
569+
This plot shows the amount of memory that is scannable by the GC.
567570
<i>scannable globals</i> is <b>/gc/scan/globals</b>, the total amount of global variable space that is scannable.
568571
<i>scannable heap</i> is <b>/gc/scan/heap</b>, the total amount of heap space that is scannable.
569572
<i>scanned stack</i> is <b>/gc/scan/stack</b>, the number of bytes of stack that were scanned last GC cycle.

internal/plot/plots.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func init() {
117117
name: "gc-pauses",
118118
tags: []string{"scheduler"},
119119
metrics: []string{
120-
"/gc/pauses:seconds",
120+
"/sched/pauses/total/gc:seconds",
121121
},
122122
layout: gcPausesLayout(samples),
123123
make: makeGCPauses,

internal/plot/plots_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ func TestUnusedRuntimeMetrics(t *testing.T) {
3434
// runtime/metrics are not used in any Statsviz plot.
3535
w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0)
3636
for _, m := range metrics.All() {
37-
if _, ok := l.usedMetrics[m.Name]; !ok && !strings.HasPrefix(m.Name, "/godebug/") {
37+
if _, ok := l.usedMetrics[m.Name]; !ok &&
38+
!strings.HasPrefix(m.Name, "/godebug/") &&
39+
m.Name != "/gc/pauses:seconds" /* deprecated name */ {
3840
fmt.Fprintf(w, "%s\t%s\n", m.Name, kindstr(m.Kind))
3941
}
4042
}

0 commit comments

Comments
 (0)