Skip to content

Commit

Permalink
internal/plot: make 'gc-scan' a stacked bar plot
Browse files Browse the repository at this point in the history
  • Loading branch information
arl committed Oct 3, 2023
1 parent dd9e847 commit 9678f65
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions internal/plot/plots.go
Original file line number Diff line number Diff line change
Expand Up @@ -1259,34 +1259,41 @@ func (p *gcScan) name() string { return "gc-scan" }
func (p *gcScan) isEnabled() bool { return p.enabled }

func (p *gcScan) layout(_ []metrics.Sample) any {
s := Scatter{
return Scatter{
Name: p.name(),
Title: "GC Scan",
Type: "scatter",
Type: "bar",
Events: "lastgc",
Subplots: []Subplot{
{
Name: "scannable globals",
Unitfmt: "%{y:.4s}B",
Type: "bar",
},
{
Name: "scannable heap",
Unitfmt: "%{y:.4s}B",
Type: "bar",
},
{
Name: "scanned stack",
Unitfmt: "%{y:.4s}B",
Type: "bar",
},
},
InfoText: `This plot shows the amount of memory that is scannable by the GC.
<i>scannable globals</i> is <b>/gc/scan/globals</b>, the total amount of global variable space that is scannable.
<i>scannable heap</i> is <b>/gc/scan/heap</b>, the total amount of heap space that is scannable.
<i>scanned stack</i> is <b>/gc/scan/stack</b>, the number of bytes of stack that were scanned last GC cycle.
`,
Layout: ScatterLayout{
BarMode: "stack",
Yaxis: ScatterYAxis{
TickSuffix: "B",
Title: "bytes",
},
},
}
s.Layout.Yaxis.TickSuffix = "B"
s.Layout.Yaxis.Title = "bytes"
return s
}

func (p *gcScan) values(samples []metrics.Sample) any {
Expand Down

0 comments on commit 9678f65

Please sign in to comment.