X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre-iokit%2Fstats-collect%2Flstats.sh;h=217144d54bba0e607fa8195d0783cc8bad5e2858;hb=51c037f2d7d7c7b713ab21617eb983f231510a33;hp=b0a04bde3657f3283b061133e8a80e7172c24c75;hpb=0bdd12e4a22272b30f541fd0c06861b2c97a972e;p=fs%2Flustre-release.git diff --git a/lustre-iokit/stats-collect/lstats.sh b/lustre-iokit/stats-collect/lstats.sh index b0a04bd..217144d 100755 --- a/lustre-iokit/stats-collect/lstats.sh +++ b/lustre-iokit/stats-collect/lstats.sh @@ -272,6 +272,72 @@ function service_start() } # +# client_stats collector +# +# CLIENT_INTERVAL: +# - 0 - collect at start and stop only +# - N - collect each N seconds +# +function client_collector() +{ + local file=$1 + local target=$2 + local srv=$3 + + echo "client stats for ${target}/${srv} " `date` + + # clear old stats + echo 0 >$file + + if let "CLIENT_INTERVAL==0"; then + grep -v "^[^ ]*[^0-9]*0 samples" $file + idle_collector + grep -v "^[^ ]*[^0-9]*0 samples" $file + elif let "CLIENT_INTERVAL>0"; then + while [ "$stop_collector" != "1" ]; do + grep -v "^[^ ]*[^0-9]*0 samples" $file + sleep $CLIENT_INTERVAL + done + else + echo "Invalid CLIENT_INTERVAL=$CLIENT_INTERVAL" + idle_collector + fi +} + +function client_start() +{ + if [ "$CLIENT_INTERVAL" == "" ]; then + return; + fi + + # find all osc + for i in /proc/fs/lustre/osc/* ; do + target=`basename $i` + if [ "$target" == "num_refs" ]; then + continue; + fi + for j in ${i}/*; do + stats=`basename $j` + if [ "$stats" == "stats" -o "$stats" == "rpc_stats" ]; then + run_collector "osc-${stats}" client_collector \ + ${j} $target $stats & + fi + done + done + # find all llite stats + for i in /proc/fs/lustre/llite/* ; do + target=`basename $i` + for j in ${i}/*; do + stats=`basename $j` + if [ "$stats" == "stats" -o "$stats" == "vfs_ops_stats" ]; then + run_collector "llite-${stats}" client_collector \ + ${j} $target ${stats} & + fi + done + done +} + +# # sdio_stats collector # # SDIO_INVERVAL: @@ -529,6 +595,7 @@ function ls_start() mballoc_start io_start jbd_start + client_start } #