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

Function main

scripts/jcode_memory_snapshot.py:233–256  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

231
232
233def main() -> int:
234 args = parse_args()
235 procs = list(iter_jcode_processes(args.socket, args.include_aux))
236 server = [p for p in procs if p.role == "server"]
237 clients = [p for p in procs if p.role.startswith("client_") and p.role != "client_aux"]
238 aux = [p for p in procs if p.role.endswith("aux")]
239
240 if args.json:
241 payload = {
242 "socket": args.socket,
243 "server": [asdict(p) for p in sorted(server, key=lambda x: x.pid)],
244 "clients": [asdict(p) for p in sorted(clients, key=lambda x: x.pid)],
245 "auxiliary": [asdict(p) for p in sorted(aux, key=lambda x: x.pid)],
246 "totals": {
247 "server": asdict(sum_totals(server)),
248 "clients": asdict(sum_totals(clients)),
249 "primary": asdict(sum_totals(server + clients)),
250 "auxiliary": asdict(sum_totals(aux)),
251 },
252 }
253 print(json.dumps(payload, indent=2))
254 else:
255 print_human(server, clients, aux)
256 return 0
257
258
259if __name__ == "__main__":

Callers 1

Calls 4

iter_jcode_processesFunction · 0.85
sum_totalsFunction · 0.85
parse_argsFunction · 0.70
print_humanFunction · 0.70

Tested by

no test coverage detected