From: nathan Date: Tue, 31 Oct 2006 18:47:37 +0000 (+0000) Subject: b=10959 X-Git-Tag: v1_7_100~402 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=e256ca75b9910c59e0a2cd1612e02d62cc215cbd b=10959 turn off client cache for more accurate numbers --- diff --git a/lustre-iokit/ost-survey/ost-survey.pl b/lustre-iokit/ost-survey/ost-survey.pl index d23d421..fc93117 100755 --- a/lustre-iokit/ost-survey/ost-survey.pl +++ b/lustre-iokit/ost-survey/ost-survey.pl @@ -58,6 +58,18 @@ sub ost_count () { } } +sub cache_off () { + $CACHEFILE = glob ("/proc/fs/lustre/llite/*/max_cached_mb"); + open(PTR, $CACHEFILE) || die "Cannot open $tempfile: $!\n"; + $CACHESZ = 0 + ; + close PTR; + system("echo 0 >> $CACHEFILE"); +} + +sub cache_on () { + system("echo $CACHESZ >> $CACHEFILE"); +} + # make_dummy subroutine creates a dummy file that will be used for read operation. sub make_dummy () { my $SIZE = $_[0]; @@ -65,9 +77,6 @@ sub make_dummy () { system ("dd of=$tempfile if=/dev/zero count=$SIZE bs=$BSIZE 2> /dev/null"); } -my $LoadTimeHiRes = "use Time::HiRes qw(gettimeofday)"; -eval ($LoadTimeHiRes); - # run_test subroutine actually writes and reads data to/from dummy file # and compute corresponding time taken for read and write operation and # byte transfer for the both operations. @@ -197,6 +206,8 @@ foreach (@ARGV) { #Check for Time::HiRes module my $CheckTimeHiRes = "require Time::HiRes"; eval ($CheckTimeHiRes) or die "You need to install the perl-Time-HiRes package to use this script\n"; +my $LoadTimeHiRes = "use Time::HiRes qw(gettimeofday)"; +eval ($LoadTimeHiRes); use POSIX qw(strftime); my $time_v = time(); @@ -207,32 +218,40 @@ print " OST speed survey on $MNT from $hostname\n"; # get OST count ost_count (); +# turn off local cache +cache_off (); + +$dirpath = "$MNT/ost_survey_tmp"; +eval { mkpath($dirpath) }; +if ($@) { + print "Couldn't create $dirpath: $@"; + exit 1; +} use File::Path; $CNT = 0; while ($CNT < $OSTS) { - $dirpath = "$MNT/tmpdir$CNT"; - eval { mkpath($dirpath) }; - if ($@) { - print "Couldn't create $dirpath: $@"; - exit 1; - } $filename = "$dirpath/file$CNT"; if ( $ACTIVEOST_INX[$CNT] ) { # set stripe for OST number $CNT system ("lfs setstripe $filename 0 $CNT 1"); # Perform write for OST number $CNT &run_test($FSIZE,$CNT,"write",$filename); + $flag++; + } + $CNT = $CNT + 1; +} +$CNT = 0; +while ($CNT < $OSTS) { + $filename = "$dirpath/file$CNT"; + if ( $ACTIVEOST_INX[$CNT] ) { # Perform read for OST number $CNT &run_test($FSIZE,$CNT,"read",$filename); $flag++; } - eval { rmtree($dirpath) }; - if ($@) { - print "Warning: Couldn't $dirpath: $@"; - } $CNT = $CNT + 1; } + # if read or write performed on any OST then display information. if ( $flag ) { if ( $flag > 1 ) { @@ -243,3 +262,10 @@ if ( $flag ) { } else { print "There is no active OST's found\n"; } + +cache_on (); + +eval { rmtree($dirpath) }; +if ($@) { + print "Warning: Couldn't remove $dirpath: $@"; +}