#!/bin/sh awk ' BEGIN { dt = 0 print "set term \"png\" size 1024,768" > "plot1" print "set term \"png\" size 1024,768" > "plot2" print "set format x \"\"" > "plot1" print "set format x \"\"" > "plot2" print "set xlabel \"\"" > "plot1" print "set xlabel \"\"" > "plot2" print "set ylabel \"lines of C code\"" > "plot1" print "set ylabel \"code change stats [%]\"" > "plot2" print "set yrange [0:350000]" > "plot1" print "set yrange [0:100]" > "plot2" } /^20..-/ { getline old getline new getline perc sub("^old: *", "", old) sub("^new: *", "", new) print old > "code.old" print new > "code.new" print old+new > "code.total" print perc > "code.perc" split($1, A, "-") when=A[1] "-" sprintf("%02d", A[2]) DT[when] = dt if (dt % 4 == 0) { print "set label \"" when "\" at " dt ",0 rotate right" > "plot1" print "set label \"" when "\" at " dt ",0 rotate right" > "plot2" } dt++ } END { while((getline < "events") == 1) { ev = $0 sub("^" $1 " *", "", ev) split($1, A, "-") when=A[1] "-" sprintf("%02d", A[2]) dt = DT[when] + A[2] / 31 print "set arrow from " dt ",0 to " dt ",300000 nohead" > "plot1" print "set label \"" ev "\" at " dt-0.7 ",300000 rotate right" > "plot1" print "set arrow from " dt ",0 to " dt ",88 nohead" > "plot2" print "set label \"" ev "\" at " dt-0.7 ",85 rotate right" > "plot2" } } END { print "set bmargin 6" > "plot1" print "set bmargin 6" > "plot2" print "plot \"code.total\" with filledcurve x1, \"code.new\" with filledcurve x1;" > "plot1" print "plot \"code.perc\" with lines" > "plot2" } ' < log gnuplot < plot1 > plot1.png gnuplot < plot2 > plot2.png