This affects the output of some SCP commands (including help). The
results are cosmetic, but allows the simulator to provide correct descriptive
information.
Some simulators have clocks that have dynamically programmable tick
rates. Such a clock is only a reliable candidate to be the calibrated
clock if it uses a single tick rate rather than changing the tick rate
on the fly. Generally most systems like this, under normal conditions
don't change their tick rates unless they're running something that is
examining the behavior of the clock system (like a diagnostic). Under
these conditions this clock is removed from the potential selection as
"the" calibrated clock that all others are relative to and if necessary,
an internal calibrated clock is selected.
- Fix incomplete migration to RTC structures indicated by Coverity
warnings. Some Coverity were minor warnings and not real issues.
- Add calibration recovery parameters for idle and catchup ticks
- Aggressively perform catchup ticks when in simulated idle paths
even when idling is disabled.
- All non internal clocks can have catch-up ticks triggered if they
register a tick unit.
- Catch-up ticks will be delivered to non tick acking simulators when
idling if regstered tick unit has been specified.
- Hosts with slow ticks can idle and keep sloppy OK time when
simulators have faster ticks
- Default to active calibration (ALWAYS) while idling (no skipping)
The original approach had separate parallel arrays for each relevant
state variable for each calibrated timer. That worked when there were
only a few state variables, the state info for a timer belongs in a
structure.
- Adjust calibration parameters to properly record catchup variables for
odd condition cases.
- Disable idle percentage calibration skipping until the correct set of
calibration variables are available.
- When a pre-calibrate operation has been performed, make the results
visible in the output of SHOW CLOCK
As discussed in #705 and #699
- MicroVAX I, II and 3900 don't have a DONE bit in the clock status
register, so sim_rtcn_tick_ack() wasn't being called to acknowledge
clock ticks.
- Timer catchup tick criteria didn't work unless the host had a slow
clock tick.
As discussed in #705
- Properly handle clock transitions when control flows back and forth
between instruction execution and simh commands.
- Changed Internal Timer from 10 Hz to the MAX(100Hz, HostOSClockHz)
- Changed default idle calibration percent to 50%
- Make sure that error cases (backwards and gap too big) properly advance
the real time while avoiding calibration.
- Fix selection of the calibrated clock.
- Fix logic that sets the idle percentage that controls calibration.
- sim_instr() returns to scp (during script execution) that start simulation
again in less than 1 tick of the calibrated clock now leverage the previous
calibration state when instruction execution resumes.
- Only generate catchup ticks for clocks that are still running.
- Revert windows sim_os_msec() implementation back to use the multi-media
timer which is required on Windows XP and shouldn't be affected by dynamic
OS time adjustments that do affect System Time.
- Reliably align clock measurements on tick boundary before measuring.
- Use consistent timebase for time measurements in sim_idle_ms_sleep()
Windows:
- Properly restore system clock tick size on exit.
- Use highest resolution time for ms time measurements
Backed out commit 484889ea5a since the overflow of the timespec tv_nsec
field was the real cause of the problem. No need for an extra mutex.
As reported in #595
It seems that the prior use of sim_asynch_lock RECURSIVE mutex could
cause a pthread_cond_timedwait() failure with EINVAL returned.
As discussed in #595
Clock calibration normally takes several seconds to zero in on somewhat
accurate values for reasonable synchronization of simulated time to wall
clock time. Often this doesn't matter one way or another. However,
one thing which requires somewhat accurate clock calibration is the
pacing of output to serial ports on the host system. Pacing happens
at the configured bits per second rates as long as the simulators
instruction execution rate has been reasonably calibrated with respect
to wall clock time. A given host system will most likely simulate
instructions at the same rate from one run to the next, so running a
simulator for a little while and then examining the execution rate with
the SHOW CLOCK command can provide knowledge about the calibrated
execution rate which can be used to start a future simulator's execution
with a very good estimate of what the ultimate calibrated rate will be.
If the SHOW CLOCK shows simulator execution at 120,000,000 instructions
per second, and the simulated system has a simulated clock that runs at
60 hz, then the pre-calibrated values can be set with these commands:
sim> DEPOSIT INT-CLOCK TICK_SIZE_0 2000000
sim> DEPOSIT INT-CLOCK TICK_RATE_0 60
sim> DEPOSIT INT-CLOCK INTERNAL_TICK_SIZE 12000000
The INTERNAL_TIMER runs in the background whenever the simulator
doesn't have a calibrated timer running. It runs at 10 Hz.
Previously, only long delays that would transition the next clock
calibration would be coscheduled unless an explicit timer was
specified to coschedule with.
This may help with the problem discussed in #508
Without this change, timer events don't get queued correctly when the
simulator isn't running (i.e. when at the command prompt or as a consequence
of a RESET command (or during boot preparation)).
This only affects when timers are asynchronous which is not the current
default.
- Throttling delays are self adjusting for specific speed throttling
(K cycles and M cycles and % cycles).
- Throttling starts after THROT_DELAY seconds of execution.
- THROT_DELAY is a register accessible via EXAMINE and DEPOSIT
once throttling has been enabled.
- Throttle sleep times are recalibrated every 10 seconds based on
execution performance for the prior 10 seconds if the current
execution rate differs from the desired rate by more than
THROT_DRIFT_PCT. THROT_DRIFT_PCT defaults to 5 and is a
register accessible via EXAMINE and DEPOSIT once throttling has
been enabled.
- Addressing details reported in #508