编译一个抢占式内核 安装 cyclictest 测试内核实时性(ubuntu / centos)

Table of Contents

1、简介
2、编译内核
3、cyclictest安装
4、使用

简介

Cyclictest 是 rt-tests 下的一个测试工具,也是 rt-tests 下使用最广泛的测试工具,一般主要用来测试使用内核的延迟,从而判断内核的实时性。

编译内核

#  cd /usr/src/linux-4.17.3
#  patch -p1 < patch-4.17.3-rt65.patch
#  mkdir /opt/linux-4.17.3-rt
#  make localmodconfig    # 根据目前系统内核的配置生成配置文件 .config ; 
#  或者  cp /boot/config-4.9.0-42-generic ./.config  # 替代上一句,也可以直接copy /boot 目录下面的已配置好的config文件,建议直接copy
#  sudo apt-get install bison flex libncurses-dev libssl-dev
#  make menuconfig   

设置 Processor type and features —> Preemption Model —> Preemptible Kernel(Low-Latency Desktop)

设置 Processor type and features —> Enable seccomp to safely compute untrusted bytecode 下的 Timer frequency —> 1000HZ

#  cp .config /opt/linux-4.17.3-rt/.config  # 拷贝到指定的编译目录
#  make mrproper                            # 清空
#  make bzImage -j4 O=/opt/linux-4.17.3-rt
#  make modules -j4 O=/opt/linux-4.17.3-rt
#  cd /opt/linux-4.17.3-rt
#  sudo make modules_install
#  sudo make install
#  sudo update-grub

注意,如果没有 make modules_install 重启过程中可能会出错,提示驱动错误:如

slackware kernel: snd_hda_codec: version magic '4.17.3-smp SMP mod_unload 686 ' should be '4.17.3-smp SMP preempt mod_unload 686 ' 

cyclictest 安装

·基于包管理软件安装
Debian / Ubuntu 系统下可以直接使用apt-get install rt-tests 来安装 cyclictest。

·基于 git 源码安装

#  git clone git://git.kernel.org/pub/scm/linux/kernel/git/clrkwllms/rt-tests.git
#  cd rt-tests
#  git branch testing   
#  git checkout testing  
#  make install

可能会出现编译出错的情况:

   **致命错误:numa.h:没有那个文件或目录**

CentOS 安装:

# sudo yum install numactl-devel

Ubuntu 安装:

# apt-get install libnuma-dev 

使用

#sudo cyclictest -t1 -p 80 -n -i 10000 -l 10000

结果如下:
T: 0 (17769) P:80 I:10000 C: 10000 Min: 3 Act: 13 Avg: 14 Max: 36

步骤相关截图

1、需要安装的rt-linux源
在这里插入图片描述
2、编译结果
在这里插入图片描述
3、测试结果分析
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

浪子私房菜

给小强一点爱心呗

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值