Comprehensive Performance Evaluation of Embedded Linux

Click on the above “Embedded Application Research Institute” and select “Top/Star Public Account

Useful Benefits Delivered First-Hand!

Source | Embedded Application Research Institute

Compiled & Formatted | Embedded Application Research Institute

In the early stages of pre-research for embedded projects, we often need to evaluate the resources and performance of a certain platform. Below are some of the most common evaluation indicators:
1. Memory Evaluation

The system memory space can be checked using free, cat /proc/meminfo, or top to view the memory status. Generally, there is a heuristic formula:

  • When the available memory for applications/system physical memory > 70%, it indicates that the system’s memory resources are very sufficient and do not affect system performance;

  • 20% < available memory for applications/system physical memory < 70%, it indicates that the system’s memory resources can basically meet application demands and do not temporarily affect system performance;

  • When available memory for applications/system physical memory < 20%, it indicates that the system’s memory resources are tight, and additional system memory is needed;

$ free
              total        used        free      shared  buff/cache   available
Mem:         123496       21512       75132        1132       26852       63416
Swap:             0           0           0

$ cat /proc/meminfo
MemTotal:         123496 kB //Total available memory, physical memory minus reserved space and kernel usage. The system reserves some memory from power-on until boot completion for firmware/BIOS, and the kernel itself occupies some memory. The remaining memory available for the kernel to manage is MemTotal. This value generally remains fixed during system operation and will change upon reboot.
MemFree:           75132 kB //Indicates the memory that the system has not yet used.
MemAvailable:      63400 kB //The true available memory of the system. Some memory in the system has been used but can be reclaimed, such as cache/buffer and slab, which can be partially reclaimed. Therefore, this reclaimable memory plus MemFree is the system's available memory.
Buffers:            5644 kB //Memory used for caching block devices (metadata, pages of file systems)
Cached:            19040 kB //Memory allocated to file buffers, for example, when editing a file with vi, the unsaved content will be written to this buffer.
SwapCached:            0 kB //Size of swap space (hard disk swap) used by cache
Active:            20356 kB //Size of frequently used cached pages
Inactive:          12628 kB //Size of infrequently used cached pages
Active(anon):       9412 kB //Active anonymous memory
Inactive(anon):       20 kB //Inactive anonymous memory
Active(file):      10944 kB //Active file usage memory
Inactive(file):    12608 kB //Inactive file usage memory
Unevictable:           0 kB //Memory pages that cannot be released
Mlocked:               0 kB //Memory used by system call mlock
SwapTotal:             0 kB //Total swap space memory
SwapFree:              0 kB //Free swap space memory
Dirty:                 0 kB //Memory waiting to be written back to disk
Writeback:             0 kB //Memory currently being written back
AnonPages:          8300 kB //Size of memory for unmapped pages/mapped to user space non-file page table
Mapped:            11480 kB //Mapped file memory
Shmem:              1132 kB //Allocated shared memory
KReclaimable:       2132 kB //Kernel memory, which the kernel attempts to reclaim under memory pressure
Slab:               8240 kB //Kernel data structure cache
SReclaimable:       2132 kB //Reclaimable slab memory
SUnreclaim:         6108 kB //Unreclaimable slab memory
KernelStack:         568 kB //Memory consumed by the kernel
PageTables:          516 kB //Size of the index table managing memory paging
NFS_Unstable:          0 kB //Size of unstable page tables
Bounce:                0 kB //Memory consumed by allocating a temporary buffer in low-end memory as a jump, copying cached data located in high-end memory to this place
WritebackTmp:          0 kB //Memory used by FUSE for temporary writeback buffer
CommitLimit:       61748 kB //Actual memory allocable by the system
Committed_AS:      58568 kB //Memory currently allocated by the system
VmallocTotal:    1048372 kB //Total reserved virtual memory
VmallocUsed:        1288 kB //Virtual memory that has been used
VmallocChunk:          0 kB //Largest logically contiguous virtual memory allocable
Percpu:               32 kB //Memory used by the percpu mechanism
2. Disk Evaluation

Get disk space

$ df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 6.0M      6.0M         0 100% /rom
tmpfs                    60.3M      1.1M     59.2M   2% /tmp
/dev/mtdblock6           23.8M      9.0M     14.8M  38% /overlay
overlayfs:/overlay       23.8M      9.0M     14.8M  38% /
tmpfs                   512.0K         0    512.0K   0% /dev
  • Filesystem: Indicates which partition this file system is on, so the device name is listed.
  • 1K-blocks: Indicates that the numbers below are in 1KB units. You can use -h or -m to change the unit size, or use -B to set it.
  • Used: Size of the space that has been used.
  • Available: Size of the remaining space.
  • Use%: Disk usage rate. If the usage rate is above 90%, caution is needed to avoid system issues due to insufficient disk capacity, especially for directories where file content increases rapidly (e.g., /home, /var/spool/mail, etc.).
  • Mounted on: The directory where the disk is mounted, which means the contents of this disk can be found under the mount directory.
$ cat /proc/partitions
major minor  #blocks  name

  31        0        192 mtdblock0
  31        1         64 mtdblock1
  31        2         64 mtdblock2
  31        3      32448 mtdblock3
  31        4       1962 mtdblock4
  31        5      30485 mtdblock5
  31        6      24384 mtdblock6
3. Disk Write Speed Evaluation
$ time dd if=/dev/urandom of=ranfile bs=1M count=1
1+0 records in
1+0 records out

real    0m0.126s //Actual runtime of the program
user    0m0.000s //User mode time
sys     0m0.110s //Kernel mode time
4. CPU Evaluation

Get CPU information

$ cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 2 (v7l)
BogoMIPS        : 298.80
Features        : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc08
CPU revision    : 2

Hardware        : Generic AM33XX (Flattened Device Tree)
Revision        : 0000
Serial          : 0000000000000000

BogoMIPS is a measure of the speed of computer processors in the Linux operating system. Bogo means bogus; MIPS means millions of instructions per second.

5. CPU Usage
$ uptime
 16:10:01 up  6:40,  load average: 1.27, 1.27, 1.39
  • 16:10:01: Server event
  • 6:40: Current server uptime
  • Load average: This output value should generally not exceed the number of CPUs in the system. For example, in this output, the system has 8 CPUs. If the load average values are consistently above 8, it indicates that the CPU is very busy, and the load is high, which may affect system performance. However, if it occasionally exceeds 8, it is generally not a concern. Conversely, if the load average output is less than the number of CPUs, it indicates that the CPU has free time slices. For example, in this output, the CPU is very idle.
6. System Operating Conditions
$ top
Mem: 48420K used, 75076K free, 1132K shrd, 5644K buff, 19040K cached
CPU:  30% usr  68% sys   0% nic   0% idle   0% io   0% irq   0% sirq
Load average: 1.05 1.14 1.06 2/71 6586
  PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
    7     2 root     SW       0   0%   2% [ksoftirqd/0]
 6064  5894 root     S    46772  38%   1% ./myAPP

General experience:

  • user% + sys% < 70%: Good status
  • user% + sys% = 85%: Alarm status
  • user% + sys% >= 90%: Bad status
7. Other Parameters

Current system parameters

$ ulimit -a
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 3814
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 3814
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
8. Process Resources

Creating a new process requires a minimum memory space of 8M on this machine, which can be checked through ulimit -s

$ ulimit -s
8192

Previous Highlights

2022 is coming to an end, and 2023 sets sail!

Layered Design of Embedded Software Architecture

Running Ubuntu and The Matrix on ARM boards, awesome!

Open Source Project: Creating a series of commonly used Linux application API wheels

Differences between Linux POSIX message queues and System V message queues

Developer Growth Incentive Program – Based on TencentOS Tiny FDM 3D Printer Cloud Control System Scheme

If you find this article helpful, please click<span>[Looking]</span> and share it, which is also a support for me.

Leave a Comment