yast/yast-installation

View on GitHub
bin/memsample-csv-plot

Summary

Maintainability
Test Coverage
#!/bin/sh
# memsample-csv-plot
# Plot the memory usage data collected by memsample
CSV="${1-memsample.csv}"
PNG="${2-memsample.png}"
echo >&2 "Plotting from $CSV to $PNG"
cat <<EOS | gnuplot > "$PNG"
set title "YaST installer memory usage"
set datafile separator comma
set timefmt "%Y-%m-%dT%H:%M:%S+00:00"
set xdata time
set xtics rotate
set format x "%H:%M:%S"
set terminal png size 800, 600
set xlabel "wall clock (UTC)"
set ylabel "used [MiB]"
set grid
#set key outside
set rmargin 16
set key rmargin
# 1 disk_total_k, 2 disk_used_k, 3 disk_free_k,
# 4 mem_total_k, 4 mem_used_k, 6 mem_free_k,
# 7 swap_total_k, 8 swap_used_k, 9 swap_free_k,
# 10 rss, 11 rss_all, 12 datetime
plot "${CSV}" using 12:(\$10/1024)     title "y2start RSS"          with lines,\
           "" using 12:(\$11/1024)     title "y2start+children RSS" with lines,\
           "" using 12:(\$2/1024)      title "disk"                 with lines,\
           "" using 12:(\$5/1024)      title "mem"                  with lines,\
           "" using 12:((\$2+\$5)/1024) title "mem+disk"            with lines,\
           "" using 12:(\$8/1024)      title "swap"                 with lines
EOS