(container: Container, prev: PrevStats, file: IO)
| 56 | |
| 57 | |
| 58 | def print_stats(container: Container, prev: PrevStats, file: IO) -> PrevStats: |
| 59 | proc = mz_proc(container) |
| 60 | memory = proc.memory_info() |
| 61 | cpu = proc.cpu_times() |
| 62 | new_prev = PrevStats(time.time(), cpu.user, cpu.system) |
| 63 | print( |
| 64 | f"{memory.rss},{memory.vms},{new_prev.user_cpu - prev.user_cpu},{new_prev.system_cpu - prev.system_cpu},{new_prev.wall_time - prev.wall_time}", |
| 65 | file=file, |
| 66 | flush=True, |
| 67 | ) |
| 68 | return new_prev |
| 69 | |
| 70 | |
| 71 | def main() -> None: |