Intro
This article will show you how to perform and interpret measurements of some of embedded systems computational resources. Case covered here will be an attempt to resolve a question whether our configuration will be sufficient for the given tasks, or an upgrade of the hardware specification will be necessary. IoT and embedded systems often tend to overgrow in terms of device number. It is necessary to perform such analysis and match the specification exactly with the planned workload and the profit from such action will show as the system grows larger.
Hardware configuration we will use is based on RTE with Orange Pi Zero 256MB. This is the default configuration with which the device is shipped. A question may be made, whether 256MB of memory is sufficient, or should alternative, 512MB Orange Pi Zero be worth upgrading to. We will compare the usage of memory on the two operating systems - Armbian and Yocto. We’ve used Armbian version: 5.32.170919. Armbian binaries can be downloaded here. Yocto meta-rte which we used can be found here. Memory will be checked before and during the run of regression test suite.
Tools we will use
Basic tools
These should be available on virtually every system.
free
free
displays the total amount of free and used physical and swap memory in
the system, as well as the buffers and caches used by the kernel. The
information is gathered by parsing /proc/meminfo
. Running it with -m
option
will print the values in mebibytes, which often get confused with megabytes. The
difference is that the former are express the values as powers of two, while the
latter express the values as powers of ten.
To get real-time readings we will combine it with watch
command, which will
print the result of command supplied to it with the frequency specified by
number passed to -n
parameter in seconds. The final command is
watch -n 1 free -m
top
top
program provides a dynamic real-time view of a running system. It can
display system summary information as well as a list of tasks currently being
managed by the Linux kernel. Its output is complete enough so that we won’t be
specifying any additional parameters.
/sys/class/thermal/thermal_zone
Thermal sysfs provides us with information about readings from various
temperature sensors installed. Different sensors are available as
thermal_zone[0-*] files. You can check the sensor type by reading type
file
from thermal_zone directory. In our case the CPU thermal_zone has number 0
.
Temperature is stored in temp
file as an integer. To get the output in a more
accessible format of Celsius degrees we will use such command:
|
|
Other tools that might be useful
armbianmonitor
is a simple CLI monitoring program for armbian system which
shows CPU load, percentage usage of: cpu, sys (processes executing in kernel
mode), usr (normal processes executing in user mode), nice (niced processes
executing in user mode), io (waiting for I/O to complete), irq (servicing
interrupts) and CPU temperature.
vmstat
reports information about processes, memory, paging, block IO, traps,
disks and cpu activity. The first report produced gives averages since the last
reboot. Additional reports give information on a sampling period of length
delay. The process and memory reports are instantaneous in either case.
Case study - memory and cpu usage during running regression tests
Armbian
free
output before tests:
|
|
free
output during tests:
|
|
|
|
top
output before tests:
|
|
top
output during tests:
|
|
|
|
Comparison chart
Yocto
free
output before tests:
|
|
free
output during tests:
|
|
top
output before tests:
|
|
top
output during tests:
|
|
|
|
Comparison table
Summary
As we can see, 256MB of RAM is beyond enough for current feature-set on the RTE both on Armbian and Yocto, yet there are significant differences between them as the former had almost twice as high maximal memory usage as the latter. A similar difference was seen in the maximal spike in cpu load, which on Armbian was over 4 times that of Yocto. As Yocto is not really an embedded Linux distribution, but a framework for creating your own, suited specifically to your goals and hardware it is able to provide much better performance. Armbian is a good choice for early prototyping, as it’s popular and easy to use, but for final product it is worth considering using Yocto.
3mdeb is a registered Yocto Participant and provides embedded system validation
services. If you think we can help in improving the security of your firmware or
you looking for someone who can boost your product by leveraging advanced
features of used hardware platform, feel free to
book a call with us or
drop us email to contact<at>3mdeb<dot>com
. If you are interested in similar
content feel free to sign up for our newsletter