Sample Header Ad - 728x90

Changed behavior of sleep command in Linux suspend and resume testing

0 votes
0 answers
44 views
I am working on an embedded Linux system (kernel-5.10.220). Now I am testing the suspend and resume in this system with a watchdog time as the wakeup source to wake system up from suspend. The watchdog interrupt comes in every 5 seconds, and the script calls sleep 10 to add 10 seconds delay between continous test. And there is NO RTC in system! Here is my testing script.
#!/bin/sh

trap ctrl_c INT

function ctrl_c()
{
    echo "Exiting"
    exit 0
}

count=0
sec=10

while [ true ]
do
    echo ">>>>>>>>>>> Testing suspend $count"
    echo mem > /sys/power/state
    echo ">>>>>>>>>> Testing suspend 0
>>>>>>>>>> Testing suspend 1
>>>>>>>>>> Testing suspend 2
>>>>>>>>>> Testing suspend 3
>>>>>>>>>> Testing suspend 4
>>>>>>>>>> Testing suspend 5
>>>>>>>>>> Testing suspend 6
<<<<<<<<<<< Resumed after suspend

Thu Jan  1 06:33:12 UTC 1970
From the output of date, the script did NOT delay 10 seconds between tests. The real interval of 10 seconds sleeping is about 2 or 3 seconds! So why sleep 10 did NOT sleep for 10 seconds in the suspend and resume testing?
Asked by wangt13 (631 rep)
Apr 10, 2025, 01:14 AM