src/utils/qa/sessionStats.csh 1.8
1.8 2010/04/01 21:03:38 kuhn
added bar graph for number of sessions
Index: src/utils/qa/sessionStats.csh
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/qa/sessionStats.csh,v
retrieving revision 1.7
retrieving revision 1.8
diff -b -B -U 1000000 -r1.7 -r1.8
--- src/utils/qa/sessionStats.csh 12 Jan 2010 20:50:33 -0000 1.7
+++ src/utils/qa/sessionStats.csh 1 Apr 2010 21:03:38 -0000 1.8
@@ -1,92 +1,99 @@
#!/bin/tcsh
source `which qaConfig.csh`
###############################################
#
# 04-04-08
# Robert Kuhn
#
# Gets some stats on hgSession
#
###############################################
set users=0
set count=0
set shared=0
set countTot=0
set userTot=0
set shareTot=0
set reuseTot=0
if ( $#argv != 1 ) then
# no command line args
echo
echo " gets some stats on hgSession"
echo
echo " usage: go"
echo
exit
endif
# get months sessions has been alive:
set months=`hgsql -N -h $sqlrr -e "SELECT DISTINCT firstUse FROM namedSessionDb" hgcentral \
| awk -F- '{print $1"-"$2}' | sort -u`
# get stats
+rm -f tempOutFile
echo
echo " first count users shared reused "
echo "------ ----- ----- ------- -------"
foreach month ( $months )
set count=`hgsql -N -h $sqlrr -e 'SELECT COUNT(*) FROM namedSessionDb \
WHERE firstUse like "'$month%'"' hgcentral`
set users=`hgsql -N -h $sqlrr -e 'SELECT COUNT(DISTINCT(userName)) \
FROM namedSessionDb WHERE firstUse like "'$month%'"' hgcentral`
set shared=`hgsql -N -h $sqlrr -e 'SELECT COUNT(*) FROM namedSessionDb \
WHERE firstUse like "'$month%'" AND shared = 1' hgcentral`
set reuse=`hgsql -N -h $sqlrr -e 'SELECT firstUse, lastUse FROM namedSessionDb \
WHERE firstUse like "'$month%'"' hgcentral \
| awk '$1 != $3 {print $1, $3}' | wc -l`
echo $month $count $users $shared $reuse \
| awk '{printf ("%7s %4s %5s %4s %2d%% %4s %2d%%\n", \
- $1, $2, $3, $4, $4/$2*100, $5, $5/$2*100)}'
+ $1, $2, $3, $4, $4/$2*100, $5, $5/$2*100)}' | tee -a tempOutFile
+
# do totals
set countTot=`echo $countTot $count | awk '{print $1+$2}'`
set userTot=`echo $userTot $users | awk '{print $1+$2}'`
set shareTot=`echo $shareTot $shared | awk '{print $1+$2}'`
set reuseTot=`echo $reuseTot $reuse | awk '{print $1+$2}'`
end
echo "------- ----- ----- ------- -------"
echo "total " $countTot $userTot $shareTot $reuseTot \
| awk '{printf ("%7s %4s %5s %4s %2d%% %4s %2d%%\n", \
$1, $2, $3, $4, $4/$2*100, $5, $5/$2*100)}'
set uniq=`hgsql -N -h $sqlrr -e 'SELECT COUNT(DISTINCT(userName)) \
FROM namedSessionDb' hgcentral`
echo "uniq " "-" "$uniq" \
| awk '{printf ("%7s %4s %5s \n", $1, $2, $3)}'
echo "------ ----- ----- ------- -------"
echo " first count users shared reused "
+echo
+
+# graph it
+graph.csh tempOutFile
+rm -f tempOutFile
echo
# see how often people make more than one session:
echo "how many people had more than one session?"
echo " people sessions"
echo " ------ --------"
hgsql -N -h $sqlrr -e 'SELECT DISTINCT(userName), COUNT(*) as number \
FROM namedSessionDb GROUP BY userName ORDER BY number' hgcentral \
| awk '{print $2}' | sort -n | uniq -c
echo
echo "how often are sessions reaccessed?"
hgsql -t -h $sqlrr -e 'SELECT DISTINCT(useCount), COUNT(*) as sessions \
FROM namedSessionDb GROUP BY useCount ORDER BY useCount' hgcentral
echo
echo "most used:"
hgsql -t -h $sqlrr -e 'SELECT userName, sessionName, firstUse, \
lastUse, useCount FROM namedSessionDb ORDER BY useCount DESC LIMIT 4' hgcentral
echo
exit 0