[Assorted-commits] SF.net SVN: assorted:[1159] container-bench/trunk
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-02-03 22:15:46
|
Revision: 1159 http://assorted.svn.sourceforge.net/assorted/?rev=1159&view=rev Author: yangzhang Date: 2009-02-03 22:15:39 +0000 (Tue, 03 Feb 2009) Log Message: ----------- - polished up analysis tools - added runner script - renamed scan -> init - updated README Modified Paths: -------------- container-bench/trunk/README container-bench/trunk/src/bench.cc container-bench/trunk/tools/analysis.py Added Paths: ----------- container-bench/trunk/tools/runner.bash Modified: container-bench/trunk/README =================================================================== --- container-bench/trunk/README 2009-02-03 20:18:52 UTC (rev 1158) +++ container-bench/trunk/README 2009-02-03 22:15:39 UTC (rev 1159) @@ -19,6 +19,15 @@ Analysis tools requirements: -- [Matplotlib] 0.98.3 +- [Matplotlib] 0.98.5.2 + - due to [this bug](http://article.gmane.org/gmane.comp.python.matplotlib.general/14474) [Matplotlib]: http://matplotlib.sf.net/ + +Usage +----- + +Run: + + tools/runner.bash # Builds, runs, and creates `log` file. + tools/analysis.py < log # Create `results.png`. Modified: container-bench/trunk/src/bench.cc =================================================================== --- container-bench/trunk/src/bench.cc 2009-02-03 20:18:52 UTC (rev 1158) +++ container-bench/trunk/src/bench.cc 2009-02-03 22:15:39 UTC (rev 1159) @@ -29,7 +29,7 @@ template<typename T> inline void -scan(T &m, const string &label) +iter(T &m, const string &label) { long long start = current_time_millis(); typedef pair<int, int> pii; @@ -45,7 +45,6 @@ index(T &m, const string &label) { long long start = current_time_millis(); - typedef pair<int, int> pii; for (int i = 0; i < len; i++) { xs[i] = m[i]; } @@ -67,7 +66,7 @@ map<int, int> m; load(m, "map init"); load(m, "map reload"); - scan(m, "map scan"); + iter(m, "map iter"); index(m, "map index"); } if (mode & 0x2) { @@ -75,14 +74,14 @@ btree_map<int, int> m; load(m, "btree init"); load(m, "btree reload"); - scan(m, "btree scan"); + iter(m, "btree iter"); index(m, "btree index"); } if (mode & 0x4) { unordered_map<int, int> m; load(m, "hash init"); load(m, "hash reload"); - scan(m, "hash scan"); + iter(m, "hash iter"); index(m, "hash index"); } if (mode & 0x8) { Modified: container-bench/trunk/tools/analysis.py =================================================================== --- container-bench/trunk/tools/analysis.py 2009-02-03 20:18:52 UTC (rev 1158) +++ container-bench/trunk/tools/analysis.py 2009-02-03 22:15:39 UTC (rev 1159) @@ -1,22 +1,52 @@ #!/usr/bin/env python from __future__ import with_statement -import sys +import sys, itertools, colorsys from pylab import * +# Parse the data. pairs = ( line.split(': ') for line in sys.stdin if ': ' in line ) -pairs = [ (a, int(b.split()[0])) for (a,b) in pairs ] +pairs = sorted( (a, int(b.split()[0])) for (a,b) in pairs ) -labels, data = zip(*pairs) -xs = arange(len(data))+.5 +# Aggregate the data. +def f(): + for key, group in itertools.groupby(pairs, lambda (a,b): a): + print key + a = array([b for a,b in group]) + yield key, a.mean(), a.std() + +# Sort the data into groups (based on type of operation). +pairs = sorted(f(), key = lambda tup: tup[0].split()[-1]) +groups = map(lambda (key, group): (key, list(group)), itertools.groupby(pairs, lambda tup: tup[0].split()[-1])) + +# Prepare plotting data. +labels, means, sds = zip(*pairs) +xs = arange(len(labels))+.5 width = .5 -bar(xs, data, width = width) +# Prepare plotting parameters. +step = 1.0 / len(groups) +colors = ( colorsys.hls_to_rgb(step * i, .7, .5) for i in itertools.count() ) +ecolors = ( colorsys.hls_to_rgb(step * i, .3, .5) for i in itertools.count() ) + +# Plot! +start = 0 +for key, group in groups: + stop = start + len(group) + bar(xs[start:stop], means[start:stop], yerr = sds[start:stop], width = width) # , +# color = colors.next(), edgecolor = ecolors.next()) + start = stop + +# Annotate. +title("Performance of associative containers") +ylabel("Time (ms)") xlim(0, xs[-1] + width*2) xticks(xs + width/2, labels, rotation = 90) -title("Performance of associative containers") -# show only bottom/left ticks +# Make space for the vertically rotated labels. +gcf().subplots_adjust(bottom = .3) +# Show only bottom/left ticks. gca().get_xaxis().tick_bottom() gca().get_yaxis().tick_left() +# Output. savefig('results.png') Added: container-bench/trunk/tools/runner.bash =================================================================== --- container-bench/trunk/tools/runner.bash (rev 0) +++ container-bench/trunk/tools/runner.bash 2009-02-03 22:15:39 UTC (rev 1159) @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset + +src="$(dirname "$0")/../src" + +make -C "$src/" + +for i in 1 2 4 8 ; do + LD_PRELOAD="$src/../../../sandbox/trunk/src/nix/preload/interposer.so" \ + "$src/bench" $i +done > log Property changes on: container-bench/trunk/tools/runner.bash ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |