From 0275ef05e87b72f63347a526b426973e070d210b Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Thu, 29 Dec 2016 09:47:09 -0800 Subject: [PATCH] All VAX: Lower overhead when idling. The original idling model called sim_idle() within the context of a scheduled event running on the CPU unit. The overhead of scheduling and the related dispatch serve no specific purpose. Meanwhile, the 'work' involved in determing if idling is possible is about equivalent to the work of executing an additional instruction. Therefore sim_idle is invoked with an argument which causes the sim_interval to be adjusted by 1 on each call that doesn't actually perform an idle sleep. This adjustment keeps the calibrated instruction execution rate consistent with other purely non-idle instruction mixes. --- VAX/vax_cpu.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/VAX/vax_cpu.c b/VAX/vax_cpu.c index 788dd9b0..ab3ad723 100644 --- a/VAX/vax_cpu.c +++ b/VAX/vax_cpu.c @@ -319,7 +319,6 @@ static SIM_INLINE int32 get_istr (int32 lnt, int32 acc); int32 ReadOcta (int32 va, int32 *opnd, int32 j, int32 acc); t_bool cpu_show_opnd (FILE *st, InstHistory *h, int32 line); t_stat cpu_show_hist_records (FILE *st, t_bool do_header, int32 start, int32 count); -t_stat cpu_idle_svc (UNIT *uptr); void cpu_idle (void); /* CPU data structures @@ -331,7 +330,7 @@ void cpu_idle (void); */ UNIT cpu_unit = { - UDATA (&cpu_idle_svc, UNIT_FIX|UNIT_BINK, INITMEMSIZE) + UDATA (NULL, UNIT_FIX|UNIT_BINK, INITMEMSIZE) }; const char *psl_modes[] = {"K", "E", "S", "U"}; @@ -3176,20 +3175,11 @@ opnd[j++] = Read (va + 12, L_LONG, acc); return j; } -/* Schedule idle before the next instruction */ +/* Idle before the next instruction */ void cpu_idle (void) { -sim_activate (&cpu_unit, 0); -return; -} - -/* Idle service */ - -t_stat cpu_idle_svc (UNIT *uptr) -{ -sim_idle (TMR_CLK, TRUE); -return SCPE_OK; +sim_idle (TMR_CLK, 1); } /* Reset */