#! /opt/bin/dash # PATH="/bin:/usr/bin"; export PATH export GDFONTPATH="/usr/share/fonts/open-sans" export GNUPLOT_DEFAULT_GDFONT="OpenSans-Semibold" title="MPI Cache" xlabel="c bits" ylabel="secs" labels="set title \"$title\"\nset xlabel \"$xlabel\"\nset ylabel \"$ylabel\"" # data for nx=30 will come from cache-30.log # cat cache.sh.log cache-30.log | egrep '^(nx =|c =|real )' | while read x1 x2 x3 do case "$x1" in nx) nx="$x3"; n=$((nx+1)); # if [ "$nx" -gt 28 ]; then break; fi; # printf "\n" ;; c) c="$x3";; real) t="$x2"; printf "%2i %2i %g\n" $n $c $t;; esac done | tee cache.out | awk 'BEGIN { cmin=nmin=1e9; cmax=nmax=0; } { n=$1; c=$2; t[c][n]=$3; if(nnmax)nmax=n; if(ccmax)cmax=c; } END { printf( "%16s\n", "n"); printf( "%8s", "c"); c=11; for( n = nmin; n <= nmax; ++n) { x=t[c][n]; if( x > 0) printf( "%8i", n); } printf("\n"); # for( c = cmin; c <= cmax; ++c) { for( c = 9; c <= 13; ++c) { printf( "%8i", c); for( n = nmin; n <= nmax; ++n) { x=t[c][n]; if( x > 0) printf( "%8.2f", x); } printf("\n"); } }' > cache-table.out exit (echo "set term gif\nset output\nset logscale y\n$labels\nplot '-' using 2:3 notitle with linespoints"; cat) | gnuplot > "cache.gif"