aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2010-12-22 14:13:47 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2010-12-22 14:13:47 -0800
commit137dc85239e0112352811b774d9d7cf6a57ddc83 (patch)
tree2bedefd84bcbe58c9ad4b25886d799cb9a540adc
parentdc597a8a68eff403d6e800a62ab93548adcc6f41 (diff)
downloadpandoc-137dc85239e0112352811b774d9d7cf6a57ddc83.tar.gz
Added stats.sh, to make it easier to collect benchmark & loc info.
-rwxr-xr-xstats.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/stats.sh b/stats.sh
new file mode 100755
index 000000000..3bb168e89
--- /dev/null
+++ b/stats.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# Generates statistics on pandoc: benchmarks and lines of code
+# The stats are put in the stats directory, marked with date and revision hash.
+
+STATSDIR=stats
+mkdir $STATSDIR
+
+DATE=`date +%Y_%m_%d`
+REV=`git rev-parse --short HEAD`
+
+EXT=$DATE.$REV
+BENCH=$STATSDIR/benchmark.$EXT
+LOC=$STATSDIR/loc.$EXT
+SUMMARY=$STATSDIR/summary.$EXT
+
+runghc Benchmark.hs > $BENCH
+find src -name '*.hs' | xargs wc -l > $LOC
+
+LOCSUM=`tail -1 $LOC | sed -Ee 's/^ *([0-9]+).*/\1/'`
+
+echo "Revision $REV" > $SUMMARY
+echo `date` >> $SUMMARY
+echo "$LOCSUM lines of code" >> $SUMMARY
+echo "" >> $SUMMARY
+
+sed -nEe '/^(benchmarking|mean:)/p' $BENCH | \
+ sed -Ee '/benchmarking/N;s/\n/: /' | \
+ sed -Ee 's/benchmarking (.*)/\1/' | \
+ sed -Ee 's/mean: ([^ ]*) *([^,]*).*/\1:\2/' | \
+ awk 'BEGIN { FS = ": *" } ; { printf("%s:%7.2f %s\n", $1, $2, $3); }' | \
+ column -t -s ":" >> $SUMMARY
+