updates to speed test
authorpmf <pmf@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 8 Aug 2008 06:23:23 +0000 (06:23 +0000)
committerpmf <pmf@04897980-b3bd-0310-b5e0-8ef037075253>
Fri, 8 Aug 2008 06:23:23 +0000 (06:23 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@2994 04897980-b3bd-0310-b5e0-8ef037075253

trunk/masters-pmf/java_speed_test/c/Makefile
trunk/masters-pmf/java_speed_test/c/main.c
trunk/masters-pmf/java_speed_test/java/Makefile
trunk/masters-pmf/java_speed_test/java/read_trace.java

index f0035b542cac97d647527929b28f58b60d75bbc5..bb3d0195aeae4929aae80a3d44859161ff436bb2 100644 (file)
@@ -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
index e7bac623d9b14ac641e15b5d6ea35555d1685b5f..a45fc7bd4120e3d825b5a28d630e96a8efd6ada3 100644 (file)
@@ -5,11 +5,16 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
-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);
        }
index 3bc3f132d716f054431e749ddfd9fc9ad8cc6fdf..9aee4c4f8186590049963b0b67e851f49f7fe808 100644 (file)
@@ -1,2 +1,5 @@
 read_trace.class: read_trace.java
        javac -source 1.5 read_trace.java
+
+run: read_trace.class
+       @java read_trace
index 80a3bc17cefc83438c1390cacd4ed8ad96a7896a..99cab41dc772451efe4aed1b073914513fd05916 100644 (file)
@@ -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);
        }
 }
This page took 0.025303 seconds and 4 git commands to generate.