【米尔瑞萨RZ/G2L开发板-试用体验】CPU、内存等压力测试
为了了解核心资源,今天根据《MYD-YG2LX_Linux软件评估指南.pdf》对开发板的核心资源进行测试。查看 CPU 信息命令读取系统中的 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
[*]processor:系统中逻辑处理核的编号,对于多核处理器则可以是物理核、或者使用超线程技术虚拟的逻辑核
[*]BogoMIPS :在系统内核启动时粗略测算的 CPU 每秒运行百万条指令数(MillionInstructions Per Second)
CPU使用情况:
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 PRNI VIRT RES SHR S%CPU%MEM TIME+ COMMAND
358 root 20 03628527034436348 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 14327447796435256 S 0.3 8.9 0:07.42 dockerd
396 root 20 0 13286244545618588 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
[*]%us:表示用户空间程序的 cpu 使用率(没有通过 nice 调度)
[*]%sy:表示系统空间的 cpu 使用率,主要是内核程序
[*]%ni:表示用户空间且通过 nice 调度过的程序的 cpu 使用率
[*]%id:空闲 cpu
[*]%wa: 等待输入输出的 CPU 时间百分比
[*]%hi:cpu 处理硬中断的数量
[*]%si:cpu 处理软中断的数量 %st: 实时
获取 CPU 温度信息
root@myir-yg2lx:~# cat /sys/class/thermal/thermal_zone0/temp
47000
上面显示数字为千分之一度,除以 1000 就是当前温度值。
CPU 压力测试我们通过 bc 命令来计算圆周率方法来测试 CPU 在运算过程中的稳定性。
root@myir-yg2lx:/# echo "scale=5000; 4*a(1)" | bc -l -q & 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 PRNI 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 14327447796435256 S 0.3 8.9 0:09.99 dockerd
396 root 20 0 13286244555218588 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%
https://file1.elecfans.com/web2/M00/82/CF/wKgaomRjDGqAIEemAAFK6o3sWio874.png
经过一段时间的测试,我们看到计算出了圆周率:
https://file1.elecfans.com/web2/M00/82/D0/wKgZomRjDNCAKospAAMOA0dg_Mk503.png
查看内存信息读取系统中的内存的参数信息,则可以通过/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。
https://file1.elecfans.com/web2/M00/82/D0/wKgZomRjDjyAbzx6AAAno_pcJIk399.png
[*]total :内存总量 (我拿到的是1G的内存版本)
[*]used :被使用的内存量
内存压力测试通过给定测试内存的大小和次数, 可以对系统现有的内存进行压力上的测试。可使用系统工具 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)
got100MB (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、内存的压力测试
不错,点赞:victory:
页:
[1]