@@ -7,10 +7,12 @@ import (
77)
88
99type plotDesc struct {
10+ // make creates the state (support struct) for the plot.
11+ make func (indices ... int ) metricsGetter
12+
1013 name string
1114 metrics []string
1215 layout any
13- make func (indices ... int ) runtimeMetric
1416}
1517
1618var (
@@ -194,10 +196,6 @@ func init() {
194196 layout : gcScanLayout ,
195197 make : makeGCScan ,
196198 },
197-
198- // reserved time serie names
199- {name : "timestamp" , make : nil }, // x axis
200- {name : "lastgc" , make : nil }, // gc events (vertical lines)
201199 }
202200}
203201
@@ -210,7 +208,7 @@ type heapGlobal struct {
210208 idxreleased int
211209}
212210
213- func makeHeapGlobal (indices ... int ) runtimeMetric {
211+ func makeHeapGlobal (indices ... int ) metricsGetter {
214212 return & heapGlobal {
215213 idxobj : indices [0 ],
216214 idxunused : indices [1 ],
@@ -244,7 +242,7 @@ type heapDetails struct {
244242 idxgoal int
245243}
246244
247- func makeHeapDetails (indices ... int ) runtimeMetric {
245+ func makeHeapDetails (indices ... int ) metricsGetter {
248246 return & heapDetails {
249247 idxobj : indices [0 ],
250248 idxunused : indices [1 ],
@@ -281,7 +279,7 @@ type liveObjects struct {
281279 idxobjects int
282280}
283281
284- func makeLiveObjects (indices ... int ) runtimeMetric {
282+ func makeLiveObjects (indices ... int ) metricsGetter {
285283 return & liveObjects {
286284 idxobjects : indices [0 ],
287285 }
@@ -301,7 +299,7 @@ type liveBytes struct {
301299 idxfrees int
302300}
303301
304- func makeLiveBytes (indices ... int ) runtimeMetric {
302+ func makeLiveBytes (indices ... int ) metricsGetter {
305303 return & liveBytes {
306304 idxallocs : indices [0 ],
307305 idxfrees : indices [1 ],
@@ -327,7 +325,7 @@ type mspanMcache struct {
327325 idxmcacheFree int
328326}
329327
330- func makeMSpanMCache (indices ... int ) runtimeMetric {
328+ func makeMSpanMCache (indices ... int ) metricsGetter {
331329 return & mspanMcache {
332330 idxmspanInuse : indices [0 ],
333331 idxmspanFree : indices [1 ],
@@ -355,7 +353,7 @@ type goroutines struct {
355353 idxgs int
356354}
357355
358- func makeGoroutines (indices ... int ) runtimeMetric {
356+ func makeGoroutines (indices ... int ) metricsGetter {
359357 return & goroutines {
360358 idxgs : indices [0 ],
361359 }
@@ -374,7 +372,7 @@ type sizeClasses struct {
374372 idxfrees int
375373}
376374
377- func makeSizeClasses (indices ... int ) runtimeMetric {
375+ func makeSizeClasses (indices ... int ) metricsGetter {
378376 return & sizeClasses {
379377 idxallocs : indices [0 ],
380378 idxfrees : indices [1 ],
@@ -404,7 +402,7 @@ type gcpauses struct {
404402 idxgcpauses int
405403}
406404
407- func makeGCPauses (indices ... int ) runtimeMetric {
405+ func makeGCPauses (indices ... int ) metricsGetter {
408406 return & gcpauses {
409407 idxgcpauses : indices [0 ],
410408 }
@@ -429,7 +427,7 @@ type runnableTime struct {
429427 idxschedlat int
430428}
431429
432- func makeRunnableTime (indices ... int ) runtimeMetric {
430+ func makeRunnableTime (indices ... int ) metricsGetter {
433431 return & runnableTime {
434432 idxschedlat : indices [0 ],
435433 }
@@ -454,7 +452,7 @@ type schedEvents struct {
454452 lasttot uint64
455453}
456454
457- func makeSchedEvents (indices ... int ) runtimeMetric {
455+ func makeSchedEvents (indices ... int ) metricsGetter {
458456 return & schedEvents {
459457 idxschedlat : indices [0 ],
460458 idxGomaxprocs : indices [1 ],
@@ -500,7 +498,7 @@ type cgo struct {
500498 lastgo2c uint64
501499}
502500
503- func makeCGO (indices ... int ) runtimeMetric {
501+ func makeCGO (indices ... int ) metricsGetter {
504502 return & cgo {
505503 idxgo2c : indices [0 ],
506504 lastgo2c : math .MaxUint64 ,
@@ -525,7 +523,7 @@ type gcStackSize struct {
525523 idxstack int
526524}
527525
528- func makeGCStackSize (indices ... int ) runtimeMetric {
526+ func makeGCStackSize (indices ... int ) metricsGetter {
529527 return & gcStackSize {
530528 idxstack : indices [0 ],
531529 }
@@ -546,7 +544,7 @@ type gcCycles struct {
546544 lastAuto , lastForced , lastTotal uint64
547545}
548546
549- func makeGCCycles (indices ... int ) runtimeMetric {
547+ func makeGCCycles (indices ... int ) metricsGetter {
550548 return & gcCycles {
551549 idxAutomatic : indices [0 ],
552550 idxForced : indices [1 ],
@@ -586,7 +584,7 @@ type memoryClasses struct {
586584 idxTotal int
587585}
588586
589- func makeMemoryClasses (indices ... int ) runtimeMetric {
587+ func makeMemoryClasses (indices ... int ) metricsGetter {
590588 return & memoryClasses {
591589 idxOSStacks : indices [0 ],
592590 idxOther : indices [1 ],
@@ -627,7 +625,7 @@ type cpuClassesGC struct {
627625 lastTotal float64
628626}
629627
630- func makeCPUClassesGC (indices ... int ) runtimeMetric {
628+ func makeCPUClassesGC (indices ... int ) metricsGetter {
631629 return & cpuClassesGC {
632630 idxMarkAssist : indices [0 ],
633631 idxMarkDedicated : indices [1 ],
@@ -688,7 +686,7 @@ type mutexWait struct {
688686 lastMutexWait float64
689687}
690688
691- func makeMutexWait (indices ... int ) runtimeMetric {
689+ func makeMutexWait (indices ... int ) metricsGetter {
692690 return & mutexWait {
693691 idxMutexWait : indices [0 ],
694692 }
@@ -722,7 +720,7 @@ type gcScan struct {
722720 idxStack int
723721}
724722
725- func makeGCScan (indices ... int ) runtimeMetric {
723+ func makeGCScan (indices ... int ) metricsGetter {
726724 return & gcScan {
727725 idxGlobals : indices [0 ],
728726 idxHeap : indices [1 ],
0 commit comments