MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / parse_census

Function parse_census

scripts/memlab-report.py:81–94  ·  view source on GitHub ↗

Pull the pool totals out of mem.census log lines.

(path)

Source from the content-addressed store, hash-verified

79
80
81def parse_census(path):
82 """Pull the pool totals out of mem.census log lines."""
83 fields = ("priv_kb", "rss_kb", "crt_kb", "biggest_kb")
84 rows = []
85 pattern = re.compile(r"(\w+)=(\S+)")
86 with open(path, "r", errors="replace") as handle:
87 for line in handle:
88 if "mem.census" not in line:
89 continue
90 kv = dict(pattern.findall(line))
91 if not any(f in kv for f in fields):
92 continue
93 rows.append({f: int(kv[f]) for f in fields if f in kv and kv[f].isdigit()})
94 return rows
95
96
97def report(path, census_path, top, binary=None):

Callers 1

reportFunction · 0.85

Calls 1

openFunction · 0.50

Tested by

no test coverage detected