qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: Speed up hack


From: Vladimir N. Oleynik
Subject: [Qemu-devel] Re: Speed up hack
Date: Tue, 18 May 2004 12:30:52 +0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040117

Hi, Fabrice.


> Can you estimate the speed gains ? I am especially interested by the
> poll() overhead.

I changed test/sha1.c for see production

-#define BUFSIZE 4096
+#define BUFSIZE 4096*16
+#define TEST 10
+
+#include <sys/time.h>
+#include <unistd.h>

 int
 main(int argc, char **argv)
 {
     SHA1_CTX ctx;
     unsigned char hash[20], buf[BUFSIZE];
-    int i;
+    int i, tn;
+    struct timeval tv, tv2;
+    int ts, tus;
+    double dt;

+    for(tn = 0; tn < TEST; tn++) {
+       gettimeofday(&tv, NULL);
        for(i=0;i<BUFSIZE;i++)
-        buf[i] = i;
+               buf[i] = i + tn;
-    printf("SHA1=");
+       gettimeofday(&tv2, NULL);
+       ts = tv2.tv_sec - tv.tv_sec;
+       tus = tv2.tv_usec - tv.tv_usec;
+       dt = 1000000.0*ts;
+       dt += tus;
+       dt /= 1000000.0;
+       printf("dt=%.3f SHA1=", dt);
        for(i=0;i<20;i++)
         printf("%02x", hash[i]);
        printf("\n");
+    }


My P4 2.6GHZ give ~ 1 sec per test, my qemu (softmmu) give:
without TICKS_BEFORE_POLL ~ 11.838 sec per test
withc TICKS_BEFORE_POLL=100 ~ 11.756 sec per test
Hmm. very little different :(
I give ~ 0.02 sec per test if set "static inline" for
cpu_get_real_ticks() and qemu_run_timers()
;-)

> For the rest, optimizing DMA_run() would be simpler
> and more efficient.

May be ;-)


--w
vodz






reply via email to

[Prev in Thread] Current Thread [Next in Thread]