Whamcloud - gitweb
LU-5030 tests: remove /proc paths from tests
[fs/lustre-release.git] / lustre / utils / llobdstat
old mode 100644 (file)
new mode 100755 (executable)
index 9c9cf5a..3ab51c6
@@ -5,14 +5,13 @@
 
 my $pname = $0;
 
-my $defaultpath = "/proc/fs/lustre";
 my $obdstats = "stats";
 
 sub usage()
 {
     print STDERR "Usage: $pname <ost_name> [<interval> [<count>}]\n";
-    print STDERR "where  ost_name  : ost name under $defaultpath/obdfilter\n";
-    print STDERR "       interval  : sample interaval in seconds\n";
+    print STDERR "where  ost_name  : ost name under obdfilter\n";
+    print STDERR "       interval  : sample interval in seconds\n";
     print STDERR "example: $pname lustre-OST0000 2\n";
     print STDERR "Use CTRL + C to stop statistics printing\n";
     exit 1;
@@ -33,11 +32,15 @@ if (($#ARGV < 0) || ($#ARGV > 2)) {
     } elsif ( -f "$ARGV[0]/$obdstats" ) {
         $statspath = "$ARGV[0]/$obdstats";
     } else {
-        my $st = `ls $defaultpath/obdfilter/$ARGV[0]/$obdstats 2> /dev/null`;
-        chop $st;
-        if ( -f "$st" ) {
-            $statspath = $st;
-        }
+       my $st = glob ("/{proc,sys}/fs/lustre/obdfilter/$ARGV[0]");
+       if ( -f "$st" ) {
+           $statspath = $st;
+       } else {
+           my $st = glob("/{proc,sys}/fs/lustre/obdfilter/$ARGV[0]/$obdstats");
+           if ( -f "$st" ) {
+               $statspath = $st;
+           }
+       }
     }
     if ( $statspath =~ /^None$/ ) {
         die "Cannot locate stat file for: $ARGV[0]\n";
@@ -50,7 +53,7 @@ if (($#ARGV < 0) || ($#ARGV > 2)) {
     }
 }
 
-print "$pname on $statspath\n";
+print "$pname on $ARGV[0]\n";
 
 my %cur;
 my %last;