diff options
author | SeongJae Park <sj38.park@gmail.com> | 2024-03-31 10:21:10 -0700 |
---|---|---|
committer | SeongJae Park <sj38.park@gmail.com> | 2024-03-31 10:21:10 -0700 |
commit | 548285aa643f56a43747cca129e916d8692cab15 (patch) | |
tree | 511fc792670c9a89583c6d8832c02b7b77e55f5f | |
parent | 2598d644b0b5c224487a5a1a60c395b11edbd0e7 (diff) | |
download | damo-548285aa643f56a43747cca129e916d8692cab15.tar.gz |
damo_record: Use MemFootprint class
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
-rw-r--r-- | damo_record.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/damo_record.py b/damo_record.py index d43e80ad..99338adb 100644 --- a/damo_record.py +++ b/damo_record.py @@ -148,19 +148,19 @@ class MemFootprint: class MemFootprintsSnapshot: time = None - pid_statms = {} + footprints = None def __init__(self, pids): self.time = time.time() + self.footprints = {} for pid in pids: - with open('/proc/%s/statm' % pid, 'r') as f: - self.pid_statms[pid] = f.read() + self.footprints[pid] = MemFootprint(pid) def to_kvpairs(self): - return { - 'time': self.time, - 'pid_statms': self.pid_statms - } + footprints = [] + for pid, fp in self.footprints.items(): + footprints.append({'pid': pid, 'footprint': fp.to_kvpairs()}) + return {'time': self.time, 'footprints': footprints} def record_mem_footprint(kdamonds, snapshots): pids = [] |