| 51 | |
| 52 | |
| 53 | def parse_args() -> argparse.Namespace: |
| 54 | p = argparse.ArgumentParser(description="Summarize jcode server/client process memory using smaps_rollup") |
| 55 | p.add_argument("--json", action="store_true", help="Print JSON instead of a human summary") |
| 56 | p.add_argument( |
| 57 | "--include-aux", |
| 58 | action="store_true", |
| 59 | help="Include non-default-socket helper/test jcode processes in the output", |
| 60 | ) |
| 61 | p.add_argument( |
| 62 | "--socket", |
| 63 | default=DEFAULT_SOCKET, |
| 64 | help=f"Main jcode socket to treat as the primary instance (default: {DEFAULT_SOCKET})", |
| 65 | ) |
| 66 | return p.parse_args() |
| 67 | |
| 68 | |
| 69 | def read_text(path: Path, binary: bool = False) -> str | None: |