Commit graph

169 commits

Author SHA1 Message Date
Mark Pizzolato
b2b18de0ec TIMER: Use standard calibration techniques while throttling
Part of a previous change introduced logice which used the throttling
execution rate calibrated value to determine clock calibration when
throttling is enabled.  This provides significantly worse results than the
normal self correcting calibration process.  This commit reverses that
part of the previous change.
2017-08-03 18:51:55 -07:00
Mark Pizzolato
a02e9c1111 TIMER: Assure that long duration co-scheduled events are properly dispatched
As discussed in #478
2017-08-01 06:49:05 -07:00
Mark Pizzolato
d6316cbd03 TIMER: Add SET CLOCK STOP=nnn to stop execution after nnn instructions
This allows potential debug information to be bounded when execution is
started using BOOT or NEXT.
2017-08-01 06:32:18 -07:00
Mark Pizzolato
17cc00f33e TIMER: Fix threshold for short vs long interval delay scheduling 2017-06-13 08:18:10 -07:00
Mark Pizzolato
d9e7afc92f SCP: Fix Coverity flagged issues 2017-06-13 04:32:18 -07:00
Mark Pizzolato
9accb79b92 TIMER: Properly calibrate clocks while throttling 2017-06-11 05:00:42 -07:00
Mark Pizzolato
54993732dd TIMER: Properly queue all clocks when returning from sim_instr()
as reported in #460
2017-05-29 23:12:37 -07:00
Mark Pizzolato
1e8af71081 TIMER: Clarify throttling behavior displayed in SHOW for I/T mode 2017-05-11 08:33:39 -07:00
Mark Pizzolato
85c27bb099 TIMER: Fix typo in a comment text 2017-05-09 20:05:11 -07:00
Mark Pizzolato
12f43e660f TIMER: Behave reasonably when a simulator doesn't associate a UNIT with a timer 2017-03-12 17:59:23 -07:00
Mark Pizzolato
733653092f TIMER: Properly initialize clock coschedule queues 2017-02-04 11:38:56 -08:00
Mark Pizzolato
9e9658f30c TIMER: Cleanup compiler warning 2017-01-20 12:53:39 -08:00
Mark Pizzolato
57d14e5b4a TIMER: Fix coschedule bookkeeping on pending event interval 2017-01-19 11:12:06 -08:00
Mark Pizzolato
e36873f466 TIMER: Fix coscheduling functionality to produce consistent results
Added debug CHECK option to the sim_timer_activate_after() to verify
that coscheduled events actually have sim_activate_time_usecs() results
which are consistent with each other.
Additionally, coschedule tick processing now properly counts down
pending coschedule queued activities.
2017-01-18 23:53:46 -08:00
Mark Pizzolato
34ffe98605 TIMER: Fixed generic coscheduling and extended details in debug information 2017-01-17 16:29:55 -08:00
Mark Pizzolato
bdb0597411 TIMER: Fixed Internal Timer Support (canceling and activation time)
Also:
- Fix sim_timer_activate_time_usecs value size limits for ASYNCH timers
2017-01-09 17:38:09 -08:00
Mark Pizzolato
f698a215b4 TIMER: Fix sim_timer_is_active for internal timer unit 2017-01-05 10:44:49 -08:00
Mark Pizzolato
e450edd6ce SCP: Display most recent instruction execution rate in SHOW QUEUE output 2017-01-05 06:24:25 -08:00
Mark Pizzolato
b800587f34 TIMER: Add calibrated ROM memory access support 2017-01-05 05:50:46 -08:00
Mark Pizzolato
9c89b0e08b TIMER: Fix sim_timer_activate_time_usecs for clock units 2017-01-05 04:42:40 -08:00
Mark Pizzolato
711f6167fb TIMER: Make sure remnant usecs are always explicitly removed 2016-12-30 15:38:40 -08:00
Mark Pizzolato
c9276407e6 TIMER: Timing corrections and enhancements
- Add support to query remaining usecs on pending events.
- Generalized the sim_interval adjustment in sim_idle to allow more than
   a single decrement.
- More overhead reduction when idling.
- Carry usec values as double through out to fully support long wall clock
   delays.
2016-12-30 10:26:59 -08:00
Mark Pizzolato
7ec2ea836e TIMER: Properly transition internal timer after rebooting
- General cleanup of debug formatting and show device/features output
2016-12-28 13:25:11 -08:00
Mark Pizzolato
aa82b57d10 TIMER: Fix various inconsistent timing behaviors
- Support for arbitrary long wait intervals in sim_activate_after with
   precisely correct delays aligned with the calibrated clock once
   per second.
- Proper handling of calls to sim_cancel for calibrated timer units
- Properly allow stopping of calibrated clock by calling sim_rtcn_calb
   with a ticksper == 0
- Only schedule asynchronous timer activities for delays longer than
   the minimal OS sleep time
- Only wake asynchronous timer thread to queue new timer events
   that are shorter than the currently shortest scheduled event
2016-12-26 12:42:25 -08:00
Mark Pizzolato
7c2d20f26f SCP: Make sim_cancel more efficient by stopping search as soon as canceled 2016-12-24 09:49:32 -08:00
Mark Pizzolato
36276a79e1 SCP: Add device descriptions to internal devices visible in SHOW FEATURE -I 2016-12-18 13:33:11 -08:00
Mark Pizzolato
48e0b47d51 SCP: Add a way to see the enabled SCP internal devices SHOW DEV -I 2016-12-17 10:35:56 -08:00
Mark Pizzolato
740a506bcb TIMER: Add additional statistic info for SHOW CLOCKS
Also:
- Avoid potential divide by zero when stopping a running calibrated clock.
- Quickly reflect newly calibrated clock info in additional timers that may be running
2016-12-16 12:34:17 -08:00
Mark Pizzolato
ae52f4c331 TIMER: Add correct sim_activate_time functionality for all timer cases.
Also:
- allow a timer to dynamically stop itself (by calling sim_rtcn_calb
   with tps=0), and then to start the internal timer to provide a calibration
   baseline if necessary.
- Fix coschedule interval computation when the queue is empty.
- Properly select the correct timer for coscheduling without a specific tmr
- Properly adjust the coschedule queue's next time value when entries are
   canceled.
- Cleaned up throttling to behave well with all potential throttling rates and
   to make visible what is happening when boundaries are reached.
2016-12-15 09:57:34 -08:00
Mark Pizzolato
7db2dc10de TIMER: Fix coschedule dispatch logic and internal timer cleanup
Additionally, calls to sim_activate_after with delay values that exceed
twice the tick size of the calibrated clock are now coscheduled with
the calibrated clock.
2016-12-12 01:50:09 -08:00
Mark Pizzolato
5d8553e24c TIMER: Enabled catchup clock ticks
Historically, hosts which have a tick size slower than the tick a simulator
wants to implement can't idle effectively and keep good time.

This change allows simulators which call sim_rtcn_tick_ack() to provide
useful idling behavior while still keeping the passage of wall clock time
to time in the simulator accurate.
2016-12-10 11:59:49 -08:00
Mark Pizzolato
19250950c5 TIMER: Change internal THROTTLE device name to avoid SET THROTTLE collision 2016-12-07 16:17:40 -08:00
Mark Pizzolato
0a7996d9e3 TIMER: Fix statistics for Internal Timer and operation with multiple timers 2016-12-06 15:49:13 -08:00
Mark Pizzolato
eb333a845e TIMER: Fixed calibration idle skip percent logic
Also:
 - Added more statistics
 - Made sleep measurements more precise
 - Correct idle sleep decision logic without regard to host tick size
 - Fix calibration setup/teardown when host tick size is large (>10ms)
 - Generalized large host tick test capability (MS_MIN_GRANULARITY)
 - Fixed Windows sim_os_msec() to always use timeGetTime()
 - Fixed coschedule routines (that don't mentoin a tmr) to default to
    timer 0 and fallback to the internal timer otherwise.
 - Removed dependency on sizeof(tv_sec) in timespec structure for MinGW
2016-12-05 15:32:29 -08:00
Mark Pizzolato
60fb70128c TIMER: Add additional calibration skip while idling counter statistic 2016-11-28 17:40:24 -08:00
Mark Pizzolato
b83dae2db2 TIMER: Make sure internal timer doesn't restart after a CONTINUE unless needed 2016-11-27 12:37:35 -08:00
Mark Pizzolato
1ec46fbe11 TIMER: Make sure timers are properly saved and restored after ^E CONTINUE 2016-11-24 01:21:36 -08:00
Mark Pizzolato
be47d8539f TIMER: Fix Idling when transitioning betwen multiple calibrated clocks 2016-11-22 22:06:25 -08:00
Mark Pizzolato
89e372ba92 TIMER: Restore functionality for clocks devices that don't use sim_activate_after
Clock devices which call sim_register_clock_unit or sim_register_clock_unit_tmr
are best behaved if they use sim_activate_after to schedule their tick events.
2016-11-22 01:24:26 -08:00
Mark Pizzolato
f046171269 TIMER: Fix problem activation time for clock units 2016-11-20 13:06:41 -08:00
Mark Pizzolato
fc3ac62218 TIMER: Fix coscheduling to avoid a 0 delay interval
When the timer subsystem hasn't gotten fully initialized, devices may
attempt to coschedule schedule events before the clock has gotten
far enough along to be fully initialized.  When this happens we now
make sure to avoid the potential for a zero delay which will may cause
an infinite scheduling loop.
2016-11-17 16:25:19 -08:00
Mark Pizzolato
39d2944ede TIMER: Add support for catchup clock ticks and cleaned up asynchronous clocks
Asynchronous clocks are now built for all simulators which are built with
SIM_ASYNCH_IO defined.  The default behavior has asynchronous clocks
disabled since this is still experimental, but it can be enabled with
SET TIMER ASYNC.

Catchup clock ticks are now available, but since they're experimental,
they aren't enabled by default.  Catchup ticks are only available if the
simulators clock device calls sim_rtcn_tick_ack to acknowledge processing
of clock ticks.  The VAX simulators have been modified to leverage this.
Catchup clock ticks can be enabled with SET TIMER CATCHUP

Additionally, an idle threshold is provided which can be used to
influence when clock calibration may be suppressed.  The default is not
to suppress calibration activities.

The various timer behaviors are visible with the SHOW TIMER command.

The state of the operating timer facilities is visible with: SHOW CLOCK

Timer events which are queued are visible with the SHOW QUEUE command.
2016-11-16 23:50:53 -08:00
Mark Pizzolato
b8842e40e5 TIMER: Fix internal calibrated clock to be well behaved while idling. 2016-10-26 16:16:36 -07:00
Mark Pizzolato
2b61a9a92d SCP: Fix timer calibration to produce consistent results with multiple clocks
- Timers that schedule their ticks with sim_activate_after() now operate
   consistently without having to be the single timer used by a simulator.
- Simulators which dynamically enable the operation of a clock when one
   wasn't previously wasn't enabled will disable the internal calibrated timer.
2016-09-26 15:39:42 -07:00
Mark Pizzolato
a008b0a972 SCP: Fix throttling to provide reasonable operation of calibrated clocks
- Generate reasonable messages when presented with erroneous throttle input.
- Add throttling recalibration logic if only if target rate drift exceeds 5%
2016-09-14 14:12:24 -07:00
Mark Pizzolato
a24aba69ae VIDEO: Added priority boost to thread performing SDL processing and updates
Reworked all priority adjustment code to leverage a new
sim_os_set_thread_priority API which is coded to use pthreads or OS
priority adjustment APIs as necessary.
2016-06-11 09:52:33 -07:00
Mark Pizzolato
5531ccb175 ALL: Massive 'const' cleanup
These changes facilitate more robust parameter type checking and helps
to identify unexpected coding errors.

Most simulators can now also be compiled with a C++ compiler without
warnings.

Additionally, these changes have also been configured to facilitate easier
backporting of simulator and device simulation modules to run under the
simh v3.9+ SCP framework.
2016-05-15 15:25:33 -07:00
Mark Pizzolato
c8cd853102 VAX: Allow SET CPU IDLE command to not specify a stability value.
Report invalid stability values and explain why they're invalid.

Fixes #281
2016-02-26 02:17:31 -08:00
Mark Pizzolato
49d3ec8ff7 VAX: Add command support to set the idle stability delay
SET CPU IDLE={OS{:n}} where n is the idle stability delay
which is also the clock calibration delay.
A -D switch on a SHOW -D CPU IDLE command will
display the stability delay as will a SHOW CLOCK command.
2016-02-23 17:07:12 -08:00
Mark Pizzolato
9da10c1219 TIMER: Make internal calibrated clock persist across multiple boots 2016-01-28 15:12:12 -08:00