linux - gnuplot - ploting with loop -


i have problem gnuplot script, , cant figure out problem ....

my data file, have following format, (valeus example)

# timestamp        |- user1 -|       |-user2-|          |-user3-| # ms            procs cpu% mem%   procs cpu% mem%    procs cpu% mem% 1234            10    12   13       20   22   23      30    32   33 1235            19    15   16       29   25   26      39    35   36 

my gnuplot code is

reset  users="user1 user2 user3"  val(g,c)= (3*(g-1)) + c    plot [i=1:words(users)] "__gcrondir__/.data/usrstat.log" \    u 1:val(i,3) t word(users,i)." cpu:".i  __style0__, \ "" u 1:val(i,4) t word(users,i)." mem:".i  __style0__ 

my problem loop, happens last user, if have 10 users, lets say, script, plot 9 cpu's values, first 9 users, , both values last one. ... me make no sense, 1 ?

here screen shot ;)

enter image description here

it seems gnuplot plots in loop 1 line @ once, , second part of loop treated separate plot. gnuplot first plots "cpu" lines in loop:

plot [i=1:words(users)] "__gcrondir__/.data/usrstat.log" \    u 1:val(i,3) t word(users,i)." cpu:".i  __style0__, \ 

and last "mem" line:

"" u 1:val(i,4) t word(users,i)." mem:".i  __style0__ 

you can use nested loops instead:

kind(k)=(k==1? "cpu: " : "mem: ") plot [i=1:5] [j=1:2] (i-1)*2+j t sprintf("%s %d", kind(j), i) 

enter image description here

for case this:

reset users="user1 user2 user3" val(g,c)= (3*(g-1)) + c   kind(k)=(k==3? "cpu:" : "mem:") plot [i=1:words(users)] \ [j=3:4] \ "__gcrondir__/.data/usrstat.log" \    u 1:val(i,j) t word(users,i).kind(j).i  __style0__ 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -