2012-01-05 16:24:58 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2012-04-19 22:09:01 +00:00
|
|
|
## ----------------------------------------------------------------------------
|
|
|
|
##
|
2012-04-21 19:20:39 +00:00
|
|
|
## hanoi: LSM-trees (Log-Structured Merge Trees) Indexed Storage
|
2012-04-19 22:09:01 +00:00
|
|
|
##
|
|
|
|
## Copyright 2011-2012 (c) Trifork A/S. All Rights Reserved.
|
|
|
|
## http://trifork.com/ info@trifork.com
|
|
|
|
##
|
|
|
|
## Copyright 2012 (c) Basho Technologies, Inc. All Rights Reserved.
|
|
|
|
## http://basho.com/ info@basho.com
|
|
|
|
##
|
|
|
|
## This file is provided to you under the Apache License, Version 2.0 (the
|
|
|
|
## "License"); you may not use this file except in compliance with the License.
|
|
|
|
## You may obtain a copy of the License at
|
|
|
|
##
|
|
|
|
## http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
##
|
|
|
|
## Unless required by applicable law or agreed to in writing, software
|
|
|
|
## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
## License for the specific language governing permissions and limitations
|
|
|
|
## under the License.
|
|
|
|
##
|
|
|
|
## ----------------------------------------------------------------------------
|
|
|
|
|
2012-01-06 12:56:52 +00:00
|
|
|
function periodic() {
|
|
|
|
t=0
|
|
|
|
while sleep 1 ; do
|
2012-04-19 22:09:01 +00:00
|
|
|
let "t=t+1"
|
|
|
|
printf "%5d [" "$t"
|
2012-01-05 16:50:33 +00:00
|
|
|
|
2012-04-19 22:09:01 +00:00
|
|
|
for ((i=0; i<35; i++)) ; do
|
|
|
|
if ! [ -f "A-$i.data" ] ; then
|
|
|
|
echo -n " "
|
|
|
|
elif ! [ -f "B-$i.data" ] ; then
|
|
|
|
echo -n "-"
|
|
|
|
elif ! [ -f "C-$i.data" ] ; then
|
|
|
|
echo -n "#"
|
|
|
|
elif ! [ -f "X-$i.data" ] ; then
|
|
|
|
echo -n "="
|
|
|
|
else
|
|
|
|
echo -n "*"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo
|
2012-01-06 12:56:52 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function dynamic() {
|
|
|
|
local old s t start now
|
|
|
|
t=0
|
|
|
|
start=`date +%s`
|
|
|
|
while true ; do
|
2012-04-19 22:09:01 +00:00
|
|
|
s=""
|
2012-04-22 13:14:14 +00:00
|
|
|
for ((i=7; i<25; i++)) ; do
|
2012-04-22 21:53:31 +00:00
|
|
|
if [ -f "C-$i.data" ] ; then
|
|
|
|
s="${s}C"
|
2012-04-22 13:14:14 +00:00
|
|
|
else
|
2012-04-19 22:09:01 +00:00
|
|
|
s="$s "
|
2012-04-22 13:14:14 +00:00
|
|
|
fi
|
|
|
|
if [ -f "B-$i.data" ] ; then
|
|
|
|
s="${s}B"
|
2012-04-19 22:09:01 +00:00
|
|
|
else
|
2012-04-22 13:14:14 +00:00
|
|
|
s="$s "
|
|
|
|
fi
|
2012-04-22 21:53:31 +00:00
|
|
|
if [ -f "A-$i.data" ] ; then
|
|
|
|
s="${s}A"
|
2012-04-22 13:14:14 +00:00
|
|
|
else
|
|
|
|
s="$s "
|
|
|
|
fi
|
|
|
|
if [ -f "X-$i.data" ] ; then
|
|
|
|
s="${s}X"
|
|
|
|
elif [ -f "M-$i.data" ] ; then
|
|
|
|
s="${s}M"
|
|
|
|
else
|
|
|
|
s="$s "
|
2012-04-19 22:09:01 +00:00
|
|
|
fi
|
2012-04-22 13:14:14 +00:00
|
|
|
s="$s|"
|
2012-04-19 22:09:01 +00:00
|
|
|
done
|
2012-01-06 12:56:52 +00:00
|
|
|
|
2012-04-19 22:09:01 +00:00
|
|
|
if [[ "$s" != "$old" ]] ; then
|
|
|
|
let "t=t+1"
|
|
|
|
now=`date +%s`
|
|
|
|
let "now=now-start"
|
|
|
|
printf "%5d %6d [%s\n" "$t" "$now" "$s"
|
|
|
|
old="$s"
|
|
|
|
else
|
|
|
|
# Sleep a little bit:
|
|
|
|
perl -e 'use Time::HiRes; Time::HiRes::usleep(100000)'
|
|
|
|
fi
|
2012-01-05 16:24:58 +00:00
|
|
|
done
|
2012-01-06 12:56:52 +00:00
|
|
|
}
|
2012-01-05 16:24:58 +00:00
|
|
|
|
2012-01-06 12:56:52 +00:00
|
|
|
dynamic
|