Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ function run_test_env_cmd { # <test name> <allocator name> <environment args> <c
case "$1" in
redis*)
echo "start server"
$timecmd -a -o "$benchres.line" -f "$1${benchfill:${#1}} $2${allocfill:${#2}} %E %M %U %S %F %R" /usr/bin/env $3 $redis_dir/redis-server > "$outfile.server.txt" &
$timecmd -a -o "$benchres.line" -f "$1${benchfill:${#1}} $2${allocfill:${#2}} %e %M %U %S %F %R" /usr/bin/env $3 $redis_dir/redis-server > "$outfile.server.txt" &
sleep 1s
$redis_dir/redis-cli flushall
sleep 1s
Expand Down Expand Up @@ -605,7 +605,7 @@ function run_test_env_cmd { # <test name> <allocator name> <environment args> <c
done
;;
*)
$timecmd -a -o "$benchres.line" -f "$1${benchfill:${#1}} $2${allocfill:${#2}} %E %M %U %S %F %R" /usr/bin/env $3 $4 < "$infile" > "$outfile";;
$timecmd -a -o "$benchres.line" -f "$1${benchfill:${#1}} $2${allocfill:${#2}} %e %M %U %S %F %R" /usr/bin/env $3 $4 < "$infile" > "$outfile";;
esac

# fixup larson with relative time
Expand Down
79 changes: 79 additions & 0 deletions parse_results.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/python3
import sys
import os.path

def summarize(alloc):
print("{} TOTAL: {:.3}s CPU ovhd ({:>.2%}), {:>8.2f} MB MEM ovhd ({:>.2%})".format( \
alloc, \
cpu_total[alloc] - cpu_total['sys'], \
(cpu_total[alloc] - cpu_total['sys']) / cpu_total['sys'], \
(mem_total[alloc] - mem_total['sys'])/1024, \
(mem_total[alloc] - mem_total['sys']) / mem_total['sys']))

if len(sys.argv) < 2:
print("I need a file to parse!")
exit(1)

if not os.path.isfile(sys.argv[1]):
print("File not found:", sys.argv[1])
exit(1)

results = dict()

with open(sys.argv[1], 'r') as f:
for line in f:
line = line.split()
bench = line[0]
alloc = line[1]
time = line[2]
rss = line[3]
if bench not in results:
try:
results[bench] = {alloc : [1, float(time), float(rss)]}
except ValueError:
print("a line could not be parsed:\n", line, "assuming the next line is invalid")
print(next(f, None))
continue
else:
if alloc not in results[bench]:
try:
results[bench].update({alloc: [1, float(time), float(rss)]})
except ValueError:
print("a line could not be parsed:\n", line, "assuming the next line is invalid")
print(next(f, None))
continue
else:
results[bench][alloc][0] += 1
try:
results[bench][alloc][1] += float(time)
results[bench][alloc][2] += float(rss)
except ValueError:
print("a line could not be parsed:\n", line, "assuming the next line is invalid")
print(next(f, None))
continue
mem_total = dict()
cpu_total = dict()
for bench in results:
try:
baseline_cpu = results[bench]['sys'][1] / results[bench]['sys'][0]
baseline_mem = results[bench]['sys'][2] / results[bench]['sys'][0]
except KeyError:
print("sys not found in allocs for benchmark:", bench)
print(results[bench])
exit(1)
for alloc in results[bench]:
if alloc not in mem_total:
mem_total.update({alloc:0})
if alloc not in cpu_total:
cpu_total.update({alloc:0})
cpu = results[bench][alloc][1] / results[bench][alloc][0]
mem = results[bench][alloc][2] / results[bench][alloc][0]
mem_total[alloc] += mem
cpu_total[alloc] += cpu
# if alloc == 'sys':
# continue
print("{:>14}\t{}\tCPU {:>6.2f}s ovhd {:>7.2%} MEM {:>9.1f} kB ovhd {:>8.2%} ({:>8.2f}s, {:>8} kB)".format(bench, alloc, cpu, (cpu / baseline_cpu) - 1, mem, (mem / baseline_mem) - 1, cpu - baseline_cpu, int(mem - baseline_mem)))
for alloc in cpu_total:
if alloc == "sys":
continue
summarize(alloc)
Loading