为了了解核心资源,今天根据《MYD-YG2LX_Linux软件评估指南.pdf》对开发板的核心资源进行测试。
读取系统中的 CPU 的提供商和参数信息,则可以通过/proc/cpuinfo 文件得到。
root@myir-yg2lx:~# cat /proc/cpuinfo
processor : 0
BogoMIPS : 48.00
Features : fp asimd evtstrm crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x2
CPU part : 0xd05
CPU revision : 0
processor : 1
BogoMIPS : 48.00
Features : fp asimd evtstrm crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x2
CPU part : 0xd05
CPU revision : 0
root@myir-yg2lx:~# top
top - 00:24:41 up 24 min, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 107 total, 1 running, 106 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.3 us, 0.5 sy, 0.0 ni, 98.8 id, 0.0 wa, 0.2 hi, 0.2 si, 0.0 st
MiB Mem : 855.9 total, 430.8 free, 209.8 used, 215.4 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 570.4 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
358 root 20 0 362852 70344 36348 S 0.7 8.0 0:12.13 mxapp2
548 root 20 0 4616 2460 2020 R 0.7 0.3 0:00.07 top
7 root 20 0 0 0 0 I 0.3 0.0 0:01.29 kworker+
110 root 20 0 0 0 0 I 0.3 0.0 0:01.38 kworker+
222 root 20 0 1784 412 348 S 0.3 0.0 0:00.18 watchdo+
387 root 20 0 1432744 77964 35256 S 0.3 8.9 0:07.42 dockerd
396 root 20 0 1328624 45456 18588 S 0.3 5.2 0:06.68 contain+
1 root 20 0 10352 7564 5036 S 0.0 0.9 0:05.77 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par+
8 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_perc+
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_tas+
10 root 20 0 0 0 0 S 0.0 0.0 0:00.16 ksoftir+
11 root 20 0 0 0 0 I 0.0 0.0 0:00.36 rcu_pre+
12 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migrati+
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0
root@myir-yg2lx:~# cat /sys/class/thermal/thermal_zone0/temp
47000
上面显示数字为千分之一度,除以 1000 就是当前温度值。
我们通过 bc 命令来计算圆周率方法来测试 CPU 在运算过程中的稳定性。
root@myir-yg2lx:/# echo "scale=5000; 4*a(1)" | bc -l -q &[1] 563
root@myir-yg2lx:~# top
top - 00:33:31 up 33 min, 1 user, load average: 0.29, 0.09, 0.02
Tasks: 108 total, 2 running, 106 sleeping, 0 stopped, 0 zombie
%Cpu(s): 50.2 us, 0.3 sy, 0.0 ni, 49.3 id, 0.0 wa, 0.2 hi, 0.0 si, 0.0 st
MiB Mem : 855.9 total, 464.7 free, 176.5 used, 214.7 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 604.5 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
565 root 20 0 2760 1616 1360 R 100.0 0.2 0:18.92 bc
567 root 20 0 4616 2332 1892 R 0.7 0.3 0:00.09 top
11 root 20 0 0 0 0 I 0.3 0.0 0:00.46 rcu_pre+
387 root 20 0 1432744 77964 35256 S 0.3 8.9 0:09.99 dockerd
396 root 20 0 1328624 45552 18588 S 0.3 5.2 0:09.17 contain+
1 root 20 0 10352 7564 5036 S 0.0 0.9 0:05.94 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par+
7 root 20 0 0 0 0 I 0.0 0.0 0:01.74 kworker+
8 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_perc+
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_tas+
10 root 20 0 0 0 0 S 0.0 0.0 0:00.16 ksoftir+
12 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migrati+
13 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/1
15 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migrati+
我们看到CPU占用一直是100%
经过一段时间的测试,我们看到计算出了圆周率:
读取系统中的内存的参数信息,则可以通过/proc/meminfo 文件得到。
root@myir-yg2lx:~# cat /proc/meminfo
MemTotal: 876452 kB
MemFree: 476080 kB
MemAvailable: 619184 kB
Buffers: 5788 kB
Cached: 201480 kB
SwapCached: 0 kB
Active: 27224 kB
Inactive: 278828 kB
Active(anon): 608 kB
Inactive(anon): 106696 kB
Active(file): 26616 kB
Inactive(file): 172132 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 4 kB
Writeback: 0 kB
AnonPages: 98852 kB
Mapped: 70956 kB
Shmem: 10436 kB
KReclaimable: 12612 kB
Slab: 71732 kB
SReclaimable: 12612 kB
SUnreclaim: 59120 kB
KernelStack: 3232 kB
PageTables: 2092 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 438224 kB
Committed_AS: 1093704 kB
VmallocTotal: 135290159040 kB
VmallocUsed: 4708 kB
VmallocChunk: 0 kB
Percpu: 680 kB
AnonHugePages: 36864 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
FileHugePages: 0 kB
FilePmdMapped: 0 kB
CmaTotal: 393216 kB
CmaFree: 238040 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
可使用 free 命令来读取内存的使用情况,-m 参数代表单位为 MByte。
通过给定测试内存的大小和次数, 可以对系统现有的内存进行压力上的测试。可使用系统工具 memtester 进行测试,如指定内存大小 100MB,测试次数为 5,测试命令为
“memtester 100M 5"。
下列以使用 100MB 内存空间,单次测试为例:
root@myir-yg2lx:~# memtester 100M 5
memtester version 4.3.0 (64-bit)
Copyright (C) 2001-2012 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).
pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 100MB (104857600 bytes)
got 100MB (104857600 bytes), trying mlock ...locked.
Loop 1/5:
Stuck Address : ok
Random Value : ok
Compare XOR : ok
Compare SUB : ok
Compare MUL : ok
Compare DIV : ok
Compare OR : ok
Compare AND : ok
Sequential Increment: ok
Solid Bits : ok
Block Sequential : ok
Checkerboard : ok
Bit Spread : ok
Bit Flip : ok
Walking Ones : ok
Walking Zeroes : ok
Loop 2/5:
Stuck Address : ok
Random Value : ok
Compare XOR : ok
Compare SUB : ok
Compare MUL : ok
Compare DIV : ok
Compare OR : ok
Compare AND : ok
Sequential Increment: ok
Solid Bits : ok
Block Sequential : ok
Checkerboard : ok
Bit Spread : ok
Bit Flip : ok
Walking Ones : ok
Walking Zeroes : ok
Loop 3/5:
Stuck Address : ok
Random Value : ok
Compare XOR : ok
Compare SUB : ok
Compare MUL : ok
Compare DIV : ok
Compare OR : ok
Compare AND : ok
Sequential Increment: ok
Solid Bits : ok
Block Sequential : ok
Checkerboard : ok
Bit Spread : ok
Bit Flip : ok
Walking Ones : ok
Walking Zeroes : ok
Loop 4/5:
Stuck Address : ok
Random Value : ok
Compare XOR : ok
Compare SUB : ok
Compare MUL : ok
Compare DIV : ok
Compare OR : ok
Compare AND : ok
Sequential Increment: ok
Solid Bits : ok
Block Sequential : ok
Checkerboard : ok
Bit Spread : ok
Bit Flip : ok
Walking Ones : ok
Walking Zeroes : ok
Loop 5/5:
Stuck Address : ok
Random Value : ok
Compare XOR : ok
Compare SUB : ok
Compare MUL : ok
Compare DIV : ok
Compare OR : ok
Compare AND : ok
Sequential Increment: ok
Solid Bits : ok
Block Sequential : ok
Checkerboard : ok
Bit Spread : ok
Bit Flip : ok
Walking Ones : ok
Walking Zeroes : ok
Done.
内存压力测试顺利通过。
【小结】
通以上的核心资源查看,并测试了CPU、内存的压力测试
全部0条评论
快来发表一下你的评论吧 !