我正在尝试使用 gnuplot 绘制一些数据,更具体地说是 pidstat 命令,如下所示
# Time PID %usr %system %guest %CPU CPU minflt/s majflt/s VSZ RSS %MEM kB_rd/s kB_wr/s kB_ccwr/s Command
06:47:54 pm 12 0.04 0.19 0.00 0.24 2 21.50 0.03 26944 2768 0.07 -1.00 -1.00 -1.00 nginx
06:47:55 pm 12 0.00 0.03 0.00 0.03 0 0.00 0.00 0 0 0.00 -1.00 -1.00 -1.00 nginx
06:47:56 pm 12 0.00 0.00 0.00 0.00 0 0.00 0.00 0 0 0.00 -1.00 -1.00 -1.00 nginx
06:47:57 pm 12 0.00 0.08 0.00 0.08 2 0.00 0.00 0 0 0.00 -1.00 -1.00 -1.00 nginx
06:47:58 pm 12 0.00 0.03 0.00 0.03 1 0.00 0.00 0 0 0.00 -1.00 -1.00 -1.00 nginx
06:47:59 pm 12 0.00 0.00 0.00 0.00 1 0.00 0.00 0 0 0.00 -1.00 -1.00 -1.00 nginx
06:48:00 pm 12 0.00 0.01 0.00 0.01 2 0.00 0.00 0 0 0.00 -1.00 -1.00 -1.00 nginx
我正在使用这个脚本
set xdata time
set timefmt "%I:%M:%S %p"
plot "pid_output.log" using 1:4 with lines title "%usr", \
"pid_output.log" using 1:14 with lines title "%MEM"
但是无论我做什么,我都会遇到同样的错误
"gnu_plot_script.gp" line 14: warning: Bad time format in string
我有什么建议或明显的错误吗?我已经清理了一些输出。如果您想尝试的话,我用来生成输出的 pid 命令如下。
pidstat -urd -h -p <pid> 1 10 > pidstat_output.txt
timefmt
听不懂%I
,必须用%H
代替。有趣的是,%I
可以用在set xtics format
中。