mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-16 15:41:16 +01:00
summarize the number of tiles left every 20 passes to give better view
into games' progress
This commit is contained in:
parent
16c4e74e04
commit
7560156351
1 changed files with 32 additions and 1 deletions
|
@ -374,6 +374,7 @@ try_upgrade_upd() {
|
||||||
if [ "${CMD/--use-udp/}" = "${CMD}" ]; then
|
if [ "${CMD/--use-udp/}" = "${CMD}" ]; then
|
||||||
if [ $((RANDOM % 100)) -lt $UDP_PCT_INCR ]; then
|
if [ $((RANDOM % 100)) -lt $UDP_PCT_INCR ]; then
|
||||||
ARGS[$KEY]="$CMD --use-udp"
|
ARGS[$KEY]="$CMD --use-udp"
|
||||||
|
echo -n "$(date +%r): "
|
||||||
echo "upgrading key $KEY to use UDP"
|
echo "upgrading key $KEY to use UDP"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -456,8 +457,32 @@ update_ldevid() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
summarizeLogs() {
|
||||||
|
local COUNT=${#ARGS[*]}
|
||||||
|
local STR=''
|
||||||
|
local INDX=0
|
||||||
|
while [ $INDX -lt $COUNT ]; do
|
||||||
|
local KEY=${KEYS[$INDX]}
|
||||||
|
local LOG=${LOGS[$KEY]}
|
||||||
|
|
||||||
|
local LINE=$(grep pool_removeTiles $LOG | tail -n 1)
|
||||||
|
if [ -n "$LINE" ]; then
|
||||||
|
local NUM=$(echo $LINE | sed 's,^.*removeTiles: \(.*\) tiles.*$,\1,')
|
||||||
|
STR="${STR}${KEY}:${NUM};"
|
||||||
|
fi
|
||||||
|
|
||||||
|
INDX=$((1 + INDX))
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -n "${STR}" ]; then
|
||||||
|
echo -n "$(date +%r) tiles left: "
|
||||||
|
echo $STR;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
run_cmds() {
|
run_cmds() {
|
||||||
ENDTIME=$(($(date +%s) + TIMEOUT))
|
ENDTIME=$(($(date +%s) + TIMEOUT))
|
||||||
|
LOOPCOUNT=0
|
||||||
while :; do
|
while :; do
|
||||||
COUNT=${#ARGS[*]}
|
COUNT=${#ARGS[*]}
|
||||||
[ 0 -ge $COUNT ] && break
|
[ 0 -ge $COUNT ] && break
|
||||||
|
@ -468,6 +493,12 @@ run_cmds() {
|
||||||
killall "$(basename $APP_NEW)"
|
killall "$(basename $APP_NEW)"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
LOOPCOUNT=$((1 + LOOPCOUNT))
|
||||||
|
if [ 0 -eq $((LOOPCOUNT % 20)) ]; then
|
||||||
|
summarizeLogs
|
||||||
|
fi
|
||||||
|
|
||||||
INDX=$(($RANDOM%COUNT))
|
INDX=$(($RANDOM%COUNT))
|
||||||
KEYS=( ${!ARGS[*]} )
|
KEYS=( ${!ARGS[*]} )
|
||||||
KEY=${KEYS[$INDX]}
|
KEY=${KEYS[$INDX]}
|
||||||
|
@ -506,7 +537,7 @@ run_cmds() {
|
||||||
# kill any remaining games
|
# kill any remaining games
|
||||||
if [ $COUNT -gt 0 ]; then
|
if [ $COUNT -gt 0 ]; then
|
||||||
mkdir -p ${LOGDIR}/not_done
|
mkdir -p ${LOGDIR}/not_done
|
||||||
echo "processing unfinished games...."
|
echo "$(date): processing unfinished games...."
|
||||||
for KEY in ${!ARGS[*]}; do
|
for KEY in ${!ARGS[*]}; do
|
||||||
close_device $KEY ${LOGDIR}/not_done "unfinished game"
|
close_device $KEY ${LOGDIR}/not_done "unfinished game"
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue