* [Qemu-devel] Re: Speed up hack
[not found] <200405172346.i4HNkiOR003792@treas.simtreas.ru>
@ 2004-05-18 8:30 ` Vladimir N. Oleynik
0 siblings, 0 replies; only message in thread
From: Vladimir N. Oleynik @ 2004-05-18 8:30 UTC (permalink / raw)
To: qemu-devel, fabrice
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
^ permalink raw reply [flat|nested] only message in thread