Commit graph

89 commits

Author SHA1 Message Date
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
Mark Pizzolato
e1ed22f30c TIMER: Add missing type on internal calibrated clock service routine 2016-01-28 13:32:47 -08:00
Mark Pizzolato
00e8c80c7b TIMER: Provide an internal calibrated clock when none is otherwise available.
In the event that there are no active clock devices, no instruction
rate calibration will be performed.  This is more likely on simpler
simulators which don't have a full spectrum of standard devices or
possibly when a clock device exists but its use is optional and thus
sometimes it may be disabled.
2016-01-28 08:00:41 -08:00
Mark Pizzolato
ab8123e9b6 TIMER: Force at minimum of 1 instruction delay for non-zero delays in sim_activate_after(). 2016-01-10 15:53:01 -08:00
Mark Pizzolato
094cbf8295 TIMER: Avoiding conditional directives that break statements
Based on Romero B. de S. Malaquias comments Fixes #256
2015-12-17 06:44:03 -08:00
Mark Pizzolato
de0d251c75 TIMER, SCP: Change the sim_activate_after APIs to pass the delay value as uint32.
Also change all sim_defs.h structure declarations and references of sim_
structures to use the typedef names everywhere.
2015-12-10 06:33:59 -08:00
Mark Pizzolato
ac9e19e250 TIMER: Add debug support for MUX clock co-scheduling 2015-12-08 16:56:34 -08:00
Mark Pizzolato
0938d31e59 PDP11, VAX: MUX input rate limiting works correctly with input arriving on multiple lines concurrently. 2015-11-28 12:49:54 -08:00
Mark Pizzolato
62e36241a4 PDP11, VAX: Support multiplexer input speeds greater than 9600bps for console, DZ, VH, DL and DC devices
Each of the speeds greater than 9600bps deliver a character in less than
1ms.  Computing inter-character delays in microseconds therefore can't
be precise enough to be well behaved.  Measuring the inter-character
delays in instructions (scalled by the calibrated clock) gets us the needed
precision.
2015-11-25 04:25:21 -08:00
Mark Pizzolato
44ef17f971 TIMER: Fix recently revised sim_idle_capable for hosts which aren't idle capable. 2015-11-23 15:45:46 -08:00
Mark Pizzolato
b3b038900c TIMER: Fix clock calibration after a host OS sleep/hibernate 2015-11-23 12:55:42 -08:00
Mark Pizzolato
668761a460 SCP: Add display of host OS clock resolution to SHOW VERSION 2015-11-23 07:30:28 -08:00
Mark Pizzolato
4a1cf3587f TIMER: Fix sim_timer_activate_after to avoid overflow
The conversion of time to instructions can overflow an int32 when the
current instructions per second is high and the delay interval is high.

We limit the instruction delay to the maximum value available in an int32,
which for essentially all cases won't matter since the resulting delay is used
for a drop dead timeout and doesn't need to be precise or it will be
canceled before it ever fires anyway.
2015-11-13 08:28:20 -08:00
Mark Pizzolato
ef6528bf32 SCP: Added automatic saving of console WRU, DEL, BRK and PCHAR console variables and provided a way for a simulator to declare that is doesn't have a console port so automatic WRU detection can be performed. 2015-04-03 16:05:01 -07:00
Mark Pizzolato
4eed007607 SCP: Restructured timer/co-scheduling activities to support co-scheduling on specific timers 2014-12-02 05:33:59 -08:00
Mark Pizzolato
2e1167d4a0 Compiler suggested cleanups - mostly const fixups 2014-10-26 17:06:24 -07:00
Mark Pizzolato
3951ad2432 Cleanup of unneeded global extern declarations 2014-10-10 08:18:15 -07:00
Mark Pizzolato
e8114cf088 SCP: Fix errant display of NEXT warning on first STEP command. From Peter Schorn
Better display in SHOW VERSION of full compiler name on OSX when using the clang LLVM compilers
Change stray non-ascii quote characters in comments.
2014-04-18 04:58:27 -07:00
Mark Pizzolato
6ce8d99cd8 SCP: Added generic output routine sim_printf to output to stdout and sim_log (and sim_deb when enabled)
The goals here being to simplify calling code while getting consistent output delivered everywhere it may be useful.

Modified most places which explicitly used sim_log or merely called printf to now avoid doing that and merely call sim_printf().
2014-03-28 08:20:05 -07:00
Mark Pizzolato
02cb5c2d88 Compiler suggested cleanups.
Mostly silencing noise warnings, but bugs were found in sim_console.c and pdp11_dmc.c
2014-02-14 17:07:45 -08:00
Mark Pizzolato
6be61242da SCP: Add timer logic description comments to sim_timer 2013-09-08 17:27:58 -07:00
Mark Pizzolato
c097ae5e57 Added help info to asynchronous timer device 2013-05-15 05:43:14 -07:00
Mark Pizzolato
ddb10425e7 Reworked all asynch queues to always link using the unit a_next field instead of the next field. 2013-05-08 09:34:53 -07:00
Mark Pizzolato
6c6d641034 Tolerate race condition which results in spurious timer thread wakeups which were causing the timer thread to exit. (SIM_ASYNCH_CLOCKS) 2013-05-07 11:40:07 -07:00
Mark Pizzolato
6cf54e8341 Fixes for stable operation with SIM_ASYNCH_CLOCKS defined 2013-05-07 11:22:29 -07:00
Mark Pizzolato
f8da94e001 Fixed compile and operational behaviors when running with SIM_ASYNCH_CLOCKS enabled 2013-05-04 12:22:50 -07:00
Mark Pizzolato
4bd72e666c Compiler and static analyzer fixes from Peter Schorn. 2013-04-13 16:59:54 -07:00
Mark Pizzolato
a262dd9c14 Compiler indicated cleanups 2013-03-19 01:11:22 -07:00
Mark Pizzolato
d3ec5a6965 Fix to properly reference the correct routine during initial clock calibration introduced in commit: c45a377c7 2013-03-17 11:02:46 -07:00
Mark Pizzolato
de483074e6 Cleanup for build on VMS 2013-03-16 11:44:34 -07:00
Mark Pizzolato
c45a377c71 Use the same sleep API to determine the host minimal sleep time that will be used depending on whether ASYNCH_IO is enabled 2013-03-15 19:14:58 -07:00