#!/bin/bash
-MARK=`date +%Y%m%d`
-LASTMARK=`date -d yesterday +%Y%m%d`
+TODAY=`date +%Y%m%d0200`
+YESTERDAY=`date -d yesterday +%Y%m%d0200`
+MARK=`echo "select distinct mark from bench where mark like '$TODAY%' order by mark" | mysql -u helm matita | tail -n 1`
+LASTMARK=`echo "select distinct mark from bench where mark like '$YESTERDAY%' order by mark" | mysql -u helm matita | tail -n 2 | head -n 1`
TMPDIRNAME=.__${MARK}_crontab
CVSROOT=":ext:$USER@marcello.cs.unibo.it:/home/faculty/PROJECTS/cvs/helm"
+SHELLTIME2CENTSPHP=helm/matita/scripts/shell_time2cents.php
+SHELLADDERPHP=helm/matita/scripts/shell_adder.php
+COMMONPHP=helm/matita/scripts/public_html/common.php
OLD=$PWD
rm -rf $TMPDIRNAME
cvs -d $CVSROOT co helm/matita/scripts 1>/dev/null 2>/dev/null
helm/matita/scripts/profile_cvs.sh 2> LOG
-CUR_TIME=`/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_adder.php -- public_html/common.php "select SEC_TO_TIME(SUM(TIME_TO_SEC(time))) from bench where mark = \"$MARK\" group by mark;"`
-OLD_TIME=`/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_adder.php -- public_html/common.php "select SEC_TO_TIME(SUM(TIME_TO_SEC(time))) from bench where mark = \"$LASTMARK\" group by mark;"`
+CUR_TIME=`/usr/bin/php4 -c /etc/php4/apache/php.ini -f $SHELLADDERPHP -- $COMMONPHP "select SEC_TO_TIME(SUM(TIME_TO_SEC(time))) from bench where mark = \"$MARK\" group by mark;"`
+OLD_TIME=`/usr/bin/php4 -c /etc/php4/apache/php.ini -f $SHELLADDERPHP -- $COMMONPHP "select SEC_TO_TIME(SUM(TIME_TO_SEC(time))) from bench where mark = \"$LASTMARK\" group by mark;"`
if [ -z "$CUR_TIME" -o -z "$OLD_TIME" ]; then
echo "No benchamks records for $MARK"
exit 1
fi
-((DELTA=`/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_time2cents.php -- public_html/common.php $CUR_TIME` - `/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_time2cents.php -- public_html/common.php $OLD_TIME`))
+CUR_CENTS=`/usr/bin/php4 -c /etc/php4/apache/php.ini -f $SHELLTIME2CENTSPHP -- $COMMONPHP $CUR_TIME`
+OLD_CENTS=`/usr/bin/php4 -c /etc/php4/apache/php.ini -f $SHELLTIME2CENTSPHP -- $COMMONPHP $OLD_TIME`
+
+((DELTA=$CUR_CENTS-$OLD_CENTS))
if [ $DELTA -lt 0 ]; then
PERC=0
else
((PERC=100 * $DELTA))
- ((PERC=$PERC / `/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_time2cents.php -- public_html/common.php $OLD_TIME`))
+ ((PERC=$PERC / $OLD_CENTS))
fi
if [ $PERC -ge 5 ]; then
cat <<EOT
REPORT FOR `date`
http://mowgli.cs.unibo.it/~tassi/bench.php
- PREFORMANCE LOSS DETECTED
+ PERFORMANCE LOSS DETECTED (MARK $MARK vs MARK $LASTMARK)
is $CUR_TIME sec
was $OLD_TIME sec
EOT
fi
-CUR_FAIL=`/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_adder.php -- public_html/common.php "select count(distinct test) from bench where mark = \"$MARK\" and result = 'fail';"`
-OLD_FAIL=`/usr/bin/php4 -c /etc/php4/apache/php.ini - shell_adder.php -- public_html/common.php "select count(distinct test) from bench where mark = \"$LASTMARK\" and result = 'fail';"`
+CUR_FAIL=`/usr/bin/php4 -c /etc/php4/apache/php.ini -f $SHELLADDERPHP -- $COMMONPHP "select count(distinct test) from bench where mark = \"$MARK\" and result = 'fail';"`
+OLD_FAIL=`/usr/bin/php4 -c /etc/php4/apache/php.ini -f $SHELLADDERPHP -- $COMMONPHP "select count(distinct test) from bench where mark = \"$LASTMARK\" and result = 'fail';"`
if [ $CUR_FAIL -gt $OLD_FAIL ]; then
cat <<EOT
REPORT FOR `date`
http://mowgli.cs.unibo.it/~tassi/bench.php
- MORE BROKEN TESTS DETECTED
+ MORE BROKEN TESTS DETECTED (MARK $MARK vs MARK $LASTMARK)
now broken:
`echo "select distinct test from bench where mark = \"$MARK\" and result = 'fail';" | mysql -u helm -h mowgli.cs.unibo.it matita`
were broken: