/** Detect suspend/resume cycle from CLOCK_MONOTONIC vs CLOCK_BOOTTIME */ static void io_detect_resume(void) { static int64_t prev = 0; int64_t boot = io_get_boot_tick(); int64_t mono = io_get_mono_tick(); int64_t diff = boot - mono; int64_t skip = diff - prev; // small jitter can be due to scheduling too if( skip < 100 ) goto EXIT; prev = diff; // no logging from the 1st time skip if( prev == skip ) goto EXIT; mce_log(LL_DEVEL, "time skip: assume %"PRId64".%03"PRId64"s suspend", skip / 1000, skip % 1000); EXIT: return; }
/** Detect suspend/resume cycle from CLOCK_MONOTONIC vs CLOCK_BOOTTIME */ static void io_detect_resume(void) { static int64_t prev = 0; int64_t boot = io_get_boot_tick(); int64_t mono = io_get_mono_tick(); int64_t diff = boot - mono; int64_t skip = diff - prev; // small jitter can be due to scheduling too if( skip < 100 ) goto EXIT; prev = diff; // no logging from the 1st time skip if( prev == skip ) goto EXIT; mce_log(LL_DEVEL, "time skip: assume %"PRId64".%03"PRId64"s suspend", skip / 1000, skip % 1000); // notify in case some timers need re-evaluating execute_datapipe_output_triggers(&device_resumed_pipe, &prev, USE_INDATA); EXIT: return; }