Commit graph

178 commits

Author SHA1 Message Date
Bob Supnik
4562408a5f Common code: various bugfixes; Mac "Classic" and OS/2 support has been removed 2023-01-31 14:49:35 -05:00
Tony Lawrence
a06ab20512 TIMER: Support 1ms timer resolution in Cygwin 2022-11-23 11:24:31 -05:00
Heinz-Bernd Eggenstein
525215b07e TIMER: Be less aggressive to disable throttling after initial calibration
- removed a somwhat unlikely but possible division-by-zero
- in case the initial throttling calibration measures a slower cps rate than
   the desired cps rate, check whether the measured rate is well below the
   measured peak rate. If so, distrust the measured rate and instead use
   half the peak rate as measured cps rate.
   Otherwise (so measured cps is in the same ballpark as measured peak rate)
   disable throttling

As initially reported in #815
2021-10-23 13:50:48 -07:00
Mark Pizzolato
486505741c TIMER: Fix pre-calibrate 100ms setup bug 2020-11-18 22:53:24 -08:00
Mark Pizzolato
8233fdc3c1 TIMER: Run simulator pre-calibration for a minimum of 100ms
Faster host systems today can get very fast instruction execution rates
for a short duration calibration test.  These may be skewed by round
off error, so we now run the calibration for a minimum of 100ms.
2020-11-18 14:47:42 -08:00
Mark Pizzolato
a41f081e81 TIMER: Add a generic time API to return the SCP time base 2020-10-29 12:57:47 -07:00
Mark Pizzolato
7ebd22edaa TIMER: Fix sim_idle_ms_sleep() return value to be more precise
delta time computation converting the difference between two timespec
structures values to milliseconds previously truncated the difference which,
depending on the value of when the starting value in the delta happened,
along with when an OS clock tick occurred, may have resulted in a small
delta and an apparent sleep time of 0.  A more accurate result is produced
when the conversion from nanoseconds to milliseconds is rounded up
before the usecs/nsecs are truncated.
2020-04-28 07:10:57 -07:00
Mark Pizzolato
1c589030ae TIMER: Provide a means for VM to indicate its expected calibration rate
As reported and discussed in #817

This allows RUNLIMIT to provide useful results on fast or slow host systems.
2020-03-23 07:48:45 -07:00
Mark Pizzolato
ee317e0cb4 SCP: Adjust RUNLIMIT time values on slow host systems
As reported and discussed in #819
2020-03-21 21:30:58 -07:00
Mark Pizzolato
550837b15b TIMER: Prefer a stable calibrated clock which ticks slower than the host 2020-03-08 21:11:30 -07:00
Mark Pizzolato
0170b7c6ab SCP: Convert more SHOW and debug output to use sim_vm_interval_units 2020-03-08 11:43:30 -07:00
Mark Pizzolato
56f186135c TIMER: Fix startup/restart logic that accounts for time at the sim> promt 2020-03-07 21:24:03 -08:00
Mark Pizzolato
938aa58f3a SCP: Provide ways for VM to specify sim_interval adjustment and step units
This affects the output of some SCP commands (including help).  The
results are cosmetic, but allows the simulator to provide correct descriptive
information.
2020-03-07 10:13:18 -08:00
Mark Pizzolato
42bb47d961 TIMER: Be sure to empty the event queue at timer initialization
If a reset_all_p() happens before the timing subsystem is initialized,
events can be queued with unreasonable timing measurements.
2020-03-07 07:05:46 -08:00
Mark Pizzolato
26fa91a335 TIMER: Avoid clocks with changing tick rates as the primary calibrated timer
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.
2020-02-23 00:31:45 -08:00
Mark Pizzolato
73a41c4bc7 SCP: Auto detect WRU being entered for simulators without a console device 2019-12-11 12:25:18 -08:00
Mark Pizzolato
2840e3b67f SCP: Fix Coverity identified issues/noise 2019-07-15 00:04:40 -07:00
Mark Pizzolato
b3fa1f9fe8 TIMER: Stabilize timer behaviors
- 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)
2019-06-18 08:01:45 -07:00
Mark Pizzolato
8c4f8b0bff TIMER: Accelerate catchup ticks while idling
- Avoid default idle stability wait when pre-calibrate has succeeded
- Display time at sim> prompt in SHOW CLOCK output
2019-06-10 14:55:05 -07:00
Mark Pizzolato
9ab8d0e91e TIMER: Add debug of all calibration decision variables default no idle skip 2019-06-08 16:38:15 -07:00
Mark Pizzolato
7bcf407fcc TIMER: Reorganize timer control variables to use a structure for each timer
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.
2019-06-08 13:55:49 -07:00
Mark Pizzolato
da3f851d70 TIMER: Add minimal tick based calibration APIs. 2019-06-08 13:55:06 -07:00
Mark Pizzolato
9514ea5a58 TIMER: Stabilize run away clock calibration conditions
- 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
2019-06-03 20:45:40 -07:00
Mark Pizzolato
217463c6e2 TIMER: Also account for sim> prompt time in catchup time calculations
As discussed in #705
2019-06-01 02:33:02 -07:00
Mark Pizzolato
564ce2b3f4 TIMER: Don't consider idle calibration skipping with internal timer
As discussed in #699
2019-05-30 03:23:38 -07:00
Mark Pizzolato
0195bbda4b TIMER: Fix missing catchup ticks for VAX simulators when idling
- 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
2019-05-30 01:51:52 -07:00
Mark Pizzolato
f75f28aa21 TIMER: Add mechanism to pre-calibrate the instruction execution rate 2019-05-28 23:56:58 -07:00
Mark Pizzolato
48db10994d TIMER: Calibrated clock fixes
- 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.
2019-05-28 22:47:06 -07:00
Mark Pizzolato
5fdc1e6d0f SCP: Add more clock adjustments while idling 2018-10-08 20:55:01 -07:00
Mark Pizzolato
948d8cc6e8 TIMER: Remove excessive adjustment of sim_interval while idling 2018-10-05 20:44:22 -07:00
Mark Pizzolato
b38cc8a367 SCP: Allow "STEP -T nnn" to work
Delay scheduling of long duration calibration events until a calibrated timer
is established.
2018-10-05 20:43:43 -07:00
Mark Pizzolato
3a9a15f3a9 TIMER: Allow short duration sim_instr() exits to avoid recalibrating timers
- 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.
2018-09-28 18:04:34 -07:00
Mark Pizzolato
f48c282dff SCP: Silence potential compiler warnings on Windows using GCC 2018-09-27 22:01:40 -07:00
Mark Pizzolato
6070692581 SCP: Add unit to AIO_VALIDATE context message 2018-08-08 11:51:54 -07:00
Mark Pizzolato
0d9f195f1c TIMER: Timing updates
- 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
2018-08-06 19:54:29 -07:00
Mark Pizzolato
15885fdf6a TIMER: optimize time format conversion routine 2018-08-06 07:38:08 -07:00
Mark Pizzolato
b25a19769e TIMER: Tolerate negative usec activation delays and pass thru as instructions 2018-07-17 15:34:08 -07:00
Mark Pizzolato
e537e4d8fe TIMER: Fix additional timespec overflow cases in diff and compares 2018-07-15 10:18:30 -07:00
Mark Pizzolato
97bee79faa TIMER: Fix overflow error in sim_idle_ms_sleep() timespec tv_nsec field
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
2018-07-15 10:11:14 -07:00
Mark Pizzolato
484889ea5a TIMER: Changed sim_idle_ms_sleep() to use a mutex which is unique to idling
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
2018-07-11 11:59:05 -07:00
Mark Pizzolato
d593cdb98b SCP: Add prompt prior to fatal exit allowing error messages reading
As discussed in #594
2018-07-08 14:55:55 -07:00
Mark Pizzolato
9b95115a2a TIMER: Add abort logic if sim_idle_ms_sleep() sleeps for 0 with an error
As discussed in #594
2018-07-08 13:53:28 -07:00
Mark Pizzolato
076af54ad3 TIMER: Report available details when unexpected timer subsystem errors occur
A graceful exit with the unexpected results reported now is provided.
As discussed in #594
2018-07-08 11:53:20 -07:00
Mark Pizzolato
d20ef039e7 TIMER: Properly identify short vs long (multi-tick) delays for co-scheduling 2018-06-20 11:57:15 -07:00
Mark Pizzolato
681ed2d6f9 TIMER: Minimize noise in idle debug output for short idle delays 2018-06-15 11:27:23 -07:00
Mark Pizzolato
6b7798781d TIMER: Allow recording of elapsed time when asynch events arrive while idling
As discussed in #578
2018-06-14 12:40:22 -07:00
Mark Pizzolato
93f92b7fb3 TIMER: Fix edge condition when scheduling timer delays with clock tick pending 2018-06-11 03:16:12 -07:00
Mark Pizzolato
ed2abaa2d8 SCP: Enhance debug output while tracking event and timer activity 2018-06-11 03:13:29 -07:00
Mark Pizzolato
b51d250598 SCP: Ignore trailing whitespace for all commands 2018-05-18 08:32:03 -07:00
Mark Pizzolato
ded2b20fe0 TIMER: Tolerate trailing spaces on SET THROTTLE arguments 2018-05-18 08:15:03 -07:00