I use an under-clocked Rasberry Pi 4 to save power using these settings in /boot/config.txt:
arm_freq=700
arm_freq_min=100
core_freq=250
core_freq_min=75
sdram_freq=400
over_voltage=0
# source
# https://www.foxplex.com/sites/raspberry-pi-over-und-underclocking/
and only 1 cpu (maxcpus=1 in /boot/cmdline.txt). Unfortunately, the shell command sleep 10 (and the equivalent commands in Python or Julia) now waits 43 seconds instead of 10. Any ideas how this can be corrected?
When the CPU is under-clocked I get these timings (as suggested by @Seamus):
pi@drifter02:~ $ date +%M:%S:%N; sleep 10.; date +%M:%S:%N
42:18:636998788
43:21:810109674
pi@drifter02:~ $ date +%M:%S:%N; sleep 10.; date +%M:%S:%N
43:24:804538802
43:34:815360222
pi@drifter02:~ $ date +%M:%S:%N; sleep 10.; date +%M:%S:%N
43:36:331290110
43:46:341481104
pi@drifter02:~ $ date +%M:%S:%N; sleep 10.; date +%M:%S:%N
43:49:616077991
44:54:628062596
Even if the the two timestamps of date report 10 s (2nd and 3rd test), it does not correspond to what I see with a stop watch. Or using the time command over ssh, I get more consistent timings (but consistently wrong)
$ date +%M:%S:%N; ssh pi@192.168.0.199 sleep 10.; date +%M:%S:%N;
50:07:581271832
50:34:179524391
$ date +%M:%S:%N; ssh pi@192.168.0.199 sleep 10.; date +%M:%S:%N;
50:35:132595217
51:07:345482960
$ date +%M:%S:%N; ssh pi@192.168.0.199 sleep 10.; date +%M:%S:%N;
51:08:313846466
51:36:433839692
$ date +%M:%S:%N; ssh pi@192.168.0.199 sleep 10.; date +%M:%S:%N;
52:03:028000964
52:37:534952569
Just executing pwd takes about 0.5 s, so the time it take to make a SSH connection cannot be blamed.
$ date +%M:%S:%N; ssh pi@192.168.0.199 pwd; date +%M:%S:%N;
54:03:634693731
/home/pi
54:04:184457211
Without under-clocking, the timings are correct.
More infos:
- Raspberry Pi 4 Model B Rev 1.5
- Linux 5.15.61-v8+, aarch64
- Debian GNU/Linux 11 (OS reported in
/etc/issue) - Installation image: Rapberry Pi OS Lite (64-bit)