realtime 工具使用cyclictest ,我的linux环境是CentOS7
分为两部分:安装RT-test cyclictest ; 给kernel 打patch
第一部分,下载安装Cyclictest , 我下载的是rt-test-1.0
# wget https:://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git
#cd rt-tests
[root@localhost RT_test]# cd rt-tests-1.0/
[root@localhost rt-tests-1.0]# ls
[root@localhost RT_test]# make all
此时编译报错:compile failure because numa.h can't be found
需要执行以下步骤
[root@localhost rt-tests-1.0]# yum install numactl-devel
再次make就compile成功
[root@localhost rt-tests-1.0]# cyclictest --help
cyclictest V 1.00
Usage:
cyclictest
-a [CPUSET] --affinity Run thread #N on processor #N, if possible, or if CPUSET
given, pin threads to that set of processors in round-
robin order. E.g. -a 2 pins all threads to CPU 2,
but -a 3-5,0 -t 5 will run the first and fifth
threads on CPU (0),thread #2 on CPU 3, thread #3
on CPU 4, and thread #5 on CPU 5.
-A USEC --aligned=USEC align thread wakeups to a specific offset
-b USEC --breaktrace=USEC send break trace command when latency > USEC
-B --preemptirqs both preempt and irqsoff tracing (used with -b)
-c CLOCK --clock=CLOCK select clock
0 = CLOCK_MONOTONIC (default)
...
可以查看到各项命令,安装成功
开始使用工具:
[root@localhost rt-tests-1.0]# cyclictest -c CLOCK
报错:
Unable to changescheduling policy!
Probably missingcapabilities, either run as root or increase RLIMIT_RTPRIO limits.
这时需要给kernel 打 patch
部分二,下载相应kernel 版本及patch,kernel 和 patch 的版本应尽量相同,不然后续会出现其他问题
首先查看我的kernel版本
[root@localhost rt-tests-1.0]# uname -r
3.10.0-327.36.3.el7.x86_64
查看原先版本
[root@localhost rt-tests-1.0]# ls /boot/config-*
然后我选择下载3.12.66 版本,patch为patch-3.12.66-rt88.patch.gz
[root@localhost rt-tests-1.0]# wget https://www.kernel.org/pub/linux/kernel/projects/rt/3.12/patch-3.12.66-rt88.patch.gz
[root@localhost rt-tests-1.0]# wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.12.66.tar.gz
[root@localhost rt-tests-1.0]# tar -xvzf linux-3.12.66.tar.gz
[root@localhost rt-tests-1.0]# ls
bld linux-3.12.66.tar.gz pmqtest signaltest
COPYING MAINTAINERS ptsematest sigwaittest
cyclictest Makefile README.markdown src
hackbench patch-3.12.66-rt88.patch.gz rt-migrate-test svsematest
hwlatdetect pip_stress RT_test
linux-3.12.66 pi_stress sendme
[root@localhost rt-tests-1.0]# cd linux-3.12.66/
开始patch
[root@localhost linux-3.12.66]# zcat ../patch-3.10.75-rt80.patch.gz | patch -p1
将原先存在的.config 文件写到kernel source
[root@localhost linux-3.12.66]# cp /boot/config-3.10.0-327.36.3.el7.x86_64 .config
compile 原始kernel,更改一些参数
[root@localhost linux-3.12.66]# make oldconfig