Skip to content

Commit 0351697

Browse files
committed
HistorySize: keep track of counts for each reference group
1 parent acf2ea7 commit 0351697

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

sizes/graph.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,10 @@ func NewGraph(nameStyle NameStyle) *Graph {
416416
tagRecords: make(map[git.OID]*tagRecord),
417417
tagSizes: make(map[git.OID]TagSize),
418418

419+
historySize: HistorySize{
420+
ReferenceGroups: make(map[RefGroupSymbol]*counts.Count32),
421+
},
422+
419423
pathResolver: NewPathResolver(nameStyle),
420424
}
421425
}

sizes/sizes.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ type HistorySize struct {
160160
// once.
161161
ReferenceCount counts.Count32 `json:"reference_count"`
162162

163+
// ReferenceGroups keeps track of how many references in each
164+
// reference group were scanned.
165+
ReferenceGroups map[RefGroupSymbol]*counts.Count32 `json:"reference_groups"`
166+
163167
// The maximum TreeSize in the analyzed history (where each
164168
// attribute is maximized separately).
165169

@@ -290,5 +294,11 @@ func (s *HistorySize) recordReference(g *Graph, ref git.Reference) {
290294
}
291295

292296
func (s *HistorySize) recordReferenceGroup(g *Graph, group RefGroupSymbol) {
293-
// FIXME
297+
c, ok := s.ReferenceGroups[group]
298+
if ok {
299+
c.Increment(1)
300+
} else {
301+
n := counts.Count32(1)
302+
s.ReferenceGroups[group] = &n
303+
}
294304
}

0 commit comments

Comments
 (0)