How to monitor CPU usage on a device running embedded Linux and BusyBox

busyboxcpu-usagemonitoring

I recently began working with a device that uses embedded Linux and BusyBox. It is very stripped down, and does not have iostat or sar. It also doesn't have dpkg or apt for package management. The system is a development black-box under a non-disclosure agreement, O.S. version info is:

Linux localhost 2.6.34 #1 SMP Fri Sep 14 10:12:23 EDT 2012 armv7l GNU/Linux

I'd like to monitor system resources, particularly CPU and memory usage, and am wondering how to do this. It appears that the only command available through BusyBox is top, and I'd like other alternatives.

I guess I could cross-compile sar on my Windows development system and somehow copy it over, but I've never done that… however, am willing to give it a try if that's my best option, so tips in that area would be appreciated.

Edit: After reading Linux Implementation of SAR, it appears I wouldn't simply cross-compile sar, rather the sysstat suite of utilities which contains sar and other related commands.

Best Answer

/proc/loadavg and /proc/meminfo should be available, so you could do

cat /proc/loadavg
cat /proc/meminfo

in a small script and process it.