diff options
author | SeongJae Park <sj@kernel.org> | 2024-04-14 10:10:23 -0700 |
---|---|---|
committer | SeongJae Park <sj@kernel.org> | 2024-04-14 10:10:23 -0700 |
commit | 1e6486d02e58dc817107398c156c12e124a1db90 (patch) | |
tree | 25a1de651616069a5eeb76fb1c7c28bed21d497a | |
parent | 4af3ac28056104f2f215495e27469e708ca87f02 (diff) | |
download | damo-1e6486d02e58dc817107398c156c12e124a1db90.tar.gz |
_damo_records: Implement MemFootprintsSnapshot.from_kvpairs()
Signed-off-by: SeongJae Park <sj@kernel.org>
-rw-r--r-- | _damo_records.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/_damo_records.py b/_damo_records.py index 54f50ab5..0e41b42d 100644 --- a/_damo_records.py +++ b/_damo_records.py @@ -576,6 +576,16 @@ class MemFootprintsSnapshot: footprints.append({'pid': pid, 'footprint': fp.to_kvpairs()}) return {'time': self.time, 'footprints': footprints} + @classmethod + def from_kvpairs(cls, kvpairs): + self = cls() + self.time = kvpairs['time'] + self.footprints = {} + for fp in kvpairs['footprints']: + pid, footprint = fp['pid'], fp['footprint'] + self.footprints[pid] = MemFootprint.from_kvpairs(footprint) + return self + def record_mem_footprint(kdamonds, snapshots): pids = [] for kdamond in kdamonds: |