diff options
author | SeongJae Park <sj@kernel.org> | 2024-04-14 10:10:44 -0700 |
---|---|---|
committer | SeongJae Park <sj@kernel.org> | 2024-04-14 10:10:44 -0700 |
commit | 75207c8a21495e431a87e17abc1df25cef2818ca (patch) | |
tree | d865c09a43234235458088b04ca44db164d60185 | |
parent | 1e6486d02e58dc817107398c156c12e124a1db90 (diff) | |
download | damo-75207c8a21495e431a87e17abc1df25cef2818ca.tar.gz |
_damo_records: Implement a function for loading memory footprints from a record file
Signed-off-by: SeongJae Park <sj@kernel.org>
-rw-r--r-- | _damo_records.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/_damo_records.py b/_damo_records.py index 0e41b42d..5ffd0c8f 100644 --- a/_damo_records.py +++ b/_damo_records.py @@ -601,6 +601,11 @@ def save_mem_footprint(snapshots, filepath, file_permission): json.dump([s.to_kvpairs() for s in snapshots], f, indent=4) os.chmod(filepath, file_permission) +def load_mem_footprint(filepath): + with open(filepath, 'r') as f: + kvpairs = json.load(f) + return [MemFootprintsSnapshot.from_kvpairs(x) for x in kvpairs] + # record-polling def pid_running(pid): |