Revision 1b48824f

b/vl.c
722 722
    icount_adjust();
723 723
}
724 724

  
725
static void configure_icount(const char *option)
726
{
727
    if (!option)
728
        return;
729

  
730
    if (strcmp(option, "auto") != 0) {
731
        icount_time_shift = strtol(option, NULL, 0);
732
        use_icount = 1;
733
        return;
734
    }
735

  
736
    use_icount = 2;
737

  
738
    /* 125MIPS seems a reasonable initial guess at the guest speed.
739
       It will be corrected fairly quickly anyway.  */
740
    icount_time_shift = 3;
741

  
742
    /* Have both realtime and virtual time triggers for speed adjustment.
743
       The realtime trigger catches emulated time passing too slowly,
744
       the virtual time trigger catches emulated time passing too fast.
745
       Realtime triggers occur even when idle, so use them less frequently
746
       than VM triggers.  */
747
    icount_rt_timer = qemu_new_timer(rt_clock, icount_adjust_rt, NULL);
748
    qemu_mod_timer(icount_rt_timer,
749
                   qemu_get_clock(rt_clock) + 1000);
750
    icount_vm_timer = qemu_new_timer(vm_clock, icount_adjust_vm, NULL);
751
    qemu_mod_timer(icount_vm_timer,
752
                   qemu_get_clock(vm_clock) + get_ticks_per_sec() / 10);
753
}
754

  
755 725
static int64_t qemu_icount_round(int64_t count)
756 726
{
757 727
    return (count + (1 << icount_time_shift) - 1) >> icount_time_shift;
......
1056 1026
    }
1057 1027
};
1058 1028

  
1029
static void configure_icount(const char *option)
1030
{
1031
    vmstate_register(0, &vmstate_timers, &timers_state);
1032
    if (!option)
1033
        return;
1034

  
1035
    if (strcmp(option, "auto") != 0) {
1036
        icount_time_shift = strtol(option, NULL, 0);
1037
        use_icount = 1;
1038
        return;
1039
    }
1040

  
1041
    use_icount = 2;
1042

  
1043
    /* 125MIPS seems a reasonable initial guess at the guest speed.
1044
       It will be corrected fairly quickly anyway.  */
1045
    icount_time_shift = 3;
1046

  
1047
    /* Have both realtime and virtual time triggers for speed adjustment.
1048
       The realtime trigger catches emulated time passing too slowly,
1049
       the virtual time trigger catches emulated time passing too fast.
1050
       Realtime triggers occur even when idle, so use them less frequently
1051
       than VM triggers.  */
1052
    icount_rt_timer = qemu_new_timer(rt_clock, icount_adjust_rt, NULL);
1053
    qemu_mod_timer(icount_rt_timer,
1054
                   qemu_get_clock(rt_clock) + 1000);
1055
    icount_vm_timer = qemu_new_timer(vm_clock, icount_adjust_vm, NULL);
1056
    qemu_mod_timer(icount_vm_timer,
1057
                   qemu_get_clock(vm_clock) + get_ticks_per_sec() / 10);
1058
}
1059

  
1059 1060
static void qemu_run_all_timers(void)
1060 1061
{
1061 1062
    /* rearm timer, if not periodic */
......
5943 5944
    if (qemu_opts_foreach(&qemu_drive_opts, drive_init_func, machine, 1) != 0)
5944 5945
        exit(1);
5945 5946

  
5946
    vmstate_register(0, &vmstate_timers ,&timers_state);
5947 5947
    register_savevm_live("ram", 0, 3, NULL, ram_save_live, NULL, 
5948 5948
                         ram_load, NULL);
5949 5949

  

Also available in: Unified diff