diff options
author | SeongJae Park <sj38.park@gmail.com> | 2024-03-31 09:39:12 -0700 |
---|---|---|
committer | SeongJae Park <sj38.park@gmail.com> | 2024-03-31 09:46:35 -0700 |
commit | 6a5f2d75d9ccc252be394809e90438f29d082bf8 (patch) | |
tree | 95d93eb1a7261aa4eab642884aafb349144ad1b8 | |
parent | 880d6ec55454ce308b01ba7e15ac0c2e79ab4018 (diff) | |
download | damo-6a5f2d75d9ccc252be394809e90438f29d082bf8.tar.gz |
damo_record: Implement a class for memory foontprints recording
Implement a class for extending 'damo record' to further record memory
footprints. At the moment, it uses '/proc/<pid>/statm' files.
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
-rw-r--r-- | damo_record.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/damo_record.py b/damo_record.py index d5fb6e2d..8abdd8aa 100644 --- a/damo_record.py +++ b/damo_record.py @@ -62,6 +62,16 @@ def handle_args(args): print(err) exit(-3) +class MemFootprintsSnapshot: + time = None + pid_statms = {} + + def __init__(self, pids): + self.time = time.time() + for pid in pids: + with open('/proc/%s/statm' % pid, 'r') as f: + self.pid_statms[pid] = f.read() + def pid_running(pid): '''pid should be string''' try: |