【3】安装cyclictest和iperf

cyclictest

安装比较简单,我是直接使用命令行:

复制代码
apt-get install rt-tests 

随后,运行

复制代码
sudo cyclictest

但是这个程序会一直运行,直到你手动中断程序,而且每秒生成一行输出也很烦人,所以可以选择把结果输出到一个文档里。

复制代码
max=`grep "Max Latencies" output | tr " " "\n" | sort -n | tail -1 | sed s/^0*//`
grep -v -e "^#" -e "^$" output | tr " " "\t" >histogram
cores=4
for i in `seq 1 $cores`
do
  column=`expr $i + 1`
  cut -f1,$column histogram > histogram$i
done
echo -n -e "set title \"Latency plot\"\n\
set terminal png\n\
set xlabel \"Latency (us), max $max us\"\n\
set xrange [0:150]\n\
set yrange [0.8:*]\n\
set ylabel \"Number of latency samples\"\n\
set output \"plot.png\"\n\
plot " > plotcmd
for i in `seq 1 $cores`
do
  if test $i != 1
  then
    echo -n ", " >> plotcmd
  fi
  cpuno=`expr $i - 1`
  if test $cpuno -lt 10
  then
    title="CPU$cpuno"
   else
    title="CPU$cpuno"
  fi
  echo -n "\"histogram$i\" using 1:2 smooth unique title \"$title\" with lines" >> plotcmd
done

gnuplot -persist < plotcmd

最后画出来的图如图所示。可以看到四核CPU每一个核的时延表现。

Iperf

iperf3 是 iperf 的第三个版本,它支持多种网络性能测试,如带宽、延迟、丢包率等。通过如下命令在ubuntu上安装iperf3.

复制代码
sudo apt install iperf3

在安装过程中会跳出以下页面,问是否将iperf作为开机自动以守护进程(daemon)模式启动。这里建议选否。

随后查看iperf是否安装成功。查看iperf3 --version:

实验配置

这里我要测试两台设备之间的网络情况,所以我在两台计算机上都安装了iperf,但是一台作为host一台作为server。

这两台机器是可以互相ping通的。

选中node1作为server,这会启动 iperf 服务器模式,监听默认端口(5201)等待客户端连接。

复制代码
iperf3 -s

在node2上设置:

复制代码
iperf3 -c 192.168.3.221

可以看到如下界面:

如果要测试双向的通信,或者设置测试时间,可以使用如下语句:

复制代码
iperf3 -c 192.168.3.221 --bidir -u -b 500M
相关推荐
CheungChunChiu1 小时前
Linux 内核设备模型与驱动框架解析 ——以 rk-pcie 为例
linux·运维·ubuntu
姚不倒2 小时前
负载均衡的概念、策略以及两个核心组件 Nginx 和 Kube-proxy 的对比。
运维·nginx·云原生·kubernetes
列逍2 小时前
Linux进程(三)
linux·运维·服务器·环境变量·命令行参数
水天需0103 小时前
VS Code Ctrl+Shift+V 预览 Markdown 无效的解决方案
linux
赖small强5 小时前
【Linux C/C++开发】Linux 平台 Stack Protector 机制深度解析
linux·c语言·c++·stack protector·stack-protector·金丝雀机制
陌路206 小时前
Linux42 守护进程
linux
liteblue6 小时前
DEB包解包与打包笔记
linux·笔记
minji...6 小时前
Linux 基础IO(一) (C语言文件接口、系统调用文件调用接口open,write,close、文件fd)
linux·运维·服务器·网络·数据结构·c++
赖small强6 小时前
【Linux内存管理】Linux虚拟内存系统详解
linux·虚拟内存·tlb
码龄3年 审核中6 小时前
Linux record 04
linux·运维·服务器