I am trying to plot some data using gnuplot, more specifically pidstat commands that looks like this one below
# 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
Im using this script
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"
However Im getting the same error no matter what I do
"gnu_plot_script.gp" line 14: warning: Bad time format in string
Any recommendation or obvious error Im having? I have cleaned the output a bit. the pid command im ussing to generate the output is the following if you want to try.
pidstat -urd -h -p <pid> 1 10 > pidstat_output.txt
timefmt
doesn't understand %I
, you have to use %H
instead. Interestingly, %I
can be used in set xtics format
.