aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeongJae Park <sj38.park@gmail.com>2024-03-31 10:09:52 -0700
committerSeongJae Park <sj38.park@gmail.com>2024-03-31 10:09:52 -0700
commitb8dbe8c438d2196a12149ac6ab0d6c625731c29d (patch)
tree3b2b422da5ce50149cd911f3611298a5851f5510
parent32e56d12d268c4148a67c1f045a8790f2aa44a16 (diff)
downloaddamo-b8dbe8c438d2196a12149ac6ab0d6c625731c29d.tar.gz
damo_record: Put MemFootprintsSnapshot just before user
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
-rw-r--r--damo_record.py32
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: