MCPcopy Create free account
hub / github.com/1jehuang/jcode / parse_smaps_rollup

Function parse_smaps_rollup

scripts/jcode_memory_snapshot.py:143–155  ·  view source on GitHub ↗
(pid: int)

Source from the content-addressed store, hash-verified

141
142
143def parse_smaps_rollup(pid: int) -> dict[str, float] | None:
144 path = Path(f"/proc/{pid}/smaps_rollup")
145 txt = read_text(path)
146 if not txt:
147 return None
148 out = {value: 0.0 for value in SMAPS_KEYS.values()}
149 for line in txt.splitlines():
150 for key, out_key in SMAPS_KEYS.items():
151 if line.startswith(f"{key}:"):
152 parts = line.split()
153 if len(parts) >= 2:
154 out[out_key] = round(int(parts[1]) / 1024.0, 1)
155 return out
156
157
158def iter_jcode_processes(main_socket: str, include_aux: bool) -> Iterable[ProcMem]:

Callers 1

iter_jcode_processesFunction · 0.85

Calls 5

PathClass · 0.85
read_textFunction · 0.85
valuesMethod · 0.80
itemsMethod · 0.80
splitMethod · 0.45

Tested by

no test coverage detected