diff options
author | SeongJae Park <sj38.park@gmail.com> | 2024-03-31 09:47:29 -0700 |
---|---|---|
committer | SeongJae Park <sj38.park@gmail.com> | 2024-03-31 09:47:57 -0700 |
commit | 164d1e6b67f962c9a2c8d4a6c23645f5d8a23b6a (patch) | |
tree | bd07afa5ed804068f18ea7727403ec522f9cb4b3 | |
parent | 6a5f2d75d9ccc252be394809e90438f29d082bf8 (diff) | |
download | damo-164d1e6b67f962c9a2c8d4a6c23645f5d8a23b6a.tar.gz |
damo_record: Implement a method for converting MemFootprintsSnapshot to a dict
The method would be used for saving it in a file.
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
-rw-r--r-- | damo_record.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/damo_record.py b/damo_record.py index 8abdd8aa..5949631a 100644 --- a/damo_record.py +++ b/damo_record.py @@ -72,6 +72,12 @@ class MemFootprintsSnapshot: with open('/proc/%s/statm' % pid, 'r') as f: self.pid_statms[pid] = f.read() + def to_kvpairs(self): + return { + 'time': self.time, + 'pid_statms': self.pid_statms + } + def pid_running(pid): '''pid should be string''' try: |