From 668761a460d4145de413c9a52a8342ac75d2e319 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 23 Nov 2015 07:30:28 -0800 Subject: [PATCH] SCP: Add display of host OS clock resolution to SHOW VERSION --- scp.c | 3 ++- sim_timer.c | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/scp.c b/scp.c index 2921aa05..9116a43e 100644 --- a/scp.c +++ b/scp.c @@ -4332,7 +4332,8 @@ if (flag) { #else fprintf (st, "\n\t\tNo RegEx support for EXPECT commands"); #endif - fprintf (st, "\n\t\tOS clock tick size (time taken by msleep(1)): %dms", os_tick_size); + fprintf (st, "\n\t\tOS clock resolution: %dms", os_tick_size); + fprintf (st, "\n\t\tTime taken by msleep(1): %dms", idle_capable); #if defined(__VMS) if (1) { char *arch = diff --git a/sim_timer.c b/sim_timer.c index 1e5afff7..641149d8 100644 --- a/sim_timer.c +++ b/sim_timer.c @@ -92,6 +92,7 @@ static int32 sim_calb_tmr = -1; /* the system calibrated tim static uint32 sim_idle_rate_ms = 0; static uint32 sim_os_sleep_min_ms = 0; +static uint32 sim_os_clock_resoluton_ms = 0; static uint32 sim_idle_stable = SIM_IDLE_STDFLT; static t_bool sim_idle_idled = FALSE; static uint32 sim_throt_ms_start = 0; @@ -709,6 +710,7 @@ return sim_rtcn_calb (ticksper, 0); t_bool sim_timer_init (void) { int i; +uint32 clock_start, clock_last, clock_now; sim_debug (DBG_TRC, &sim_timer_dev, "sim_timer_init()\n"); for (i=0; i 0) && (clock_diff < sim_os_clock_resoluton_ms)) + sim_os_clock_resoluton_ms = clock_diff; + clock_last = clock_now; + } while (clock_now < clock_start + 100); return (sim_idle_rate_ms != 0); } @@ -725,7 +739,7 @@ return (sim_idle_rate_ms != 0); uint32 sim_timer_idle_capable (uint32 *host_tick_ms) { if (host_tick_ms) - *host_tick_ms = sim_os_sleep_min_ms; + *host_tick_ms = sim_os_clock_resoluton_ms; return sim_idle_rate_ms; }