diff --git a/UnixBench/Run b/UnixBench/Run index 34d2c72..b4fcbe5 100755 --- a/UnixBench/Run +++ b/UnixBench/Run @@ -99,6 +99,11 @@ my $RESULTDIR = getDir('UB_RESULTDIR', $FindBin::Bin . "/results"); # Directory where the tests are executed. my $TESTDIR = getDir('UB_TESTDIR', $FindBin::Bin . "/testdir"); +# System information +my $systemInfo = getSystemInfo(); + +# Multi-parallel literal +my $multiParallel = "Multi-parallel copies"; ############################################################################ # TEST SPECIFICATIONS @@ -255,6 +260,7 @@ my $testParams = { "cat" => 'system', "repeat" => 'long', "options" => "10", + "system_capacity_parallel_factor" => 2, }, "pipe" => { "logmsg" => "Pipe Throughput", @@ -900,6 +906,7 @@ sub parseArgs { # Generate the requested list of bench programs. my $opt; my $word; + my $copies; while ($word = shift(@words)) { if ($word !~ m/^-/) { # A test name. if ($word eq "all") { @@ -922,7 +929,9 @@ sub parseArgs { if (!defined($params->{'copies'})) { $params->{'copies'} = [ ]; } - push(@{$params->{'copies'}}, shift(@words)); + $copies = shift(@words); + abortRun("-c copies should be positive integer") if ($copies !~ m/^\d+$/ || $copies <= 0); + push(@{$params->{'copies'}}, $copies); } else { die("Run: unknown option $word\n"); } @@ -1342,7 +1351,7 @@ sub runBenchmark { $params->{'command'} = $command; # Set up the benchmark results structure. - my $bresult = { 'name' => $bench, 'msg' => $params->{'logmsg'} }; + my $bresult = { 'name' => $bench, 'msg' => $params->{'logmsg'}, 'copies' => $copies}; if ($verbose > 0) { printf "\n%d x %s ", $copies, $params->{'logmsg'}; @@ -1416,13 +1425,22 @@ sub runTests { abortRun("unknown benchmark \"$bench\""); } + my $benchCopies = $copies; + if ($benchCopies == 0) { + $benchCopies = $systemInfo->{'numCpus'}; + my $pFactor = $params->{'system_capacity_parallel_factor'}; + if (defined $pFactor) { + $benchCopies *= $pFactor; + } + } + # If the benchmark doesn't want to run with this many copies, skip it. my $cat = $params->{'cat'}; my $maxCopies = $testCats->{$cat}{'maxCopies'}; - next if ($maxCopies > 0 && $copies > $maxCopies); + next if ($maxCopies > 0 && $benchCopies > $maxCopies); # Run the benchmark. - my $bresult = runBenchmark($bench, $params, $verbose, $logFile, $copies); + my $bresult = runBenchmark($bench, $params, $verbose, $logFile, $benchCopies); $results->{$bench} = $bresult; } $results->{'end'} = time(); @@ -1450,7 +1468,8 @@ sub runTests { # Display a banner indicating the configuration of the system under test # to the given file desc. sub displaySystem { - my ( $info, $fd ) = @_; + my ( $fd ) = @_; + my $info = $systemInfo; # Display basic system info. printf $fd " System: %s: %s\n", $info->{'name'}, $info->{'system'}; @@ -1487,9 +1506,9 @@ sub logResults { # Display the individual test scores. foreach my $bench (@{$results->{'list'}}) { my $bresult = $results->{$bench}; - - printf $outFd "%-40s %12.1f %-5s (%.1f s, %d samples)\n", - $bresult->{'msg'}, + my $copiesInfo = number($bresult->{'copies'}, "copy", "copies"); + printf $outFd "%-55s %12.1f %-5s (%.1f s, %d samples)\n", + $bresult->{'msg'}."($copiesInfo)", $bresult->{'score'}, $bresult->{'scorelabel'}, $bresult->{'time'}, @@ -1520,21 +1539,22 @@ sub logIndexCat { # scores, or a partial set. my $head = $testCats->{$cat}{'name'} . ($full ? " Index Values" : " Partial Index"); - printf $outFd "%-40s %12s %12s %8s\n", + printf $outFd "%-55s %12s %12s %8s\n", $head, "BASELINE", "RESULT", "INDEX"; # Display the individual test scores. foreach my $bench (@{$results->{'list'}}) { my $bresult = $results->{$bench}; next if $bresult->{'cat'} ne $cat; + my $copiesInfo = number($bresult->{'copies'}, "copy", "copies"); if (defined($bresult->{'iscore'}) && defined($bresult->{'index'})) { - printf $outFd "%-40s %12.1f %12.1f %8.1f\n", - $bresult->{'msg'}, $bresult->{'iscore'}, + printf $outFd "%-55s %12.1f %12.1f %8.1f\n", + $bresult->{'msg'}."($copiesInfo)", $bresult->{'iscore'}, $bresult->{'score'}, $bresult->{'index'}; } else { - printf $outFd "%-40s %12s %12.1f %8s\n", - $bresult->{'msg'}, "---", + printf $outFd "%-55s %12s %12.1f %8s\n", + $bresult->{'msg'}."($copiesInfo)", "---", $bresult->{'score'}, "---"; } } @@ -1544,8 +1564,8 @@ sub logIndexCat { if (!$full) { $title .= " (Partial Only)"; } - printf $outFd "%-40s %12s %12s %8s\n", "", "", "", "========"; - printf $outFd "%-66s %8.1f\n", $title, $iscore; + printf $outFd "%-55s %12s %12s %8s\n", "", "", "", "========"; + printf $outFd "%-81s %8.1f\n", $title, $iscore; printf $outFd "\n"; } @@ -1564,7 +1584,7 @@ sub logIndex { # Dump the given run results into the given report file. sub summarizeRun { - my ( $systemInfo, $results, $verbose, $reportFd ) = @_; + my ( $results, $verbose, $reportFd ) = @_; # Display information about this test run. printf $reportFd "------------------------------------------------------------------------\n"; @@ -1574,7 +1594,7 @@ sub summarizeRun { strftime("%H:%M:%S", localtime($results->{'end'})); printf $reportFd "%s in system; running %s of tests\n", number($systemInfo->{'numCpus'}, "CPU"), - number($results->{'copies'}, "parallel copy", "parallel copies"); + $results->{'copies'} == 0 ? $multiParallel : number($results->{'copies'}, "parallel copy", "parallel copies"); printf $reportFd "\n"; # Display the run scores. @@ -1597,7 +1617,8 @@ sub summarizeRunCsvHeader { # Write CSV Headers of test. foreach my $bench (@{$results->{'list'}}) { my $bresult = $results->{$bench}; - printf $reportFd ",%s", $bresult->{'msg'}; + my $copiesInfo = number($bresult->{'copies'}, "copy", "copies"); + printf $reportFd ",%s", $bresult->{'msg'}."($copiesInfo)"; } printf $reportFd "\n"; } @@ -1633,7 +1654,7 @@ sub summarizeRunCsvRows { # Dump the given run results into the given report file. sub runHeaderHtml { - my ( $systemInfo, $reportFd ) = @_; + my ( $reportFd ) = @_; # Display information about this test run. my $title = sprintf "Benchmark of %s / %s on %s", @@ -1680,7 +1701,8 @@ EOF # Display a banner indicating the configuration of the system under test # to the given file desc. sub displaySystemHtml { - my ( $info, $fd ) = @_; + my ( $fd ) = @_; + my $info = $systemInfo; printf $fd "