Permalink
Browse files

Generalize table row highlighting for the ovm-build benchmark.

Also, start merging TSVs that record file sizes.
  • Loading branch information...
Andy Chu
Andy Chu committed Feb 17, 2018
1 parent b2fe31d commit bc2de38b1b71e25d85524748edbd07b97e78b574
Showing with 67 additions and 32 deletions.
  1. +7 −2 benchmarks/common.sh
  2. +7 −7 benchmarks/osh-parser.sh
  3. +24 −8 benchmarks/ovm-build.sh
  4. +6 −5 benchmarks/report.R
  5. +1 −1 benchmarks/report.sh
  6. +1 −1 web/benchmarks.css
  7. +21 −8 web/table/csv2html.py
View
@@ -18,9 +18,14 @@ csv-concat() { tools/csv_concat.py "$@"; }
# TSV and CSV concatenation are actually the same. Just use the same script.
tsv-concat() { tools/csv_concat.py "$@"; }
csv2html() { web/table/csv2html.py "$@"; }
# For compatibility, if cell starts with 'osh', apply the 'special' CSS class.
csv2html() {
web/table/csv2html.py --css-class-pattern 'special ^osh' "$@";
}
tsv2html() { web/table/csv2html.py --tsv "$@"; }
tsv2html() {
web/table/csv2html.py --tsv "$@";
}
# Need an absolute path here.
readonly _time_tool=$PWD/benchmarks/time.py
View
@@ -219,39 +219,39 @@ print-report() {
<h3>Parse Time Summary</h3>
EOF
web/table/csv2html.py $in_dir/summary.csv
csv2html $in_dir/summary.csv
cat <<EOF
<h3>Memory Used to Parse</h3>
<p>Running under <code>osh-ovm</code>. Memory usage is measured in MB
(powers of 10), not MiB (powers of 2).</p>
EOF
web/table/csv2html.py $in_dir/virtual-memory.csv
csv2html $in_dir/virtual-memory.csv
cat <<EOF
<h3>Shell and Host Details</h3>
EOF
web/table/csv2html.py $in_dir/shells.csv
web/table/csv2html.py $in_dir/hosts.csv
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
csv2html $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
csv2html $in_dir/elapsed.csv
cat <<EOF
<h4>Parsing Rate in lines/millisecond</h4>
EOF
web/table/csv2html.py $in_dir/rate.csv
csv2html $in_dir/rate.csv
cat <<EOF
</body>
</html>
View
@@ -88,8 +88,10 @@ extract() {
# - zipfile.py to look inside bytecode.zip
sizes-tsv() {
echo $'num_bytes\tpath'
find "$@" -maxdepth 0 -printf $'%s\t%p\n'
# host_label matches the times.tsv file output by report.R
echo $'host_label\tnum_bytes\tpath'
local host=$(hostname)
find "$@" -maxdepth 0 -printf "$host\t%s\t%p\n"
}
# NOTE: This should be the same on all x64 machines. But I want to run it on
@@ -292,11 +294,24 @@ stage1() {
local out=$BASE_DIR/stage1
mkdir -p $out
local times_tsv=$out/times.tsv
local x
local -a a b
# Globs are in lexicographical order, which works for our dates.
local -a a=($raw_dir/flanders.*.times.tsv)
local -a b=($raw_dir/lisa.*.times.tsv)
tsv-concat ${a[-1]} ${b[-1]} > $times_tsv
x=$out/times.tsv
a=($raw_dir/flanders.*.times.tsv)
b=($raw_dir/lisa.*.times.tsv)
tsv-concat ${a[-1]} ${b[-1]} > $x
x=$out/bytecode-size.tsv
a=($raw_dir/flanders.*.bytecode-size.tsv)
b=($raw_dir/lisa.*.bytecode-size.tsv)
tsv-concat ${a[-1]} ${b[-1]} > $x
x=$out/bin-sizes.tsv
a=($raw_dir/flanders.*.bin-sizes.tsv)
b=($raw_dir/lisa.*.bin-sizes.tsv)
tsv-concat ${a[-1]} ${b[-1]} > $x
# Construct a one-column TSV file
local raw_data_tsv=$out/raw-data.tsv
@@ -335,7 +350,7 @@ print-report() {
for comparison.
</p>
EOF
tsv2html $in_dir/times.tsv
tsv2html --css-class-pattern 'special ^oil' $in_dir/times.tsv
cat <<EOF
<h3>Binary Size</h3>
@@ -348,7 +363,8 @@ EOF
</p>
EOF
#csv2html $in_dir/virtual-memory.csv
tsv2html $in_dir/bytecode-size.tsv
tsv2html $in_dir/bin-sizes.tsv
cat <<EOF
View
@@ -378,18 +378,15 @@ WriteOvmBuildDetails = function(distinct_hosts, distinct_compilers, out_dir) {
OvmBuildReport = function(in_dir, out_dir) {
times = readTsv(file.path(in_dir, 'times.tsv'))
bytecode_size = readTsv(file.path(in_dir, 'bytecode-size.tsv'))
bin_sizes = readTsv(file.path(in_dir, 'bin-sizes.tsv'))
raw_data = readTsv(file.path(in_dir, 'raw-data.tsv'))
times %>% filter(status != 0) -> failed
if (nrow(failed) != 0) {
print(failed)
stop('Some ovm-build tasks failed')
}
#print(vm)
#times %>%
# arrange(host, VmPeak_MB) ->
# vm
times %>% distinct(host_name, host_hash) -> distinct_hosts
distinct_hosts$host_label = distinct_hosts$host_name
@@ -414,6 +411,10 @@ OvmBuildReport = function(in_dir, out_dir) {
#print(times)
# NOTE: These don't have the host and compiler.
writeTsv(bytecode_size, file.path(out_dir, 'bytecode-size'))
writeTsv(bin_sizes, file.path(out_dir, 'bin-sizes'))
writeTsv(times, file.path(out_dir, 'times'))
# TODO: I want a size report too
View
@@ -94,7 +94,7 @@ all() {
# For view
dev-index() {
local out=_tmp/benchmarks.html
for name in osh-parser osh-runtime vm-baseline oheap; do
for name in osh-parser osh-runtime vm-baseline ovm-build oheap; do
echo "<a href=\"$name/index.html\">$name</a> <br/>"
done > $out
log "Wrote $out"
View
@@ -30,6 +30,6 @@ h3, h4 {
background-color: oldlace;
}
/* rows */
.osh-row {
.special {
background-color: oldlace;
}
View
@@ -39,6 +39,7 @@
import csv
import optparse
import os
import re
import sys
@@ -224,7 +225,14 @@ def PrintColGroup(col_names, schema):
print ' </colgroup>'
def PrintTable(css_id, schema, col_names, rows):
def PrintTable(css_id, schema, col_names, rows, css_class_pattern):
if css_class_pattern:
css_class, r = css_class_pattern.split(None, 2)
cell_regex = re.compile(r)
else:
css_class = None
cell_regex = None
print '<table id="%s">' % css_id
print ' <thead>'
print ' <tr>'
@@ -244,12 +252,12 @@ def PrintTable(css_id, schema, col_names, rows):
# TODO: There should be a special column called CSS_CLASS. Output that
# from R.
for cell in row:
if cell.startswith('osh'):
row_class = 'class="osh-row"'
break
else:
row_class = ''
row_class = ''
if cell_regex:
for cell in row:
if cell_regex.match(cell):
row_class = 'class="%s"' % css_class
break
print ' <tr {}>'.format(row_class)
@@ -292,6 +300,11 @@ def CreateOptionsParser():
p.add_option(
'--tsv', dest='tsv', default=False, action='store_true',
help='Read input in TSV format')
p.add_option(
'--css-class-pattern', dest='css_class_pattern', type='str',
help='A string of the form CSS_CLASS:PATTERN. If the cell contents '
'matches the pattern, then apply the given CSS class. '
'Example: osh:^osh')
return p
@@ -344,7 +357,7 @@ def main(argv):
filename = os.path.basename(csv_path)
css_id, _ = os.path.splitext(filename)
PrintTable(css_id, schema, col_names, rows)
PrintTable(css_id, schema, col_names, rows, opts.css_class_pattern)
if __name__ == '__main__':

0 comments on commit bc2de38

Please sign in to comment.