aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeongJae Park <sj38.park@gmail.com>2024-03-31 10:08:53 -0700
committerSeongJae Park <sj38.park@gmail.com>2024-03-31 10:08:53 -0700
commit32e56d12d268c4148a67c1f045a8790f2aa44a16 (patch)
tree541de07fb35ea3189359b6cbf94708faeb5fe695
parent3978df3415859da3d2cd2e30976088d67759b317 (diff)
downloaddamo-32e56d12d268c4148a67c1f045a8790f2aa44a16.tar.gz
damo_record: Respect args.output_permission for memory footprint file
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
-rw-r--r--damo_record.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/damo_record.py b/damo_record.py
index 89a09e46..21d4259c 100644
--- a/damo_record.py
+++ b/damo_record.py
@@ -147,9 +147,10 @@ def record_mem_footprint(kdamonds, snapshots):
pids.append(target.pid)
snapshots.append(MemFootprintsSnapshot(pids))
-def save_mem_footprint(snapshots, filepath):
+def save_mem_footprint(snapshots, filepath, file_permission):
with open(filepath, 'w') as f:
json.dump([s.to_kvpairs() for s in snapshots], f, indent=4)
+ os.chmod(filepath, file_permission)
def main(args):
global data_for_cleanup
@@ -204,7 +205,8 @@ def main(args):
time.sleep(1)
if args.footprint:
- save_mem_footprint(footprint_snapshots, '%s.mem_footprint' % args.out)
+ save_mem_footprint(footprint_snapshots, '%s.mem_footprint' % args.out,
+ args.output_permission)
_damon.wait_kdamonds_turned_off()