Patchwork Main loop

login
register
mail settings
Submitter malc
Date Sept. 27, 2009, 5:43 p.m.
Message ID <Pine.LNX.4.64.0909272138440.13822@linmac.oyster.ru>
Download mbox | patch
Permalink /patch/34353/
State Superseded
Headers show

Comments

malc - Sept. 27, 2009, 5:43 p.m.
On Sun, 27 Sep 2009, malc wrote:

> 
> At http://repo.or.cz/w/qemu/malc.git?a=shortlog;h=refs/heads/mtloop you
> can find the branch which refactors main execution loop somewhat, effects
> include:
> 
> a. Host alarm timers are gone
> b. IO thread is replaced (now Windows is supported too)
> 

[..snip..]

And just to make things more interesting:

$ git show

commit 309c5a3c4c2d234c1de8e0fb9441c8754590b1ce
Author: malc <av1474@comtv.ru>
Date:   Sun Sep 27 20:53:52 2009 +0400

    Add trace points for debian-503-i386-netinst.iso
    
    tracing begins _after_ selecting Install menu entry,
    results:
    
    c2b023b62707f5dc73497    this one (not sure what the has would be)
    ----------------------   -----------------------------------------
    took 9.810747 seconds    took 9.352371 seconds
    took 17.470818 seconds   took 15.257145 seconds
    took 36.917233 seconds   took 31.720386 seconds
    took 39.437925 seconds   took 33.894850 seconds
    took 56.677207 seconds   took 48.580790 seconds
    took 71.053026 seconds   took 59.385500 seconds
    took 89.334869 seconds   took 71.016816 seconds
    took 102.079938 seconds  took 84.707160 seconds
    took 108.837361 seconds  took 93.934140 seconds
    took 114.551840 seconds  took 98.579744 seconds
    took 120.375490 seconds  took 103.829356 seconds
    took 126.530942 seconds  took 109.003527 seconds


[end]

IO Thread results are:

took 9.955913 seconds
took 17.407633 seconds
took 38.311728 seconds
took 40.854557 seconds
took 58.371600 seconds
took 70.021890 seconds
took 85.377891 seconds
took 101.429223 seconds
took 111.663570 seconds
took 116.943185 seconds
took 122.880269 seconds
took 129.600638 seconds

IOW slightly worse than non IO Thread.

Caveat emptor:
  a. those are benchmarks
  b. i tend to fuck up things on occasion (frequently)

So take with a grain of salt.

P.S. (not sure what the has would be) should read (not sure what the
     _hash_ would be)

Patch

diff --git a/vl.c b/vl.c
index 34b8e72..c507fec 100644
--- a/vl.c
+++ b/vl.c
@@ -3142,12 +3142,17 @@  void onpc (target_ulong pc)
     static int done;
     static double a;
 
+    if (pc == 0xc036405a) {
+        a = now ();
+        done = 1;
+        return;
+    }
     if (!done) {
         done = 1;
         a = now ();
         return;
     }
-    if (pc == 0x08048054) {
+    if (pc == 0x08048054 || pc == 0x0804c00c) {
         printf ("took %f seconds\n", now () - a);
     }
 }
@@ -3516,9 +3521,11 @@  static void *exec_thread_loop (void __attribute__ ((unused)) *unused)
                 break;
 
             if (mt.wait_for_cont) {
+#if 0
                 static struct stats s = { .name = "cont", .limit = 1000 };
 
                 smark (&s);
+#endif
                 if (sem_wait (&mt.cont_sem)) {
                     die (errno, "exec_thread_loop: sem_wait/cont");
                 }