File tree Expand file tree Collapse file tree 3 files changed +29
-4
lines changed
Expand file tree Collapse file tree 3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,7 @@ var memoryClassesLayout = Scatter{
397397<i>Profiling buckets</i> is <b>/memory/classes/profiling/buckets</b>, memory that is used by the stack trace hash map used for profiling.
398398<i>Total</i> is <b>/memory/classes/total</b>, all memory mapped by the Go runtime into the current process as read-write.` ,
399399}
400+
400401var cpuClassesLayout = Scatter {
401402 Name : "TODO" ,
402403 Title : "CPU classes (GC)" ,
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ func init() {
5656 "/gc/heap/goal:bytes" ,
5757 },
5858 layout : heapDetailslLayout ,
59- make : makeHeapGlobal ,
59+ make : makeHeapDetails ,
6060 },
6161 {
6262 name : "live-objects" ,
@@ -412,6 +412,11 @@ func makeGCPauses(indices ...int) runtimeMetric {
412412}
413413
414414func (p * gcpauses ) values (samples []metrics.Sample ) any {
415+ if p .histfactor == 0 {
416+ gcpauses := samples [p .idxgcpauses ].Value .Float64Histogram ()
417+ p .histfactor = downsampleFactor (len (gcpauses .Buckets ), maxBuckets )
418+ }
419+
415420 gcpauses := samples [p .idxgcpauses ].Value .Float64Histogram ()
416421 return downsampleCounts (gcpauses , p .histfactor , p .counts [:])
417422}
@@ -432,6 +437,11 @@ func makeRunnableTime(indices ...int) runtimeMetric {
432437}
433438
434439func (p * runnableTime ) values (samples []metrics.Sample ) any {
440+ if p .histfactor == 0 {
441+ schedlat := samples [p .idxschedlat ].Value .Float64Histogram ()
442+ p .histfactor = downsampleFactor (len (schedlat .Buckets ), maxBuckets )
443+ }
444+
435445 schedlat := samples [p .idxschedlat ].Value .Float64Histogram ()
436446
437447 return downsampleCounts (schedlat , p .histfactor , p .counts [:])
Original file line number Diff line number Diff line change @@ -77,19 +77,33 @@ func enabledPlots() []rtplot {
7777 if plot .make == nil {
7878 continue
7979 }
80+
8081 indices , enabled := indicesFor (plot .metrics ... )
8182 if enabled {
8283 plots = append (plots , rtplot {
8384 name : plot .name ,
8485 rt : plot .make (indices ... ),
85- layout : plot .layout ,
86+ layout : assignName ( plot .layout , plot . name ) ,
8687 })
8788 }
8889 }
8990
9091 return plots
9192}
9293
94+ func assignName (layout any , name string ) any {
95+ switch layout := layout .(type ) {
96+ case Scatter :
97+ layout .Name = name
98+ return layout
99+ case Heatmap :
100+ layout .Name = name
101+ return layout
102+ default :
103+ panic (fmt .Sprintf ("unknown plot layout type %T" , layout ))
104+ }
105+ }
106+
93107func (pl * List ) Config () * Config {
94108 pl .once .Do (func () {
95109 pl .rtPlots = enabledPlots ()
@@ -168,8 +182,8 @@ func (pl *List) WriteValues(w io.Writer) error {
168182 return nil
169183}
170184
171- // mapMetricsToIndices retrieves indices for the specified metrics, returning
172- // both the indices and whether all metrics were found.
185+ // indicesFor retrieves indices for the specified metrics, and a boolean
186+ // indicating whether they were all found.
173187func indicesFor (metricNames ... string ) ([]int , bool ) {
174188 indices := make ([]int , len (metricNames ))
175189 allFound := true
You can’t perform that action at this time.
0 commit comments