Show the used memory
(explain, tref)
| 19 | |
| 20 | |
| 21 | def show_stats(explain, tref): |
| 22 | "Show the used memory" |
| 23 | for line in Path("/proc/self/status").read_text().splitlines(): |
| 24 | if line.startswith("VmSize:"): |
| 25 | vmsize = int(line.split()[1]) |
| 26 | elif line.startswith("VmRSS:"): |
| 27 | vmrss = int(line.split()[1]) |
| 28 | elif line.startswith("VmData:"): |
| 29 | vmdata = int(line.split()[1]) |
| 30 | elif line.startswith("VmStk:"): |
| 31 | vmstk = int(line.split()[1]) |
| 32 | elif line.startswith("VmExe:"): |
| 33 | vmexe = int(line.split()[1]) |
| 34 | elif line.startswith("VmLib:"): |
| 35 | vmlib = int(line.split()[1]) |
| 36 | print("WallClock time:", clock() - tref) |
| 37 | print("Memory usage: ******* %s *******" % explain) |
| 38 | print(f"VmSize: {vmsize:>7} kB\tVmRSS: {vmrss:>7} kB") |
| 39 | print(f"VmData: {vmdata:>7} kB\tVmStk: {vmstk:>7} kB") |
| 40 | print(f"VmExe: {vmexe:>7} kB\tVmLib: {vmlib:>7} kB") |
| 41 | |
| 42 | |
| 43 | def check_open_close(): |
no outgoing calls
no test coverage detected