Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pidstat: why no binary output option? #220

Open
reikred opened this issue Apr 23, 2019 · 2 comments
Open

pidstat: why no binary output option? #220

reikred opened this issue Apr 23, 2019 · 2 comments

Comments

@reikred
Copy link

reikred commented Apr 23, 2019

I would like to send pidstat output to a file and then make a graph from it using sadf. But there appears to be no option of pidstat to generate the binary output format that sadf wants. Such a feature would be highly useful, I think.

@reikred reikred changed the title pidstat should have binary output option pidsta: why no binary output option? Apr 23, 2019
@reikred reikred changed the title pidsta: why no binary output option? pidstat: why no binary output option? Apr 23, 2019
@sysstat
Copy link
Owner

sysstat commented Apr 24, 2019

sadf is a command intended to display sar data in various formats (including SVG format, i.e. graphic output). pidstat is a different command which is not related to sar. I don't plan to add a binary output to it. This is too much work and I don't have enough time for that...

@ghost
Copy link

ghost commented Apr 1, 2022

feeble first try with gnuplot

S_TIME_FORMAT=ISO pidstat -hurvw -p 8180 1 30 | grep -v -e "^Linux" -e "^\s*$" > mydata.txt 

head mydata.txt
# Time        UID       PID    %usr %system  %guest   %wait    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   cswch/s nvcswch/s threads   fd-nr  Command
14:38:55      100      8180    1.00    0.00    0.00    0.00    1.00    22      1.00      3.00 5332304 1277572   1.94      0.00      0.00     233      -1  java
# Time        UID       PID    %usr %system  %guest   %wait    %CPU   CPU  minflt/s  majflt/s     VSZ     RSS   %MEM   cswch/s nvcswch/s threads   fd-nr  Command
14:38:56      100      8180    0.00    0.00    0.00    0.00    0.00    22      0.00      1.00 5332304 1277572   1.94      0.00      0.00     233      -1  java

cat gnuplot_commands.txt | grep -v -e "^\s*$" -e "^\s*#"                                                       
set xdata time                           # Indicate that x-axis values are time values
set timefmt "%H:%M:%S"                   # Indicate the pattern the time values will be in
set format x "%H:%M:%S"                     # Set how the dates will be displayed on the plot
set autoscale
set key left top                         # Set lengend location to top-left 
set xtics rotate by -45                  # Rotate dates on x-axis 45deg for cleaner display
set title 'pidstat, take 1' font ",18" # Set graph title, set title font size to 18
set terminal svg size 1200,630
set output 'output.svg' 
plot 'mydata.txt' using 1:4 with linespoints linetype 6 linewidth 3 title '%usr', \
     'mydata.txt' using 1:5 with linespoints linetype 7 linewidth 3 title '%system', \
     'mydata.txt' using 1:8 with linespoints linetype 2 linewidth 3 title '%CPU'

gnuplot < gnuplot_commands.txt 

output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants