From 0436dfbb947f8dfa5d804cd6ffe1d128ebbe003f Mon Sep 17 00:00:00 2001 From: pmf Date: Wed, 13 Aug 2008 15:41:32 +0000 Subject: [PATCH] java_speed_test: adjust trace sizes git-svn-id: http://ltt.polymtl.ca/svn@3010 04897980-b3bd-0310-b5e0-8ef037075253 --- .../java_speed_test/bench/bench.py | 68 ++++++++++++------- .../masters-pmf/java_speed_test/make_trace.sh | 6 +- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/trunk/masters-pmf/java_speed_test/bench/bench.py b/trunk/masters-pmf/java_speed_test/bench/bench.py index 08c4a118..5e61b2cb 100644 --- a/trunk/masters-pmf/java_speed_test/bench/bench.py +++ b/trunk/masters-pmf/java_speed_test/bench/bench.py @@ -1,3 +1,7 @@ +import os +import stat +import time + runs=10 class Task: @@ -6,57 +10,75 @@ class Task: cmd = "" post_cmd = "" results = 0 - remain = 1 + remain = 3 def __init__(self): self.results = [] + def print_extra_details(self): + pass + + +class JavaTestTask(Task): + tracefile = "" + + def print_extra_details(self): + size = os.stat(self.tracefile)[stat.ST_SIZE] + tot_events = size / 22 + print "Tracefile: %s (%d bytes)" % (self.tracefile,size) + print "Events in tracefile: %d" % tot_events + print "Rate: " + str(round(float(tot_events) / self.average_run_time, 3)) + " events/s" + + tasks = [] -t1 = Task() +t1 = JavaTestTask() t1.name = "C version (without print)" +t1.tracefile = "../trace_long.dat" t1.pre_cmd = "" -t1.cmd = "pushd ../c >/dev/null; ./main; popd >/dev/null;" +t1.cmd = "pushd ../c >/dev/null; ./main %s; popd >/dev/null;" % t1.tracefile t1.post_cmd = "" tasks.append(t1) -t3 = Task() +t3 = JavaTestTask() t3.name = "C version (with print)" +t3.tracefile = "../trace_med.dat" t3.pre_cmd = "" -t3.cmd = "pushd ../c >/dev/null; ./main -p; popd >/dev/null;" +t3.cmd = "pushd ../c >/dev/null; ./main -p %s; popd >/dev/null;" % t3.tracefile t3.post_cmd = "" -#tasks.append(t3) +tasks.append(t3) -t5 = Task() +t5 = JavaTestTask() t5.name = "C version (with print, but sent to /dev/null)" +t5.tracefile = "../trace_long.dat" t5.pre_cmd = "" -t5.cmd = "pushd ../c >/dev/null; ./main -p >/dev/null; popd >/dev/null;" +t5.cmd = "pushd ../c >/dev/null; ./main -p %s >/dev/null; popd >/dev/null;" % t5.tracefile t5.post_cmd = "" -#tasks.append(t5) +tasks.append(t5) -t2 = Task() +t2 = JavaTestTask() t2.name = "Java version (without print)" +t2.tracefile = "../trace_med.dat" t2.pre_cmd = "" -t2.cmd = "pushd ../java >/dev/null; java read_trace; popd >/dev/null;" +t2.cmd = "pushd ../java >/dev/null; java read_trace %s; popd >/dev/null;" % t2.tracefile t2.post_cmd = "" tasks.append(t2) -t4 = Task() +t4 = JavaTestTask() t4.name = "Java version (with print)" +t4.tracefile = "../trace_short.dat" t4.pre_cmd = "" -t4.cmd = "pushd ../java >/dev/null; java read_trace -p; popd >/dev/null;" +t4.cmd = "pushd ../java >/dev/null; java read_trace -p %s; popd >/dev/null;" % t4.tracefile t4.post_cmd = "" -#tasks.append(t4) +tasks.append(t4) -t6 = Task() +t6 = JavaTestTask() t6.name = "Java version (with print, but sent to /dev/null)" +t6.tracefile = "../trace_med.dat" t6.pre_cmd = "" -t6.cmd = "pushd ../java >/dev/null; java read_trace -p >/dev/null; popd >/dev/null;" +t6.cmd = "pushd ../java >/dev/null; java read_trace -p %s >/dev/null; popd >/dev/null;" % t6.tracefile t6.post_cmd = "" -#tasks.append(t6) - -import os -import time +tasks.append(t6) def average(lst): sum = 0 @@ -111,9 +133,9 @@ def main(): for task in tasks: print "RESULTS for " + task.name print "Runs: " + str(len(task.results)) - av = average(task.results) - print "Average run time: " + str(round(av, 3)) + " s" - print "Rate: " + str(round(1000000.0 / av, 3)) + " events/s" + task.average_run_time = average(task.results) + print "Average run time: " + str(round(task.average_run_time, 3)) + " s" + task.print_extra_details() #print "Min: " + str(round(min(task.results), 3)) #print "Max: " + str(round(max(task.results), 3)) print "" diff --git a/trunk/masters-pmf/java_speed_test/make_trace.sh b/trunk/masters-pmf/java_speed_test/make_trace.sh index 1f3ac6a0..1909ebd0 100644 --- a/trunk/masters-pmf/java_speed_test/make_trace.sh +++ b/trunk/masters-pmf/java_speed_test/make_trace.sh @@ -1,5 +1,5 @@ (for i in $(seq 1000); do cat basic_record.dat; done) >tmp.dat -(for i in $(seq 500); do cat tmp.dat; done) >tmp2.dat +(for i in $(seq 500); do cat tmp.dat; done) >trace_short.dat rm tmp.dat -(for i in $(seq 100); do cat tmp2.dat; done) >trace.dat -rm tmp2.dat +(for i in $(seq 10); do cat trace_short.dat; done) >trace_med.dat +(for i in $(seq 10); do cat trace_med.dat; done) >trace_long.dat -- 2.34.1