MCPcopy Create free account
hub / github.com/DataDrake/proc-maps / parseRow

Function parseRow

data/parser.go:85–110  ·  view source on GitHub ↗
(line []byte, entries EntryMap)

Source from the content-addressed store, hash-verified

83}
84
85func parseRow(line []byte, entries EntryMap) {
86 raw := rowMatch.FindStringSubmatch(string(line))
87 // IF the line matches and isn't the root Device ID
88 if raw != nil && (raw[5] != "00:00") {
89 // Generate Key <DeviceID>:<Inode>
90 key := raw[5] + ":" + raw[6]
91 // If key already exists
92 if entry := entries[key]; entry != nil {
93 if size := entry.Sizes[raw[3]]; size != nil {
94 size.Refs++
95 entry.Weight += size.Size
96 } else {
97 entry.Increment(raw[1], raw[2], raw[3])
98 }
99 } else {
100 // Create new entry
101 entry := &FileEntry{
102 Name: raw[7],
103 Sizes: make(map[string]*SizeEntry),
104 }
105 entry.Increment(raw[1], raw[2], raw[3])
106 // Store new Entry
107 entries[key] = entry
108 }
109 }
110}

Callers 1

ParseMapFunction · 0.85

Calls 1

IncrementMethod · 0.95

Tested by

no test coverage detected