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 "<<<<<<<<<<< Resumed after suspend" echo "" count=$((count+1)) date echo "Sleeping for $sec seconds" sleep $sec done When I ran the script, I got following results.
>>>>>>>>>>> Testing suspend 0 <<<<<<<<<<< Resumed after suspend Thu Jan 1 06:32:54 UTC 1970 Sleeping for 10 seconds >>>>>>>>>>> Testing suspend 1 <<<<<<<<<<< Resumed after suspend Thu Jan 1 06:33:06 UTC 1970 Sleeping for 10 seconds >>>>>>>>>>> Testing suspend 2 <<<<<<<<<<< Resumed after suspend Thu Jan 1 06:33:07 UTC 1970 Sleeping for 10 seconds >>>>>>>>>>> Testing suspend 3 <<<<<<<<<<< Resumed after suspend Thu Jan 1 06:33:08 UTC 1970 Sleeping for 10 seconds >>>>>>>>>>> Testing suspend 4 <<<<<<<<<<< Resumed after suspend Thu Jan 1 06:33:10 UTC 1970 Sleeping for 10 seconds >>>>>>>>>>> Testing suspend 5 <<<<<<<<<<< Resumed after suspend Thu Jan 1 06:33:11 UTC 1970 Sleeping for 10 seconds >>>>>>>>>>> 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?