SCP: Adjust RUNLIMIT time values on slow host systems
As reported and discussed in #819
This commit is contained in:
parent
45d7a1155b
commit
ee317e0cb4
5 changed files with 33 additions and 2 deletions
|
@ -8,6 +8,9 @@ cd %~p0
|
||||||
|
|
||||||
:: Limit maximum diagnostic execution time
|
:: Limit maximum diagnostic execution time
|
||||||
runlimit 2 minutes
|
runlimit 2 minutes
|
||||||
|
set on
|
||||||
|
on error ignore
|
||||||
|
on runtime echof "\r\n*** Test Runtime Limit %SIM_RUNLIMIT% %SIM_RUNLIMIT_UNITS% Exceeded ***\n"; exit 1
|
||||||
|
|
||||||
:: Maximum memory, extended address element:
|
:: Maximum memory, extended address element:
|
||||||
set cpu 32k
|
set cpu 32k
|
||||||
|
|
|
@ -19,6 +19,10 @@
|
||||||
#break A3B4 SHOW HIST=40
|
#break A3B4 SHOW HIST=40
|
||||||
cd %~p0
|
cd %~p0
|
||||||
set runlimit 2 minutes
|
set runlimit 2 minutes
|
||||||
|
set on
|
||||||
|
on error ignore
|
||||||
|
on runtime echof "\r\n*** Test Runtime Limit %SIM_RUNLIMIT% %SIM_RUNLIMIT_UNITS% Exceeded ***\n"; exit 1
|
||||||
|
|
||||||
set env DIAG_QUIET_MODE=0
|
set env DIAG_QUIET_MODE=0
|
||||||
if ("%1" == "-v") set console notelnet
|
if ("%1" == "-v") set console notelnet
|
||||||
else set -qu console telnet=localhost:65432,telnet=buffered; set env -a DIAG_QUIET_MODE=1
|
else set -qu console telnet=localhost:65432,telnet=buffered; set env -a DIAG_QUIET_MODE=1
|
||||||
|
|
19
scp.c
19
scp.c
|
@ -7005,6 +7005,8 @@ char gbuf[CBUFSIZE];
|
||||||
int32 num;
|
int32 num;
|
||||||
t_stat r;
|
t_stat r;
|
||||||
double usec_factor = 1.0;
|
double usec_factor = 1.0;
|
||||||
|
const char *units = "";
|
||||||
|
char runlimit[32];
|
||||||
|
|
||||||
GET_SWITCHES (cptr); /* get switches */
|
GET_SWITCHES (cptr); /* get switches */
|
||||||
if (0 == flag) {
|
if (0 == flag) {
|
||||||
|
@ -7014,6 +7016,8 @@ if (0 == flag) {
|
||||||
sim_runlimit_switches = 0;
|
sim_runlimit_switches = 0;
|
||||||
sim_runlimit_enabled = FALSE;
|
sim_runlimit_enabled = FALSE;
|
||||||
sim_cancel (&sim_runlimit_unit);
|
sim_cancel (&sim_runlimit_unit);
|
||||||
|
unsetenv ("SIM_RUNLIMIT");
|
||||||
|
unsetenv ("SIM_RUNLIMIT_UNITS");
|
||||||
return SCPE_OK;
|
return SCPE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7023,8 +7027,10 @@ if ((r != SCPE_OK) || (num == 0)) /* error? */
|
||||||
return sim_messagef (SCPE_ARG, "Invalid argument: %s\n", gbuf);
|
return sim_messagef (SCPE_ARG, "Invalid argument: %s\n", gbuf);
|
||||||
cptr = get_glyph (cptr, gbuf, 0); /* get next glyph */
|
cptr = get_glyph (cptr, gbuf, 0); /* get next glyph */
|
||||||
if ((gbuf[0] == '\0') ||
|
if ((gbuf[0] == '\0') ||
|
||||||
(MATCH_CMD (gbuf, sim_vm_interval_units) == 0))
|
(MATCH_CMD (gbuf, sim_vm_interval_units) == 0)) {
|
||||||
sim_switches &= ~SWMASK ('T');
|
sim_switches &= ~SWMASK ('T');
|
||||||
|
units = sim_vm_interval_units;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
int i;
|
int i;
|
||||||
struct {
|
struct {
|
||||||
|
@ -7042,6 +7048,7 @@ else {
|
||||||
if (MATCH_CMD (gbuf, time_units[i].name) == 0) {
|
if (MATCH_CMD (gbuf, time_units[i].name) == 0) {
|
||||||
sim_switches |= SWMASK ('T');
|
sim_switches |= SWMASK ('T');
|
||||||
usec_factor = time_units[i].usec_factor;
|
usec_factor = time_units[i].usec_factor;
|
||||||
|
units = time_units[i].name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7054,11 +7061,19 @@ sim_runlimit_enabled = TRUE;
|
||||||
sim_cancel (&sim_runlimit_unit);
|
sim_cancel (&sim_runlimit_unit);
|
||||||
sim_runlimit_switches = sim_switches;
|
sim_runlimit_switches = sim_switches;
|
||||||
if (sim_runlimit_switches & SWMASK ('T')) {
|
if (sim_runlimit_switches & SWMASK ('T')) {
|
||||||
sim_runlimit_d_initial = sim_runlimit_d = num * usec_factor;
|
sim_runlimit_d_initial = sim_runlimit_d = num * usec_factor * sim_host_speed_factor ();
|
||||||
|
if (sim_host_speed_factor () > 1.0)
|
||||||
|
sim_messagef (SCPE_OK, "Slow host - adjusting RUNLIMIT from %d %s to %.1f %s\n", num, units, num * sim_host_speed_factor (), units);
|
||||||
|
snprintf (runlimit, sizeof (runlimit), "%.f", num * sim_host_speed_factor ());
|
||||||
|
setenv ("SIM_RUNLIMIT", runlimit, 1);
|
||||||
|
setenv ("SIM_RUNLIMIT_UNITS", units, 1);
|
||||||
return sim_activate_after_d (&sim_runlimit_unit, sim_runlimit_d);
|
return sim_activate_after_d (&sim_runlimit_unit, sim_runlimit_d);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sim_runlimit_initial = sim_runlimit = num;
|
sim_runlimit_initial = sim_runlimit = num;
|
||||||
|
snprintf (runlimit, sizeof (runlimit), "%d", num);
|
||||||
|
setenv ("SIM_RUNLIMIT", runlimit, 1);
|
||||||
|
setenv ("SIM_RUNLIMIT_UNITS", units, 1);
|
||||||
return sim_activate (&sim_runlimit_unit, sim_runlimit);
|
return sim_activate (&sim_runlimit_unit, sim_runlimit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3467,3 +3467,11 @@ for (tmr=0; tmr<=SIM_NTIMERS; tmr++) {
|
||||||
sim_inst_per_sec_last = sim_precalibrate_ips;
|
sim_inst_per_sec_last = sim_precalibrate_ips;
|
||||||
sim_idle_stable = 0;
|
sim_idle_stable = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
sim_host_speed_factor (void)
|
||||||
|
{
|
||||||
|
if (sim_precalibrate_ips > SIM_INITIAL_IPS)
|
||||||
|
return 1.0;
|
||||||
|
return (double)SIM_INITIAL_IPS / (double)sim_precalibrate_ips;
|
||||||
|
}
|
||||||
|
|
|
@ -158,6 +158,7 @@ t_stat sim_os_set_thread_priority (int below_normal_above);
|
||||||
uint32 sim_get_rom_delay_factor (void);
|
uint32 sim_get_rom_delay_factor (void);
|
||||||
void sim_set_rom_delay_factor (uint32 delay);
|
void sim_set_rom_delay_factor (uint32 delay);
|
||||||
int32 sim_rom_read_with_delay (int32 val);
|
int32 sim_rom_read_with_delay (int32 val);
|
||||||
|
double sim_host_speed_factor (void);
|
||||||
|
|
||||||
extern t_bool sim_idle_enab; /* idle enabled flag */
|
extern t_bool sim_idle_enab; /* idle enabled flag */
|
||||||
extern volatile t_bool sim_idle_wait; /* idle waiting flag */
|
extern volatile t_bool sim_idle_wait; /* idle waiting flag */
|
||||||
|
|
Loading…
Add table
Reference in a new issue