git.iko.soy/typeable/pandoc
on 1.9 help sign in
typeable/pandoc/stats.sh
33 lines 876 B history raw
1#!/bin/sh
3# Generates statistics on pandoc: benchmarks and lines of code
4# The stats are put in the stats directory, marked with date and revision hash.
6STATSDIR=stats
7mkdir $STATSDIR
9DATE=`date +%Y_%m_%d`
10REV=`git rev-parse --short HEAD`
12EXT=$DATE.$REV
13BENCH=$STATSDIR/benchmark.$EXT
14LOC=$STATSDIR/loc.$EXT
15SUMMARY=$STATSDIR/summary.$EXT
17runghc Benchmark.hs > $BENCH
18find src -name '*.hs' | xargs wc -l > $LOC
20LOCSUM=`tail -1 $LOC | sed -Ee 's/^ *([0-9]+).*/\1/'`
22echo "Revision $REV" > $SUMMARY
23echo `date` >> $SUMMARY
24echo "$LOCSUM lines of code" >> $SUMMARY
25echo "" >> $SUMMARY
27sed -nEe '/^(benchmarking|mean:)/p' $BENCH | \
28 sed -Ee '/benchmarking/N;s/\n/: /' | \
29 sed -Ee 's/benchmarking (.*)/\1/' | \
30 sed -Ee 's/mean: ([^ ]*) *([^,]*).*/\1:\2/' | \
31 awk 'BEGIN { FS = ": *" } ; { printf("%s:%7.2f %s\n", $1, $2, $3); }' | \
32 column -t -s ":" >> $SUMMARY