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

Function current

scripts/memwaste-ratchet.py:43–55  ·  view source on GitHub ↗
(out_dir: str)

Source from the content-addressed store, hash-verified

41
42
43def current(out_dir: str) -> dict:
44 report = json.load(open(os.path.join(out_dir, "memwaste.json")))
45 index = json.load(open(os.path.join(out_dir, "index.json")))
46 nodes = int(index.get("nodes") or 0)
47 if nodes <= 0:
48 sys.exit("memwaste-ratchet: index.json has no node count")
49 # The index worker is the process that allocated the most.
50 worker = max(report["processes"].values(), key=lambda p: p["header"].get("usable_bytes", 0))
51 summary = worker["summary"]
52 return {
53 "nodes": nodes,
54 "per_1k_nodes": {c: round(summary.get(c, 0) * 1000.0 / nodes, 3) for c in CLASSES},
55 }
56
57
58def main() -> int:

Callers 1

mainFunction · 0.70

Calls 4

loadMethod · 0.80
getMethod · 0.65
openFunction · 0.50
roundFunction · 0.50

Tested by

no test coverage detected