Skip to content
Snippets Groups Projects
Commit e256ca75 authored by Nathan Rutman's avatar Nathan Rutman
Browse files

b=10959

turn off client cache for more accurate numbers
parent 8f5ae668
No related branches found
No related tags found
No related merge requests found
...@@ -58,6 +58,18 @@ sub ost_count () { ...@@ -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 + <PTR>;
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. # make_dummy subroutine creates a dummy file that will be used for read operation.
sub make_dummy () { sub make_dummy () {
my $SIZE = $_[0]; my $SIZE = $_[0];
...@@ -65,9 +77,6 @@ sub make_dummy () { ...@@ -65,9 +77,6 @@ sub make_dummy () {
system ("dd of=$tempfile if=/dev/zero count=$SIZE bs=$BSIZE 2> /dev/null"); 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 # run_test subroutine actually writes and reads data to/from dummy file
# and compute corresponding time taken for read and write operation and # and compute corresponding time taken for read and write operation and
# byte transfer for the both operations. # byte transfer for the both operations.
...@@ -197,6 +206,8 @@ foreach (@ARGV) { ...@@ -197,6 +206,8 @@ foreach (@ARGV) {
#Check for Time::HiRes module #Check for Time::HiRes module
my $CheckTimeHiRes = "require Time::HiRes"; my $CheckTimeHiRes = "require Time::HiRes";
eval ($CheckTimeHiRes) or die "You need to install the perl-Time-HiRes package to use this script\n"; 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); use POSIX qw(strftime);
my $time_v = time(); my $time_v = time();
...@@ -207,32 +218,40 @@ print " OST speed survey on $MNT from $hostname\n"; ...@@ -207,32 +218,40 @@ print " OST speed survey on $MNT from $hostname\n";
# get OST count # get OST count
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; use File::Path;
$CNT = 0; $CNT = 0;
while ($CNT < $OSTS) { while ($CNT < $OSTS) {
$dirpath = "$MNT/tmpdir$CNT";
eval { mkpath($dirpath) };
if ($@) {
print "Couldn't create $dirpath: $@";
exit 1;
}
$filename = "$dirpath/file$CNT"; $filename = "$dirpath/file$CNT";
if ( $ACTIVEOST_INX[$CNT] ) { if ( $ACTIVEOST_INX[$CNT] ) {
# set stripe for OST number $CNT # set stripe for OST number $CNT
system ("lfs setstripe $filename 0 $CNT 1"); system ("lfs setstripe $filename 0 $CNT 1");
# Perform write for OST number $CNT # Perform write for OST number $CNT
&run_test($FSIZE,$CNT,"write",$filename); &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 # Perform read for OST number $CNT
&run_test($FSIZE,$CNT,"read",$filename); &run_test($FSIZE,$CNT,"read",$filename);
$flag++; $flag++;
} }
eval { rmtree($dirpath) };
if ($@) {
print "Warning: Couldn't $dirpath: $@";
}
$CNT = $CNT + 1; $CNT = $CNT + 1;
} }
# if read or write performed on any OST then display information. # if read or write performed on any OST then display information.
if ( $flag ) { if ( $flag ) {
if ( $flag > 1 ) { if ( $flag > 1 ) {
...@@ -243,3 +262,10 @@ if ( $flag ) { ...@@ -243,3 +262,10 @@ if ( $flag ) {
} else { } else {
print "There is no active OST's found\n"; print "There is no active OST's found\n";
} }
cache_on ();
eval { rmtree($dirpath) };
if ($@) {
print "Warning: Couldn't remove $dirpath: $@";
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment