On Thu, May 24, 2012 at 12:33:11PM -0400, Bob Supnik wrote:
In sim_timer.c, locate this routine (there are several versions, look for the last one, which is for UNIX systems):

uint32 sim_os_ms_sleep_init (void)
{
uint32 i, t1, t2, tot, tim;

for (i = 0, tot = 0; i < sleep1Samples; i++) {
   t1 = sim_os_msec ();
   sim_os_ms_sleep (1);
   t2 = sim_os_msec ();
   tot += (t2 - t1);
   }
tim = (tot + (sleep1Samples - 1)) / sleep1Samples;
if (tim > SIM_IDLE_MAX)
   tim = 0;
return tim;
}

If you are running with gdb, place a breakpoint on the line

if (tim > SIM_IDLE_MAX)

and see what the value of 'tim' is. Otherwise, insert the following before the if statement:

printf ("Calculated minimum sleep time = %d\r\n", tim);

and see what gets printed out.

We seem to have a winner:
Calculated minimum sleep time = 20


After a tip from zoran at #vms, I checked the FreeBSD host clock settings:

    [alver@bsd ~]$ sysctl kern.clockrate
    kern.clockrate: { hz = 100, tick = 10000, profhz = 8128, stathz = 127 }


This was a tad too slow - 100 ticks per second. I changed it to 1000 ticks per
second in /boot/loader.conf:

    kern.hz="1000"


After rebooting, the clockrate was adjusted to this:

    [alver@bsd ~]$ sysctl kern.clockrate
    kern.clockrate: { hz = 1000, tick = 1000, profhz = 8128, stathz = 127 }


And lo, behold:
    Calculated minimum sleep time = 2

    VAX simulator V3.9-0
    sim> SHOW CPU
    CPU, idle=VMS, idle enabled, stability wait = 20s, 64MB, HALT to console


So it's working as expected now.


Thanks everyone for the assistance! Now back to clustering VAXen over an
openvpn L2 link... :-)


Lennert

_______________________________________________
Simh mailing list
[email protected]
http://mailman.trailing-edge.com/mailman/listinfo/simh

Reply via email to