File: memory_analysis.py

package info (click to toggle)
fastdds 3.3.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 60,540 kB
  • sloc: cpp: 793,735; xml: 15,283; python: 5,902; sh: 219; makefile: 95; ansic: 12
file content (16 lines) | stat: -rw-r--r-- 483 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import sys
import msparser
import csv

stack = []
heap = []
msparser_data = msparser.parse_file(sys.argv[1])
for snapshot in msparser_data['snapshots']:
    if snapshot['mem_heap'] != 0:
        stack.append(snapshot['mem_stack'])
        heap.append(snapshot['mem_heap'])

with open(sys.argv[2], 'w+') as csv_file:
    csv_writer = csv.writer(csv_file, delimiter=',', quoting=csv.QUOTE_ALL)
    csv_writer.writerow(['stack', 'heap'])
    csv_writer.writerow([max(stack), max(heap)])