Pull the pool totals out of mem.census log lines.
(path)
| 79 | |
| 80 | |
| 81 | def parse_census(path): |
| 82 | """Pull the pool totals out of mem.census log lines.""" |
| 83 | fields = ("priv_kb", "rss_kb", "crt_kb", "biggest_kb") |
| 84 | rows = [] |
| 85 | pattern = re.compile(r"(\w+)=(\S+)") |
| 86 | with open(path, "r", errors="replace") as handle: |
| 87 | for line in handle: |
| 88 | if "mem.census" not in line: |
| 89 | continue |
| 90 | kv = dict(pattern.findall(line)) |
| 91 | if not any(f in kv for f in fields): |
| 92 | continue |
| 93 | rows.append({f: int(kv[f]) for f in fields if f in kv and kv[f].isdigit()}) |
| 94 | return rows |
| 95 | |
| 96 | |
| 97 | def report(path, census_path, top, binary=None): |