speedtest updates
authorbrian <brian@brianweb.net>
Wed, 12 May 2004 04:08:22 +0000 (21:08 -0700)
committerbrian <brian@brianweb.net>
Wed, 12 May 2004 04:08:22 +0000 (21:08 -0700)
darcs-hash:20040512040822-24bed-bc2b0a049f2eeee777019ee11ca1472d0c035e14.gz

src/tests/SpeedTest.java
src/tests/Test.c

index c3c21a3..667d9a2 100644 (file)
@@ -2,6 +2,9 @@ package tests;
 
 import org.ibex.nestedvm.Runtime;
 
 
 import org.ibex.nestedvm.Runtime;
 
+import java.io.*;
+import java.util.*;
+
 class SpeedTest {
     private static long start,end;
     private static long now() { return System.currentTimeMillis(); }
 class SpeedTest {
     private static long start,end;
     private static long now() { return System.currentTimeMillis(); }
@@ -9,6 +12,24 @@ class SpeedTest {
     private static void end() { end = now(); }
     private static float diff() { return ((float)(end-start))/1000; }
     
     private static void end() { end = now(); }
     private static float diff() { return ((float)(end-start))/1000; }
     
+    /*private static InputStream is = new InputStream() {
+        int left = 100*1024*1024;
+        int c = 0;
+        public int read() { if(left==0) return -1; left--; return (c++)&0xff; }
+        public int read(byte[] buf, int pos,int len) {
+            len = Math.min(left,len);
+            Arrays.fill(buf,pos,len,(byte)c++);
+            left -= len;
+            return len;
+        }
+        public void close() { left =  100*1024*1024; }
+    };
+    
+    private static OutputStream os = new OutputStream() {
+        public void write(int c) { }
+        public void write(byte[] buf, int pos, int len) { }
+    };*/
+    
     public static void main(String[] args) throws Exception {
         float d;
         
     public static void main(String[] args) throws Exception {
         float d;
         
@@ -45,11 +66,16 @@ class SpeedTest {
         for(int i=0;i<runs;i++) {
             //Runtime runtime = binary ? new Interpreter(className) : (Runtime) c.newInstance();
             Runtime runtime = (Runtime) c.newInstance();
         for(int i=0;i<runs;i++) {
             //Runtime runtime = binary ? new Interpreter(className) : (Runtime) c.newInstance();
             Runtime runtime = (Runtime) c.newInstance();
+            /*runtime.closeFD(0);
+            runtime.closeFD(1);
+            runtime.addFD(new Runtime.InputStreamFD(is));
+            runtime.addFD(new Runtime.OutputStreamFD(os));*/
             System.gc();
             start();
             int status = runtime.run(appArgs);
             if(status != 0) { System.err.println(className + " failed with exit status: " + status); System.exit(1); }
             end();
             System.gc();
             start();
             int status = runtime.run(appArgs);
             if(status != 0) { System.err.println(className + " failed with exit status: " + status); System.exit(1); }
             end();
+            //is.close();
             times[i] = diff();
             System.err.println("Run " + (i+1) + ": " + times[i] + " sec");
         }
             times[i] = diff();
             System.err.println("Run " + (i+1) + ": " + times[i] + " sec");
         }
index c223d1c..e8aa5df 100644 (file)
@@ -238,6 +238,13 @@ int main(int argc, char **argv) {
         printf("%llX\n",l);
     }
     
         printf("%llX\n",l);
     }
     
+    {
+        double d = -2.34;
+        //d = abs(d);
+        printf("abs(-2.24) = %g\n",d);
+    }
+        
+    
     //printf("cwd: %s\n",getcwd(NULL,0));
     //printf("isatty(0): %d\n",isatty(0));
     //printf("exiting\n");
     //printf("cwd: %s\n",getcwd(NULL,0));
     //printf("isatty(0): %d\n",isatty(0));
     //printf("exiting\n");