diff options
Diffstat (limited to 'damo_record.py')
-rw-r--r-- | damo_record.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/damo_record.py b/damo_record.py index 21d4259c..aaa50a2b 100644 --- a/damo_record.py +++ b/damo_record.py @@ -63,22 +63,6 @@ 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 to_kvpairs(self): - return { - 'time': self.time, - 'pid_statms': self.pid_statms - } - def pid_running(pid): '''pid should be string''' try: @@ -137,6 +121,22 @@ def poll_target_pids(kdamonds, add_childs): cleanup_exit(1) return True +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 to_kvpairs(self): + return { + 'time': self.time, + 'pid_statms': self.pid_statms + } + def record_mem_footprint(kdamonds, snapshots): pids = [] for kdamond in kdamonds: |