diff options
author | Andy Green <andy.green@linaro.org> | 2015-08-24 12:38:47 +0800 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2015-08-24 12:38:47 +0800 |
commit | eb7ff25001c6308fc28831a5d8d447fc62c55a54 (patch) | |
tree | f2687f08fdc86948d541e4efe72a1483aa26f5c9 | |
parent | d3c6a89e1d842243deff11faa7bd35727e8edf67 (diff) |
basis names
Signed-off-by: Andy Green <andy.green@linaro.org>
-rwxr-xr-x | growth.sh | 115 |
1 files changed, 94 insertions, 21 deletions
@@ -150,7 +150,7 @@ function issue_plot_file_dist() set terminal pngcairo notransparent noenhanced font "arial,10" size $5 set output '$3' set title "$4" -set yrange [ : $2 ] noreverse nowriteback +set yrange [ $2 ] noreverse nowriteback set lmargin 9 set rmargin 2 set autoscale xfixmin @@ -161,12 +161,22 @@ set key autotitle columnhead set style fill transparent solid 0.5 noborder set xtics rotate set style data histogram +#set logscale y set label "$6" at graph 0.96,0.8 right + plot $1 +#set yrange [ $2 ] reverse +#plot $7 + EOF >&2 echo "creating $3" gnuplot plot.tmp + + if [ $? -ne 0 ] ; then + >&2 echo "Deleting failed plot $3" + rm -f $3 + fi } @@ -339,9 +349,7 @@ echo $R done fi - rm -f .plot.tmp - rm -f .plot.cols .plot.cols1 - rm -f .plot.dist + rm -f .plot.tmp .plot.cols .plot.cols1 .plot.dist # # using both runs if two given, @@ -426,7 +434,8 @@ echo $R # it's truncated, so only files in this dir # eg arch, but arch/arm is handled elsewhere - DEP=$(( `echo "$j" | sed "s|[^/]||g" | wc -c` + 1 )) + DEP=$(( `echo "$j" | sed "s|[^/]||g" | \ + wc -c` + 1 )) A=`sq3 "select sum(loc_added) \ from dir_summary where\ snap_idx=$i and \ @@ -465,6 +474,8 @@ echo $R # snapshot calculate its changes and create a unified plot data file # echo 0 > .biggest + echo 0 > .next-biggest + echo 10000000 > .smallest T=1 cat .plot.cols | while read j ; do @@ -475,6 +486,9 @@ echo $R echo -n "$j " >> .plot.tmp1 BIGGEST=`cat .biggest` + NEXT_BIGGEST=`cat .next-biggest` + + SMALLEST=`cat .smallest` JLEN=${#j} @@ -495,7 +509,8 @@ echo $R else # it's truncated, so only files in this dir # eg arch, but arch/arm is handled elsewhere - DEP=$(( `echo "$j" | sed "s|[^/]||g" | wc -c` + 1 )) + DEP=$(( `echo "$j" | sed "s|[^/]||g" | \ + wc -c` + 1 )) A=`sq3 "select sum(loc_added) \ from dir_summary where \ @@ -512,23 +527,35 @@ echo $R if [ ! -z "$A" -a ! -z "$D" ] ; then V=$(( $A - $D )) - echo -n "$V " >> .plot.tmp1 if [ $V -gt $BIGGEST ] ; then BIGGEST=$V echo $V > .biggest fi + if [ $V -lt $SMALLEST ] ; then + SMALLEST=$V + echo $V > .smallest + fi + else echo -n "0 " >> .plot.tmp1 fi done echo >> .plot.tmp1 + F=0 done >&2 echo + SMALLEST=`cat .smallest` + + FIXEDCOLS=3 + + # + # add in the title row + # echo -n "idx dir " > .plot.tmp for i in $SN $SNC ; do V="`sq3 "select ref_name \ @@ -538,6 +565,19 @@ echo $R done echo >> .plot.tmp + # + # the second row is the basis names + # + echo -n "idx basis " >> .plot.tmp + for i in $SN $SNC ; do + A=`sq3 "select basis_name from snapshots where snap_idx=$i"` + echo -n "$A " >> .plot.tmp + done + echo >> .plot.tmp + + # + # output the files in LOC-sorted order + C=0 sort -k$(( $N + 1 )) -nr .plot.tmp1 | while read i ; do echo "$C $i" >> .plot.tmp @@ -549,47 +589,80 @@ echo $R WIDTH=640 fi + # determine the best scale, considering first col may be an outlier + + BROW=0 + function biggest_row { + BROW=`cat .plot.tmp | head -n+$1 | \ + tail -n1 | cut -d' ' -f3- | tr ' ' '\n' | \ + sort -h | tail -n1` + } + + biggest_row 4 + + NEXT_BIGGEST=$BIGGEST + echo $NEXT_BIGGEST >.next-biggest + # plot each snapshot in turn C=1 while [ $C -le $N ]; do BIGGEST=`cat .biggest` + NEXT_BIGGEST=`cat .next-biggest` + SMALLEST=`cat .smallest` - TOT=`cat .plot.tmp |tail -n+2 | \ - cut -d' ' -f$(( $C + 2 )) |paste -sd+ | bc` + TOT=`cat .plot.tmp |tail -n+3 | \ + cut -d' ' -f$(( $C + $FIXEDCOLS )) |paste -sd+ | bc` _FILTER=`echo "$FILTER" | sed "s|/|_|g"` if [ ! -z "$_FILTER" ] ; then _FILTER=$_FILTER- fi - PL="'.plot.tmp' using 1:$(( $C + 2 )):xtic(2) \ + PL="'.plot.tmp' using \ + 1:$(( $C + $FIXEDCOLS )):xtic(2) \ + w boxes lc rgb \"#0000ff\" " + PLR="'.plot.tmp' using \ + 1:(-\$$(( $C + $FIXEDCOLS ))):xtic(2) \ w boxes lc rgb \"#0000ff\" " Q="`cat .plot.tmp | head -n1 | \ - cut -d' ' -f$(( $C + 2 ))`" + cut -d' ' -f$(( $C + $FIXEDCOLS ))`" + B="`cat .plot.tmp | head -n2 | tail -n1 |\ + cut -d' ' -f$(( $C + $FIXEDCOLS ))`" - _TOT="Total LOC $Q: `printf %7d $TOT`" + _TOT="Total LOC $Q ($B): `printf %7d $TOT`" echo $_TOT if [ ! -z "$SNC" ] ; then - PL="'.plot.tmp' using 1:$(( $N + 3 )):xtic(2) \ - w boxes lc rgb \"#ff0000\",$PL" - TOTC="`cat .plot.tmp |tail -n+2 | \ - cut -d' ' -f$(( $N + 3 )) |paste -sd+ | bc`" + PL="'.plot.tmp' using \ + 1:$(( $N + $FIXEDCOLS )):xtic(2) \ + w boxes lc rgb \"#ff0000\",$PL" + PLR="'.plot.tmp' using \ + 1:(-\$$(( $N + $FIXEDCOLS ))):xtic(2) \ + w boxes lc rgb \"#0000ff\",$PLR" + + + TOTC="`cat .plot.tmp |tail -n+3 | \ + cut -d' ' -f$(( $N + $FIXEDCOLS )) |\ + paste -sd+ | bc`" Q="`cat .plot.tmp | head -n1 | \ - cut -d' ' -f$(( $N + 3 ))`" \ + cut -d' ' -f$(( $N + $FIXEDCOLS ))`" \ + B="`cat .plot.tmp | head -n2 | tail -n1 |\ + cut -d' ' -f$(( $N + $FIXEDCOLS ))`" + + echo $TOT $TOTC - _TOT="Total LOC $Q: `printf %7d $TOTC`\n$_TOT\n\ - (`printf %3d $(( $TOT * 100 / $TOTC ))`%)" + _TOT="Total LOC $Q ($B): `printf %7d $TOTC`\n$_TOT\n\ + (`printf %3d $(( $TOT * 100 / $TOTC ))`%)" fi issue_plot_file_dist \ - "$PL" $BIGGEST \ + "$PL" "$SMALLEST : $NEXT_BIGGEST" \ "growth-$R-dist-$_FILTER`printf %04d $C`.png" \ "$R patch distribution (LOC) $3" \ - $WIDTH,480 "$_TOT" + $WIDTH,1024 "$_TOT" "$BROW" C=$(( $C + 1 )) done |