diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2016-04-11 02:23:46 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2016-04-11 02:23:46 +0300 |
commit | 501af4707023c4c45183357711a24fbbfb865c78 (patch) | |
tree | e25f61680cfcbe4a973732012df2c03a1f67217e /scripts | |
parent | bc8bdf22e14294b55bb46167ea8987ab5933848f (diff) |
Add benchmark_locking runner script plus benchmarks for my laptop.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/benchmark_locking_matrix.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/benchmark_locking_matrix.py b/scripts/benchmark_locking_matrix.py index e69de29b..20745111 100644 --- a/scripts/benchmark_locking_matrix.py +++ b/scripts/benchmark_locking_matrix.py @@ -0,0 +1,41 @@ +#!/usr/bin/python3 + +benchmark_locking_path="../build/x64/Release/benchmark_locking" + +max_waiters = 8 +max_entities = 8 + +algorithms = [ "lock_files", "byte_ranges", "atomic_append" ] +algorithms += [ "!lock_files", "!byte_ranges", "!atomic_append" ] + +results = [] +for y in range(0, max_waiters): + result=[] + for x in range(0, max_entities): + result.append(0) + results.append(result) + +import os, subprocess + +with open("benchmark_locking_matrix.csv", "wt") as oh: + os.chdir(os.path.dirname(benchmark_locking_path)) + + for algorithm in algorithms: + for y in range(0, max_waiters): + for x in range(0, max_entities): + ph = subprocess.check_call(['benchmark_locking', algorithm, str(x+1), str(y+1)]) + with open("benchmark_locking.csv", "rt") as ih: + ih.readline() + results[y][x]=int(ih.readline()) + + oh.write(algorithm+'\n') + for x in range(0, max_entities): + oh.write(',"'+str(x+1)+' entities"') + oh.write('\n') + for y in range(0, max_waiters): + oh.write('"'+str(y+1)+' waiters"') + for x in range(0, max_entities): + oh.write(','+str(results[y][x])) + oh.write('\n') + oh.write('\n') + |