(main_socket: str, include_aux: bool)
| 156 | |
| 157 | |
| 158 | def iter_jcode_processes(main_socket: str, include_aux: bool) -> Iterable[ProcMem]: |
| 159 | for pid_dir in Path("/proc").iterdir(): |
| 160 | if not pid_dir.name.isdigit(): |
| 161 | continue |
| 162 | pid = int(pid_dir.name) |
| 163 | argv = read_argv(pid_dir / "cmdline") |
| 164 | if not argv: |
| 165 | continue |
| 166 | cmd = " ".join(argv) |
| 167 | if "jcode" not in cmd: |
| 168 | continue |
| 169 | role, is_main = classify_process(argv, cmd, main_socket) |
| 170 | if role is None: |
| 171 | continue |
| 172 | if not include_aux and not is_main and role not in {"server"}: |
| 173 | continue |
| 174 | smaps = parse_smaps_rollup(pid) |
| 175 | if not smaps: |
| 176 | continue |
| 177 | yield ProcMem( |
| 178 | pid=pid, |
| 179 | role=role, |
| 180 | cmd=cmd, |
| 181 | session_id=parse_session_id(cmd), |
| 182 | socket_path=parse_socket_path(cmd), |
| 183 | **smaps, |
| 184 | ) |
| 185 | |
| 186 | |
| 187 | def sum_totals(procs: list[ProcMem]) -> Totals: |
no test coverage detected