Counts in logs, better graph, auto-emailing results, bug fix in stats
5 files changed, 23 insertions(+), 15 deletions(-)

M autocompare/main.go
M fetchpage.go
M scripts/memuse.plot
M scripts/postprocess
M scripts/stats
M autocompare/main.go +5 -1
@@ 31,6 31,9 @@ var nthreads int
 var threshold uint
 var nrmsdThresh float64
 var nrmsdOnly bool
+var totalPages int
+
+var version string
 
 func main() {
 	flag.Int64Var(&timeout, "timeout", 30, "Timeout on page load, in seconds")

          
@@ 58,7 61,7 @@ func main() {
 		MB := uint64(1024)
 		for {
 			runtime.ReadMemStats(mem)
-			log.Printf("memory %d %d", mem.Alloc / MB, mem.Sys / MB)
+			log.Printf("memory %d %d - %d", mem.Alloc / MB, mem.Sys / MB, totalPages)
 			time.Sleep(10 * time.Second)
 		}
 	}()

          
@@ 138,6 141,7 @@ func startLogger(pages *sync.WaitGroup) 
 				resultMessage = fmt.Sprint("ERROR unexpected %d", page.State())
 			}
 			fmt.Printf("%s,%s,%s,%s,%s,%s,%d,%s,%t\n", page.Id(), page.AdID(), page.Subdomain(), page.Domain(), page.OriginURL(), page.CopyURL(), page.Attempts(), resultMessage, page.Links())
+			totalPages++
 			pages.Done()
 		}
 		wait.Done()

          
M fetchpage.go +2 -2
@@ 90,13 90,13 @@ func fetchPage(phantomUrl string, timeou
 		return
 	}
 	if resp != nil && resp.StatusCode == 500 {
-		log.Printf("ERROR! bad server response %s\n", resp.Status)
+		log.Printf("ERROR! bad server response %s %s\n", resp.Status, src)
 		results <- &Result{"", false, true}
 		return
 	}
 	if resp != nil && resp.StatusCode != 200 {
 		bdy, _ := ioutil.ReadAll(resp.Body)
-		log.Printf("ERROR! bad server response %s %s\n", resp.Status, string(bdy))
+		log.Printf("ERROR! bad server response %s %s %s\n", resp.Status, string(bdy), src)
 		results <- &Result{"", false, true}
 	} else {
 		results <- &Result{outFileName, true, true}

          
M scripts/memuse.plot +10 -7
@@ 1,26 1,29 @@ 
 #!/bin/bash
 
-if [[ $1 == "" ]]; then
+if [[ $1 == "" || -f $1 ]]; then
 	echo "USAGE: $0 <dir>"
 	exit 1
 fi
 BASE=$1
 DAT=$BASE/mem.dat
 
-awk '/memory/ {print $2","$4","$6}' < $BASE/errs.txt > $DAT
+awk '/memory/ {print $2","$4","$5","$7}' < $BASE/errs.txt > $DAT
 
 gnuplot <<EOF
 set datafile separator ","
 set term svg enhanced size 1200,900
 set output "${BASE}/memuse.svg"
 set ylabel "Memory (KB)"
+set y2label "Comparisons (#)"
 set xlabel "Time"
 set xdata time  
 set timefmt "%H:%M:%S"
+set y2tics
 set xtics format "%H:%M:%S"
-plot '${DAT}' using 1:2 title "Alloc" with lines, \
-     '${DAT}' using 1:3 title "System" with lines
-
+plot '${DAT}' using 1:2 title "Alloc" with points, \
+	 '${DAT}' using 1:2 title "Alloc smoothed" smooth bezier with lines, \
+     '${DAT}' using 1:3 title "System" with lines, \
+	 '${DAT}' using 1:4 title "Comparisons" smooth bezier with lines axis x1y2
 EOF
-gzip $1/memuse.svg
-mv $1/memuse.svg.gz $1/memuse.svgz
+gzip ${BASE}/memuse.svg
+mv ${BASE}/memuse.svg.gz ${BASE}/memuse.svgz

          
M scripts/postprocess +3 -2
@@ 28,8 28,8 @@ 
 MYPATH=`dirname $0`
 
 INPUT=$1
-if [[ $# -ne 1 ]]; then
-	echo "USAGE: $0 <input>"
+if [[ $# -ne 1 || -d $INPUT ]]; then
+	echo "USAGE: $0 <input-file>"
 	exit 1
 fi
 PREV=`dirname $1`

          
@@ 41,3 41,4 @@ egrep -e 'OK.*true$' ${PREV}/sites.csv |
 ${MYPATH}/memuse.plot ${PREV}
 cp ${MYPATH}/../run_readme.txt ${PREV}/README.txt
 zip -r ${PREV}.zip ${PREV}
+( cat ${PREV}/stats.txt ; uuencode ${PREV}.zip ${PREV}.zip ) | mail -s "Autocompare results ${PREV}" erick.moeller@hibu.com Tommy.Jorgensen@kapowsoftware.com todd.little@hibu.com sean.russell@hibu.com

          
M scripts/stats +3 -3
@@ 40,10 40,10 @@ printf "Aggregated page failures: %d (%g
 printf "Aggregated site failures: %d (%g%%)\n" $AGGREGATED_FAIL_SITE $AGGREGATED_FAIL_SITE_P
 printf "Timeouts          : %d (%g%%)\n" $TIMEOUTS_PAGE $TIMEOUTS_PAGE_P
 
-SD=`grep memory ${BASE}/errs.txt | head -n 1 | awk '{print $1" "$2}'`
+SD=`grep memory ${DIR}/errs.txt | head -n 1 | awk '{print $1" "$2}'`
 SS=`date -d "$SD" +%s`
-ED=`grep memory ${BASE}/errs.txt | tail -n 1 | awk '{print $1" "$2}'`
+ED=`grep memory ${DIR}/errs.txt | tail -n 1 | awk '{print $1" "$2}'`
 ES=`date -d "$ED" +%s`
 SECS=$(($ES - $SS))
-PPH=`dc -e "2k$P $SECS 3600//p"`
+PPH=`dc -e "2k$COMP_PAGE $SECS 3600//p"`
 printf "Run time: %02d:%02d:%02d (%g p/h)\n" $(($SECS/3600)) $(($SECS%3600/60)) $(($SECS%60))  $PPH