All pastes #744186 Raw Edit

Something

public text v1 · immutable
·published 2007-10-21 05:17 UTC
rendered paste body
#!/usr/bin/perl

# This program should profile the write and read speeds of Compact Flash

my $debug="1";
my @measurements=(50,100,500,1000,5000);
my $disk="sdd";

############################################
foreach my $measurement ( @measurements )
{
  print "$measurement\n";
  ############################################
  if ($debug == "1"){
    our %command=(
       'Stats_io'      => qq{iostat  -x $disk -d "tps,r/s,w/s,svctm,Blk_read/s,Blk_wrtn/s,Blk_read,Blk_wrtn,kB_read/s,kB_wrtn/s,kB_read,kB_wrtn" |grep $disk},
       'Stats_vmstats' => q{vmstat |awk '{ print $9, $10 }' },
       'Read_Test'     => qq{dd if=/dev/${disk}3 of=/dev/null bs=512 count=$measurement},
       'Write_Test'    => qq{dd if=/dev/zero of=/dev/${disk}3 bs=1024k count=$measurement}
    );
  };
  ############################################
  if ($debug == "1"){  
    for my $key (keys %command )
    {
      print("COMMAND:\t$command{$key}\n");
    }
  }
  ############################################
  open( READ,    "$command{Read_Test} |") || die "cant run $command{Read_Test}:\t$?\n"; 
  #open( READ,    "time dd if=/dev/sdd3 of=/dev/null bs=512 count=$measurement |") || die "cant run READ:\t$?\n"; 
  while( <READ> ){ print "$_\n"; }
  close(READ)||die; 
  ############################################
  open( WRIGHT, "$command{Write_Test} |") || die "cant run $command{Write_Test}:\t$?\n"; 
  #open( WRIGHT, "time dd if=/dev/zero of=/dev/sdd3 bs=1024k count=$measurement |") || die "cant run WRIGHT:\t$?\n"; 
  while( <WRIGHT> ){ print "$_\n"; }
  close(WRIGHT)||die; 
  ############################################  

}