Commit graph

144 commits

Author SHA1 Message Date
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
Mark Pizzolato
a47c04bcac TIMER: Fix throttle startup delay check 2018-04-06 02:20:29 -07:00
Mark Pizzolato
2bcb60e76f TIMER: Add external initialization option for clock calibration
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.
2018-04-06 01:46:44 -07:00
Mark Pizzolato
317e2a8e54 TIMER: make sim_activate_after use coscheduling whenever possible.
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
2018-04-03 02:06:14 -07:00
Mark Pizzolato
097ebbb8eb TIMER: Synchronize clock calibration with throttled rate when throttling starts
As discussed in #508
2018-01-28 08:23:45 -08:00
Mark Pizzolato
7fbe5e8530 TIMER: Avoid throttling recalibration when resuming execution
As discussed in #508
2018-01-23 08:53:04 -08:00
Mark Pizzolato
fd80be4e91 TIMER: Properly serialize (and reference) asynch timer thread state
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.
2018-01-23 07:30:20 -08:00
Mark Pizzolato
f3d1076887 TIMER: Fix throttling calibration and recalibration
- 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
2018-01-16 21:44:25 -08:00
Mark Pizzolato
a4a6a1d409 SCP: Fix regression which disabled limit check when parsing unsigned integers
This affected unit and tmxr line checks when there was only one unit or line.
2017-12-05 12:23:31 -08:00
Mark Pizzolato
2435311072 SCP: Add DEV_NOSAVE flag for throttle and console internal devices 2017-10-08 10:10:03 -07:00
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