Lina
Posts: 4
Joined: Wed Aug 12, 2015 5:00 pm
Location: France
Contact: Website

FreeBSD auto-cpu scalling

Sat Aug 22, 2015 3:36 pm

Hey !

Actually there is no automatic cpu scalling on FreeBSD ARM. So your CPU frequency will always be at 600 Mhz. As you can see :
dev.cpu.0.freq_levels: 900/-1 600/-1
dev.cpu.0.freq: 600
Of course you can set manually your CPU to 900 Mhz by doing :
# sysctl dev.cpu.0.freq=900
But I don't want to have a 900 Mhz CPU all the time. So I created a python script which will check the load average every 10 seconds and scale the frequency when needed.

You can download it here : http://lina.devio.us/pycpuscalefbsdpi.py

To launch it at system startup :
# crontab -e
@reboot /your/path/to/python /your/path/pycpuscalefbsdpi.py > /dev/null 2>&1
Last edited by Lina on Mon Aug 24, 2015 6:18 am, edited 2 times in total.
http://blog.cagedmonster.net/ - Geek / Unix / Linux / Raspberry

Lina
Posts: 4
Joined: Wed Aug 12, 2015 5:00 pm
Location: France
Contact: Website

Re: FreeBSD auto-cpu scalling for RPI2

Sun Aug 23, 2015 1:12 pm

UPDATE : I updated the script so it can directly read dev.cpu.0.freq_levels values. It means the script will work with every version of Raspberry PI or if you have an overclocked Raspberry PI.
http://blog.cagedmonster.net/ - Geek / Unix / Linux / Raspberry

Psypro
Posts: 25
Joined: Sat Feb 21, 2015 4:09 pm

Re: FreeBSD auto-cpu scalling

Wed Dec 16, 2015 5:55 pm

sysctl dev.cpu.0.freq=900

This works.
But if I want it to work every reboot?
I tried adding it to /etc/sysctl_conf, that had no effect as far as i could tell with a :


root@rpi2:/home/freebsd # sysctl dev.cpu.0
dev.cpu.0.temperature: 45.5C
dev.cpu.0.freq_levels: 900/-1 600/-1
dev.cpu.0.freq: 600
dev.cpu.0.%parent: cpulist0
dev.cpu.0.%pnpinfo: name=cpu@0 compat=arm,cortex-a7
dev.cpu.0.%location:
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: Open Firmware CPU

hornpipe2
Posts: 1
Joined: Sat Dec 10, 2016 6:51 pm

Re: FreeBSD auto-cpu scalling

Sat Dec 10, 2016 6:54 pm

This should be unnecessary... you should instead use the powerd daemon to control dynamic frequency scaling.

Edit /etc/rc.conf:

Code: Select all

powerd_enable="YES"
Then restart the daemon:
/etc/rc.d/powerd restart

Or just reboot the Pi. sysctl -a shows these values for my (overclocked) machine:

Code: Select all

dev.cpu.0.freq_levels: 1000/-1 900/-1 800/-1 700/-1 600/-1 500/-1 400/-1 300/-1
dev.cpu.0.freq: 1000

Return to “FreeBSD”

Who is online

Users browsing this forum: No registered users and 3 guests