Permalink
Please sign in to comment.
Browse files
Incorporate virtual memory measurements into the osh-parser benchmark.
- Added stage1: - csv_concat.py to prepare times data - virtual_memory.py to parse saved /proc/$PID/status - The R code in stage2 is now simpler. - dplyr is awesome for manipulating VM data, very concise! - Display virtual memory in the HTML report. 37 - 214 MB! Also: make a CSV for vm-baseline using virtual_memory.py. Not published yet.
- Loading branch information...
Showing
with
292 additions
and 57 deletions.
- +58 −38 benchmarks/osh-parser.R
- +76 −19 benchmarks/osh-parser.sh
- +14 −0 benchmarks/virtual-memory.sh
- +75 −0 benchmarks/virtual_memory.py
- +34 −0 tools/csv-concat-test.sh
- +35 −0 tools/csv_concat.py
| @@ -0,0 +1,75 @@ | ||
| #!/usr/bin/python | ||
| """ | ||
| virtual_memory.py | ||
| """ | ||
| import csv | ||
| import os | ||
| import sys | ||
| import re | ||
| # VmSize, VmData might be interesting too. | ||
| METRIC_RE = re.compile('^(VmPeak|VmRSS):\s*(\d+)') | ||
| def main(argv): | ||
| action = argv[1] | ||
| if action == 'baseline': | ||
| input_dirs = argv[2:] | ||
| out = csv.writer(sys.stdout) | ||
| out.writerow( | ||
| ('host', 'shell_name', 'shell_hash', 'metric_name', 'metric_value')) | ||
| for input_dir in input_dirs: | ||
| d = os.path.basename(input_dir) | ||
| host, job_id = d.split('.') | ||
| for name in os.listdir(input_dir): | ||
| n, _ = os.path.splitext(name) | ||
| shell_name, shell_hash = n.split('-') | ||
| path = os.path.join(input_dir, name) | ||
| with open(path) as f: | ||
| for line in f: | ||
| m = METRIC_RE.match(line) | ||
| if m: | ||
| name, value = m.groups() | ||
| row = (host, shell_name, shell_hash, name, value) | ||
| out.writerow(row) | ||
| elif action == 'osh-parser': | ||
| input_dirs = argv[2:] | ||
| out = csv.writer(sys.stdout) | ||
| HEADER = ( | ||
| 'host', 'shell_name', 'shell_hash', 'filename', 'metric_name', | ||
| 'metric_value') | ||
| out.writerow(HEADER) | ||
| for input_dir in input_dirs: | ||
| d = os.path.basename(input_dir) | ||
| host, job_id, _ = d.split('.') | ||
| for name in os.listdir(input_dir): | ||
| n, _ = os.path.splitext(name) | ||
| shell_id, filename = n.split('__') | ||
| shell_name, shell_hash = shell_id.split('-') | ||
| path = os.path.join(input_dir, name) | ||
| with open(path) as f: | ||
| for line in f: | ||
| m = METRIC_RE.match(line) | ||
| if m: | ||
| name, value = m.groups() | ||
| row = (host, shell_name, shell_hash, filename, name, value) | ||
| out.writerow(row) | ||
| else: | ||
| raise RuntimeError('Invalid action') | ||
| if __name__ == '__main__': | ||
| try: | ||
| main(sys.argv) | ||
| except RuntimeError as e: | ||
| print >>sys.stderr, 'FATAL: %s' % e | ||
| sys.exit(1) |
Oops, something went wrong.
0 comments on commit
371c3cd