Only in .: armeb-linux-user
Only in .: arm-linux-user
Only in .: arm-softmmu
Only in .: config-host.h
Only in .: config-host.mak
Only in .: dyngen
Only in .: i386-linux-user
Only in .: i386-softmmu
Only in .: m68k-linux-user
Only in .: mipsel-linux-user
Only in .: mipsel-softmmu
Only in .: mips-linux-user
Only in .: mips-softmmu
diff -aur ../qemu-org/qemu-0.9.0/monitor.c ./monitor.c
--- ../qemu-org/qemu-0.9.0/monitor.c	2007-02-06 00:01:54.000000000 +0100
+++ ./monitor.c	2007-03-01 15:19:14.000000000 +0100
@@ -307,6 +307,14 @@
         term_printf("Invalid CPU index\n");
 }
 
+static void do_brake_set(int multiplier)
+{
+    if (multiplier < 0)
+        term_printf("Current brake multiplier in percents %d\n", brake_mult);
+    else
+        brake_mult = multiplier;
+}
+
 static void do_info_jit(void)
 {
     dump_exec_info(NULL, monitor_fprintf);
@@ -1251,6 +1259,8 @@
 #endif
      { "stopcapture", "i", do_stop_capture,
        "capture index", "stop capture" },
+     { "brake", "i", do_brake_set, 
+       "multiplier", "set brake multiplier in percents (non-negative integer), negative value prints actual setting" },
     { "memsave", "lis", do_memory_save, 
       "addr size file", "save to disk virtual memory dump starting at 'addr' of size 'size'", },
     { NULL, NULL, }, 
Only in .: ppc-linux-user
Only in .: ppc-softmmu
Only in .: qemu.1
Only in .: qemu-doc.html
Only in .: qemu-img
Only in .: qemu-img.1
Only in .: qemu-img.pod
Only in .: qemu.pod
Only in .: qemu-tech.html
Only in .: sparc-linux-user
Only in .: sparc-softmmu
diff -aur ../qemu-org/qemu-0.9.0/vl.c ./vl.c
--- ../qemu-org/qemu-0.9.0/vl.c	2007-02-06 00:01:54.000000000 +0100
+++ ./vl.c	2007-03-01 16:27:58.000000000 +0100
@@ -167,6 +167,7 @@
 #endif
 int acpi_enabled = 1;
 int fd_bootchk = 1;
+int brake_mult = 0;
 int no_reboot = 0;
 int daemonize = 0;
 const char *option_rom[MAX_OPTION_ROMS];
@@ -5937,6 +5938,13 @@
 
 int main_loop(void)
 {
+    int64_t tti, tti2, tti3;
+//#define BRAKE_DEBUG
+#ifdef BRAKE_DEBUG
+    int64_t mti, mti1, mti2, mti3;
+    int prcnt=0;
+#endif
+
     int ret, timeout;
 #ifdef CONFIG_PROFILER
     int64_t ti;
@@ -5945,6 +5953,11 @@
 
     cur_cpu = first_cpu;
     for(;;) {
+
+        tti = get_clock();
+#ifdef BRAKE_DEBUG
+        mti = profile_getclock();
+#endif
         if (vm_running) {
 
             env = cur_cpu;
@@ -6003,6 +6016,44 @@
 #ifdef CONFIG_PROFILER
         dev_time += profile_getclock() - ti;
 #endif
+
+        tti2 = get_clock();
+#ifdef BRAKE_DEBUG
+        mti2 = profile_getclock();
+#endif
+
+        {
+            int64_t delus, delunc=0;
+
+            delus = (tti2-tti)*brake_mult/100 - delunc;
+
+#ifdef _WIN32
+	    Sleep(delus/1000000L);
+#else
+            struct timespec ts;
+            ts.tv_sec=0;
+            ts.tv_nsec=delus;
+            sigset_t sis, osis;
+            sigfillset(&sis);
+            sigprocmask(SIG_BLOCK, &sis, &osis);
+            if (delus>0) while (nanosleep(&ts, &ts));
+            sigprocmask(SIG_SETMASK, &osis, NULL);
+#endif
+
+#ifdef BRAKE_DEBUG
+            mti3 = profile_getclock();
+#endif
+            tti3 = get_clock();
+
+            delunc = tti3 - tti2 - delus; 
+#ifdef BRAKE_DEBUG
+            if (!((++prcnt)%128)) {
+                printf("cycles %qd, \t%qd, \t%qd, \t%qd \%\n", (mti1 - mti), (mti2 - mti1), (mti3 - mti2), (100*(mti1 - mti))/(mti3-mti) );
+                //printf("del[us] %d, \t%d\n", delus, delunc);
+                //printf("ts[ns] = %d\n", ts.tv_nsec);
+            }
+#endif
+        }
     }
     cpu_disable_ticks();
     return ret;
@@ -6119,6 +6170,7 @@
            "-no-reboot      exit instead of rebooting\n"
            "-loadvm file    start right away with a saved state (loadvm in monitor)\n"
 	   "-vnc display    start a VNC server on display\n"
+	   "-brake multiplier    enables brake system which slows down qemu `multiplier'/100 times\n"
 #ifndef _WIN32
 	   "-daemonize      daemonize QEMU after initializing\n"
 #endif
@@ -6202,6 +6254,7 @@
     QEMU_OPTION_smp,
     QEMU_OPTION_vnc,
     QEMU_OPTION_no_acpi,
+    QEMU_OPTION_brake,
     QEMU_OPTION_no_reboot,
     QEMU_OPTION_daemonize,
     QEMU_OPTION_option_rom,
@@ -6286,6 +6339,7 @@
     { "usb", 0, QEMU_OPTION_usb },
     { "cirrusvga", 0, QEMU_OPTION_cirrusvga },
     { "no-acpi", 0, QEMU_OPTION_no_acpi },
+    { "brake", 1, QEMU_OPTION_brake },
     { "no-reboot", 0, QEMU_OPTION_no_reboot },
     { "daemonize", 0, QEMU_OPTION_daemonize },
     { "option-rom", HAS_ARG, QEMU_OPTION_option_rom },
@@ -6958,6 +7012,9 @@
             case QEMU_OPTION_semihosting:
                 semihosting_enabled = 1;
                 break;
+	    case QEMU_OPTION_brake:
+		brake_mult = atoi(optarg);
+		break;
             }
         }
     }
diff -aur ../qemu-org/qemu-0.9.0/vl.h ./vl.h
--- ../qemu-org/qemu-0.9.0/vl.h	2007-02-06 00:01:54.000000000 +0100
+++ ./vl.h	2007-03-01 15:10:01.000000000 +0100
@@ -1397,4 +1397,6 @@
 
 void kqemu_record_dump(void);
 
+extern int brake_mult;
+
 #endif /* VL_H */
Only in .: x86_64-softmmu
