qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Speed up hack
       [not found] <200405170918.i4H9I4OR001702@treas.simtreas.ru>
@ 2004-05-17 16:22 ` Vladimir N. Oleynik
  2004-05-17 21:12   ` Fabrice Bellard
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir N. Oleynik @ 2004-05-17 16:22 UTC (permalink / raw)
  To: qemu-devel

Hi.

I generate little speed up hack:

1) new TICKS_BEFORE_POLL constant from make cpu loop before
call poll().
2) call DMA_run() if sb16 or floppy present
3) also, for extreme overclocker: if change MAX_FD from 2 to 1,
you can make very little speed up also ;-)


--- vl.c~       2004-05-17 20:15:26.000000000 +0400
+++ vl.c        2004-05-17 19:52:44.000000000 +0400
@@ -1634,6 +1634,8 @@
      }
  }

+#define TICKS_BEFORE_POLL 100
+
  int main_loop(void)
  {
  #ifndef _WIN32
@@ -1641,6 +1643,7 @@
      IOHandlerRecord *ioh, *ioh_next;
      uint8_t buf[4096];
      int n, max_size;
+    int tick_before_poll=TICKS_BEFORE_POLL;
  #endif
      int ret, timeout;
      CPUState *env = global_env;
@@ -1670,6 +1673,11 @@
             Sleep(timeout);
  #else

+       if(tick_before_poll!=0 && timeout==0) {
+               tick_before_poll--;
+               goto ltick_before_poll;
+       }
+       tick_before_poll=TICKS_BEFORE_POLL;
         /* poll any events */
         /* XXX: separate device handlers from system ones */
         pf = ufds;
@@ -1741,6 +1749,7 @@
         }
  #endif

+       ltick_before_poll:
  #endif

         if (vm_running) {
@@ -1750,10 +1759,18 @@
             if (audio_enabled) {
                 /* XXX: add explicit timer */
                 SB16_run();
-           }
+               DMA_run();
+           } else {
+               int i;

-           /* run dma transfers, if any */
-           DMA_run();
+               /* run dma transfers, if any */
+               for(i = 0; i < MAX_FD; i++) {
+                       if(fd_table[i]) {
+                               DMA_run();
+                               break;
+                       }
+               }
+           }
         }

         /* real time timers */


--w
vodz

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] Speed up hack
  2004-05-17 16:22 ` [Qemu-devel] Speed up hack Vladimir N. Oleynik
@ 2004-05-17 21:12   ` Fabrice Bellard
  0 siblings, 0 replies; 2+ messages in thread
From: Fabrice Bellard @ 2004-05-17 21:12 UTC (permalink / raw)
  To: qemu-devel

Can you estimate the speed gains ? I am especially interested by the 
poll() overhead. For the rest, optimizing DMA_run() would be simpler and 
more efficient.

Fabrice.

Vladimir N. Oleynik wrote:
> Hi.
> 
> I generate little speed up hack:
> 
> 1) new TICKS_BEFORE_POLL constant from make cpu loop before
> call poll().
> 2) call DMA_run() if sb16 or floppy present
> 3) also, for extreme overclocker: if change MAX_FD from 2 to 1,
> you can make very little speed up also ;-)
> 
> 
> --- vl.c~       2004-05-17 20:15:26.000000000 +0400
> +++ vl.c        2004-05-17 19:52:44.000000000 +0400
> @@ -1634,6 +1634,8 @@
>      }
>  }
> 
> +#define TICKS_BEFORE_POLL 100
> +
>  int main_loop(void)
>  {
>  #ifndef _WIN32
> @@ -1641,6 +1643,7 @@
>      IOHandlerRecord *ioh, *ioh_next;
>      uint8_t buf[4096];
>      int n, max_size;
> +    int tick_before_poll=TICKS_BEFORE_POLL;
>  #endif
>      int ret, timeout;
>      CPUState *env = global_env;
> @@ -1670,6 +1673,11 @@
>             Sleep(timeout);
>  #else
> 
> +       if(tick_before_poll!=0 && timeout==0) {
> +               tick_before_poll--;
> +               goto ltick_before_poll;
> +       }
> +       tick_before_poll=TICKS_BEFORE_POLL;
>         /* poll any events */
>         /* XXX: separate device handlers from system ones */
>         pf = ufds;
> @@ -1741,6 +1749,7 @@
>         }
>  #endif
> 
> +       ltick_before_poll:
>  #endif
> 
>         if (vm_running) {
> @@ -1750,10 +1759,18 @@
>             if (audio_enabled) {
>                 /* XXX: add explicit timer */
>                 SB16_run();
> -           }
> +               DMA_run();
> +           } else {
> +               int i;
> 
> -           /* run dma transfers, if any */
> -           DMA_run();
> +               /* run dma transfers, if any */
> +               for(i = 0; i < MAX_FD; i++) {
> +                       if(fd_table[i]) {
> +                               DMA_run();
> +                               break;
> +                       }
> +               }
> +           }
>         }
> 
>         /* real time timers */
> 
> 
> --w
> vodz
> 
> 
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://mail.nongnu.org/mailman/listinfo/qemu-devel
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-17 21:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200405170918.i4H9I4OR001702@treas.simtreas.ru>
2004-05-17 16:22 ` [Qemu-devel] Speed up hack Vladimir N. Oleynik
2004-05-17 21:12   ` Fabrice Bellard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).