From ce68a724efff87f2ec1f074221e215b7508b8baa Mon Sep 17 00:00:00 2001 From: pmf Date: Fri, 8 Aug 2008 06:23:23 +0000 Subject: [PATCH] updates to speed test git-svn-id: http://ltt.polymtl.ca/svn@2994 04897980-b3bd-0310-b5e0-8ef037075253 --- trunk/masters-pmf/java_speed_test/c/Makefile | 5 ++++- trunk/masters-pmf/java_speed_test/c/main.c | 10 ++++++++-- trunk/masters-pmf/java_speed_test/java/Makefile | 3 +++ trunk/masters-pmf/java_speed_test/java/read_trace.java | 6 ++---- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/trunk/masters-pmf/java_speed_test/c/Makefile b/trunk/masters-pmf/java_speed_test/c/Makefile index f0035b54..bb3d0195 100644 --- a/trunk/masters-pmf/java_speed_test/c/Makefile +++ b/trunk/masters-pmf/java_speed_test/c/Makefile @@ -1,5 +1,8 @@ main: main.c - gcc -o main -O3 main.c + gcc -o main -Wall -O3 main.c clean: rm main + +run: main.c + @./main diff --git a/trunk/masters-pmf/java_speed_test/c/main.c b/trunk/masters-pmf/java_speed_test/c/main.c index e7bac623..a45fc7bd 100644 --- a/trunk/masters-pmf/java_speed_test/c/main.c +++ b/trunk/masters-pmf/java_speed_test/c/main.c @@ -5,11 +5,16 @@ #include #include +#include -int main() +int main(int argc, char **argv) { int result; int fd; + int print = 0; + + if(argc >= 2 && !strcmp(argv[1], "-p")) + print = 1; result = fd = open("../trace.dat", O_RDONLY); if(result == -1) { @@ -57,7 +62,8 @@ int main() arg1 = *(unsigned short *)args; arg2 = args+2; - printf("timestamp %u id %hu args=(arg1=%hu arg2=\"%s\")\n", timestamp, id, arg1, arg2); + if(print) + printf("timestamp %lu id %hu args=(arg1=%hu arg2=\"%s\")\n", timestamp, id, arg1, arg2); free(args); } diff --git a/trunk/masters-pmf/java_speed_test/java/Makefile b/trunk/masters-pmf/java_speed_test/java/Makefile index 3bc3f132..9aee4c4f 100644 --- a/trunk/masters-pmf/java_speed_test/java/Makefile +++ b/trunk/masters-pmf/java_speed_test/java/Makefile @@ -1,2 +1,5 @@ read_trace.class: read_trace.java javac -source 1.5 read_trace.java + +run: read_trace.class + @java read_trace diff --git a/trunk/masters-pmf/java_speed_test/java/read_trace.java b/trunk/masters-pmf/java_speed_test/java/read_trace.java index 80a3bc17..99cab41d 100644 --- a/trunk/masters-pmf/java_speed_test/java/read_trace.java +++ b/trunk/masters-pmf/java_speed_test/java/read_trace.java @@ -36,9 +36,8 @@ public class read_trace { byte[] arg2 = new byte[strlen]; eargs_data.readFully(arg2, 0, strlen); - //System.out.printf("timestamp %d id %d args=(short=%d string=\"%s\") %n", timestamp, id, arg1, new String(arg2)); - String strout = String.format("timestamp %d id %d args=(short=%d string=\"%s\") %n", timestamp, id, arg1, new String(arg2)); - tmp += strout.length(); + if(args.length>0 && args[0].equals("-p")) + System.out.printf("timestamp %d id %d args=(short=%d string=\"%s\") %n", timestamp, id, arg1, new String(arg2)); } } @@ -48,6 +47,5 @@ public class read_trace { } //file_input.close(); - System.out.println(tmp); } } -- 2.34.1