New visualizer

Shows 0..9 for merge activity at each level
Also prints disk size used and free
This commit is contained in:
Kresten Krab Thorup 2012-04-24 01:43:53 +02:00
parent ff36e401b7
commit 472ba4551e

View file

@ -47,13 +47,24 @@ function periodic() {
done done
} }
merge_diff() {
SA=`ls -l A-${ID}.data 2> /dev/null | awk '{print $5}'`
SB=`ls -l B-${ID}.data 2> /dev/null | awk '{print $5}'`
SX=`ls -l X-${ID}.data 2> /dev/null | awk '{print $5}'`
if [ \( -n "$SA" \) -a \( -n "$SB" \) -a \( -n "$SX" \) ]; then
export RES=`expr ${SX}0 / \( $SA + $SB \)`
else
export RES="?"
fi
}
function dynamic() { function dynamic() {
local old s t start now local old s t start now
t=0 t=0
start=`date +%s` start=`date +%s`
while true ; do while true ; do
s="" s=""
for ((i=7; i<25; i++)) ; do for ((i=8; i<22; i++)) ; do
if [ -f "C-$i.data" ] ; then if [ -f "C-$i.data" ] ; then
s="${s}C" s="${s}C"
else else
@ -70,7 +81,9 @@ function dynamic() {
s="$s " s="$s "
fi fi
if [ -f "X-$i.data" ] ; then if [ -f "X-$i.data" ] ; then
s="${s}X" export ID="$i"
merge_diff
s="${s}$RES"
elif [ -f "M-$i.data" ] ; then elif [ -f "M-$i.data" ] ; then
s="${s}M" s="${s}M"
else else
@ -83,7 +96,9 @@ function dynamic() {
let "t=t+1" let "t=t+1"
now=`date +%s` now=`date +%s`
let "now=now-start" let "now=now-start"
printf "%5d %6d [%s\n" "$t" "$now" "$s" free=`df -m . | tail -1 | awk '{print $4}'`
used=`du -m | awk '{print $1}' `
printf "%5d %6d [%s\n" "$t" "$now" "$s ${used}Mb (${free}Mb free)"
old="$s" old="$s"
else else
# Sleep a little bit: # Sleep a little bit: