【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
相关推荐
lihui_cbdd1 天前
AMBER 24 生产环境部署完全指南(5090可用)
linux·计算化学
开发者小天1 天前
python中For Loop的用法
java·服务器·python
绾樘1 天前
RHCE--基于Nginx的Web服务器配置
运维·服务器·nginx
生活很暖很治愈1 天前
Linux基础开发工具
linux·服务器·git·vim
打工的小王1 天前
docker(三)具体项目的部署
运维·docker·容器
似霰1 天前
Linux Shell 脚本编程——核心基础语法
linux·shell
步步为营DotNet1 天前
深度剖析.NET中IHostedService:后台服务管理的关键组件
服务器·网络·.net
一叶星殇1 天前
.NET WebAPI:用 Nginx 还是 IIS 更好
运维·nginx·.net
LUCIFER1 天前
[驱动进阶——MIPI摄像头驱动(五)]rk3588+OV13855摄像头驱动加载过程详细解析第四部分——ISP驱动
linux·驱动开发
暮云星影1 天前
四、linux系统 应用开发:UI开发环境配置概述 (一)
linux·ui·arm