Permalink
Browse files

Report on virtual memory used by the osh-runtime benchmarks.

  • Loading branch information...
Andy Chu
Andy Chu committed Dec 5, 2017
1 parent 745843e commit 07b0119b2571da97ae23c5e86a608534be7ee925
Showing with 54 additions and 24 deletions.
  1. +7 −18 benchmarks/osh-runtime.sh
  2. +18 −5 benchmarks/report.R
  3. +29 −1 benchmarks/virtual_memory.py
View
@@ -246,6 +246,11 @@ stage1() {
# Just copy for now
cp -v $raw_dir/*.times.csv $out_dir/times.csv
local vm_csv=$out_dir/virtual-memory.csv
local -a x=($raw_dir/lisa.*.virtual-memory)
benchmarks/virtual_memory.py osh-runtime ${x[-1]} > $vm_csv
#local raw_dir=${1:-../benchmark-data/osh-parser}
}
@@ -288,9 +293,9 @@ EOF
cat <<EOF
<h3>Memory Used to Run</h3>
<p>For <code>osh-ovm</code>.</p>
<p>Running under <code>osh-ovm</code>.</p>
EOF
#web/table/csv2html.py $in_dir/virtual-memory.csv
web/table/csv2html.py $in_dir/virtual-memory.csv
cat <<EOF
@@ -299,22 +304,6 @@ EOF
csv2html $in_dir/shells.csv
csv2html $in_dir/hosts.csv
cat <<EOF
<h3>Raw Data</h3>
EOF
#web/table/csv2html.py $in_dir/raw-data.csv
cat <<EOF
<h3>Parse Time Breakdown by File</h3>
<h4>Elasped Time in milliseconds</h4>
EOF
#web/table/csv2html.py $in_dir/elapsed.csv
cat <<EOF
<h4>Parsing Rate in lines/millisecond</h4>
EOF
#web/table/csv2html.py $in_dir/rate.csv
cat <<EOF
</body>
</html>
View
@@ -227,6 +227,7 @@ WriteDetails = function(distinct_hosts, distinct_shells, out_dir) {
RuntimeReport = function(in_dir, out_dir) {
times = read.csv(file.path(in_dir, 'times.csv'))
vm = read.csv(file.path(in_dir, 'virtual-memory.csv'))
times %>% filter(status != 0) -> failed
if (nrow(failed) != 0) {
@@ -267,14 +268,26 @@ RuntimeReport = function(in_dir, out_dir) {
print(summary(times))
print(head(times))
Log('VM:')
print(vm)
# This is a separate analysis. We record virtual memory for both the parser
# and runtime. The parser takes all the memory, which is not too surprising.
vm %>%
filter(shell_name == 'osh') %>%
select(-c(shell_name, shell_hash)) %>%
mutate(mem_name = paste(metric_name, event, sep = '_')) %>%
select(-c(metric_name, event)) %>%
spread(key = c(mem_name), value = metric_value) ->
vm
Log('VM:')
print(vm)
WriteDetails(distinct_hosts, distinct_shells, out_dir)
writeCsv(times, file.path(out_dir, 'times'))
writeCsv(vm, file.path(out_dir, 'virtual-memory'))
#lines = read.csv(file.path(in_dir, 'lines.csv'))
#raw_data = read.csv(file.path(in_dir, 'raw-data.csv'))
#vm = read.csv(file.path(in_dir, 'virtual-memory.csv'))
#writeCsv(host_table, file.path(out_dir, 'hosts'))
Log('Wrote %s', out_dir)
}
@@ -63,8 +63,36 @@ def main(argv):
row = (host, shell_name, shell_hash, filename, name, value)
out.writerow(row)
elif action == 'osh-runtime':
# NOTE: This is mostly a copy/paste of osh-parser.
input_dirs = argv[2:]
out = csv.writer(sys.stdout)
HEADER = (
'host', 'shell_name', 'shell_hash', 'task_arg', 'event', '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, task_arg, event = 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, task_arg, event, name,
value)
out.writerow(row)
else:
raise RuntimeError('Invalid action')
raise RuntimeError('Invalid action %r' % action)

0 comments on commit 07b0119

Please sign in to comment.