安装 fio 源码后即可使用 fio_generate_plots。
# you can execute "git clone git://git.kernel.dk/fio.git"
git clone git://git.kernel.dk/fio.git
fio/tools/
该工具默认绘制 Latency、IOPS、slat、clat、BandWidth 等 5 种曲线,默认是 将相邻点连线(lines)。
# 可以修改 脚本 fio_generate_plots,如下:
#plot "I/O Latency" lat "Time (msec)" 1000
plot "I/O Operations Per Second" iops "IOPS" 1
#plot "I/O Submission Latency" slat "Time (μsec)" 1
#plot "I/O Completion Latency" clat "Time (msec)" 1000
#plot "I/O Bandwidth" bw "Throughput (KB/s)" 1
# 可将 lines 修改为 point。
PLOT_LINE=$PLOT_LINE"'$x' using (\$1/1000):(\$2/$SCALE) title \"Queue depth $DEPTH\" with point ls $i"
make clean && make -j8 && make install -j8
fio_generate_plots logname
# install for CentOS
yum install -y gnuplot
# 输出图片格式:
set term jpeg size 1280,720
set title 'plot for sin'
set output 'sin.jpeg'
# plot 语句
p [0:100] [-1:1] "sin.log" u 1:2 title "sin" w lp lt 1 lw 2 lc "green" pt 4 ps 2
set term jpeg size 1280,720
set title 'plot for sin'
set output 'sin.jpeg'
上述 plot 语句使用了简写命令,
# 实际上相当于:
plot [0:100] [-1:1] "sin.log" using 1:2 title "sin" with linepoint linetype 1 linewidth 2 linecolor "green" pointtype 4 pointsize 2
接下来,分析下每个参数具体是什么意思:
p [0:100] [-1:1]
"sin.log" u 1:2
title "sin"
w lp
style 参数 | 简写命令 | 含义 |
---|---|---|
line | l | 将相邻的数据点连线 |
point | p | 将每一个数据点用一个符号标记 |
linepoint | lp | 将每一个数据点用一个符号标记,并将相邻数据点连线 |
impulses | i | 将每一个数据点画一条垂直线至 x 轴 |
dots | d | 将每一个数据点绘制一个细点 |
steps | st | 分别用一条垂直线及水平线 来连接两点,并形成台阶状图形 |
errorbars | e | 对每一点坐标值(x, y),绘制一条由(x, ylow) 至(x, yhigh) 的线段。并在线段两端做上标记 |
boxes | boxes | 以 x 坐标为中心 绘制 柱状图 |
boxerrorbars | boxerrorbars | 相当于 errorbars 与 boxes |
lt 1
lw 2
lc "green"
pt 4
数字 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
标记符号 | 无 | + | × | ❈ | □ | ■ | ○ | ● | △ | ▲ | ▽ | ▼ | ◇ | ◆ |
ps 2