[ Sunday, February 13, 2000 ] James Manning wrote:
> I'm going to try adding a --numruns flag for tiobench so we can have an
> automated facility for averaging over a number of runs. I believe the
> dip at 4 threads is real, but it's worth adding anyway :)
It'll be part of tiotest 0.23, but attached is the relevant section
for anyone that wants to use it sooner.
James
--- tiobench.pl.orig Mon Feb 14 04:01:53 2000
+++ tiobench.pl Mon Feb 14 04:02:17 2000
@@ -8,13 +8,15 @@
sub usage {
print "Usage: $0 [<options>]\n","Available options:\n\t",
"[--size SizeInMB]+\n\t",
+ "[--numruns NumberOfRuns]+\n\t",
"[--dir TestDir]+\n\t",
"[--block BlkSizeInBytes]+\n\t",
"[--seeks TotalSeeks]+\n\t",
"[--threads NumberOfThreads]+\n\n",
"+ means you can specify this option multiple times to cover multiple\n",
"cases, for instance: $0 --block 4096 --block 8192 will first run\n",
- "through with a 4KB block size and then again with a 8KB block size\n";
+ "through with a 4KB block size and then again with a 8KB block size.\n",
+ "--numruns specifies over how many runs each test should be averaged\n";
exit(1);
}
@@ -43,17 +45,20 @@
my $write_mbytes; my $write_time; my $write_utime; my $write_stime;
my $read_mbytes; my $read_time; my $read_utime; my $read_stime;
my $seeks; my $seeks_time; my $seeks_utime; my $seeks_stime;
+my $num_runs; my $run_number;
# option parsing
GetOptions("dir=s@",\@dirs,
"size=i@",\@sizes,
"block=i@",\@blocks,
"seeks=i",\$total_seeks,
+ "numruns=i",\$num_runs,
"threads=i@",\@threads);
&usage if $Getopt::Long::error;
# give some default values
+$num_runs=1 unless $num_runs && $num_runs > 0;
@dirs=qw(.) unless @dirs;
@blocks=qw(4096) unless @blocks;
@threads=qw(1 2 4 8) unless @threads;
@@ -90,33 +95,34 @@
foreach $size (@sizes) {
foreach $block (@blocks) {
foreach $thread (@threads) {
- my $thread_seeks=int($total_seeks/$thread);
- my $thread_size=int($size/$thread);
- my $run_string = "$tiotest -t $thread -f $thread_size ".
- "-s $thread_seeks -b $block -d $dir -T -W";
- my $prompt = "*** Now Running: $run_string ...";
- print $prompt;
- open(TIOTEST,"$run_string |") or die "Could not run $tiotest";
-
- while(<TIOTEST>) {
- my ($field,$amount,$time,$utime,$stime)=split(/[:,]/);
- $stat_data{$field}{'amount'}=$amount;
- $stat_data{$field}{'time'}=$time;
- $stat_data{$field}{'utime'}=$utime;
- $stat_data{$field}{'stime'}=$stime;
- }
- close(TIOTEST);
-
+ foreach $run_number (1..$num_runs) {
+ my $thread_seeks=int($total_seeks/$thread);
+ my $thread_size=int($size/$thread);
+ my $run_string = "$tiotest -t $thread -f $thread_size ".
+ "-s $thread_seeks -b $block -d $dir -T -W";
+ my $prompt = "Run #$run_number: $run_string";
+ print $prompt;
+ open(TIOTEST,"$run_string |") or die "Could not run $tiotest";
+
+ while(<TIOTEST>) {
+ my ($field,$amount,$time,$utime,$stime)=split(/[:,]/);
+ $stat_data{$field}{'amount'} += $amount;
+ $stat_data{$field}{'time'} += $time;
+ $stat_data{$field}{'utime'} += $utime;
+ $stat_data{$field}{'stime'} += $stime;
+ }
+ close(TIOTEST);
+ print "" x length($prompt); # erase prompt
+ }
for my $field ('read','write','seek') {
- $stat_data{$field}{'rate'} =
- $stat_data{$field}{'amount'} /
- $stat_data{$field}{'time'};
- $stat_data{$field}{'cpu'} =
- 100 * ( $stat_data{$field}{'utime'} +
- $stat_data{$field}{'stime'} ) /
+ $stat_data{$field}{'rate'} =
+ $stat_data{$field}{'amount'} /
+ $stat_data{$field}{'time'};
+ $stat_data{$field}{'cpu'} =
+ 100 * ( $stat_data{$field}{'utime'} +
+ $stat_data{$field}{'stime'} ) /
$stat_data{$field}{'time'};
}
- print "" x length($prompt); # erase prompt
write;
}
}