@@ -345,8 +345,10 @@ type table struct {
345345 buf bytes.Buffer
346346}
347347
348- func (s HistorySize ) TableString (threshold Threshold , nameStyle NameStyle ) string {
349- contents := s .contents ()
348+ func (s HistorySize ) TableString (
349+ refGroups []RefGroup , threshold Threshold , nameStyle NameStyle ,
350+ ) string {
351+ contents := s .contents (refGroups )
350352 t := table {
351353 threshold : threshold ,
352354 nameStyle : nameStyle ,
@@ -422,19 +424,41 @@ func (t *table) formatRow(
422424 )
423425}
424426
425- func (s HistorySize ) JSON (threshold Threshold , nameStyle NameStyle ) ([]byte , error ) {
426- contents := s .contents ()
427+ func (s HistorySize ) JSON (
428+ refGroups []RefGroup , threshold Threshold , nameStyle NameStyle ,
429+ ) ([]byte , error ) {
430+ contents := s .contents (refGroups )
427431 items := make (map [string ]* item )
428432 contents .CollectItems (items )
429433 j , err := json .MarshalIndent (items , "" , " " )
430434 return j , err
431435}
432436
433- func (s HistorySize ) contents () tableContents {
437+ func (s HistorySize ) contents (refGroups [] RefGroup ) tableContents {
434438 S := newSection
435439 I := newItem
436440 metric := counts .Metric
437441 binary := counts .Binary
442+
443+ var rgis []tableContents
444+ for _ , rg := range refGroups {
445+ if rg .Symbol == "" {
446+ continue
447+ }
448+ count , ok := s .ReferenceGroups [rg .Symbol ]
449+ if ! ok {
450+ continue
451+ }
452+ rgis = append (
453+ rgis ,
454+ I (
455+ fmt .Sprintf ("refgroup.%s" , rg .Symbol ), rg .Name ,
456+ fmt .Sprintf ("The number of references in group '%s'" , rg .Symbol ),
457+ nil , * count , metric , "" , 25000 ,
458+ ),
459+ )
460+ }
461+
438462 return S (
439463 "" ,
440464 S (
@@ -484,6 +508,10 @@ func (s HistorySize) contents() tableContents {
484508 I ("referenceCount" , "Count" ,
485509 "The total number of references" ,
486510 nil , s .ReferenceCount , metric , "" , 25e3 ),
511+ S (
512+ "" ,
513+ rgis ... ,
514+ ),
487515 ),
488516 ),
489517
0 commit comments