diff --git a/UnixBench/Run b/UnixBench/Run index 15ec14d..4151248 100755 --- a/UnixBench/Run +++ b/UnixBench/Run @@ -100,6 +100,10 @@ my $RESULTDIR = getDir('UB_RESULTDIR', $FindBin::Bin . "/results"); # Directory where the tests are executed. my $TESTDIR = getDir('UB_TESTDIR', $FindBin::Bin . "/testdir"); +my $quietMode = 0; +my $notQuietMode = 1; +my $verboseMode = 2; +my $briefMode = 3; ############################################################################ # TEST SPECIFICATIONS @@ -945,6 +949,7 @@ sub getNumActiveCpus { # load System load message as per "uptime". # numUsers Number of users and/or open shell sessions. sub getSystemInfo { + my ( $verbose ) = @_; my $info = { }; # Get host system data. @@ -979,10 +984,12 @@ sub getSystemInfo { $lang, $map, $coll; # Get details on the CPUs, if possible. - my $cpus = getCpuInfo(); - if (defined($cpus)) { - $info->{'cpus'} = $cpus; - $info->{'numCpus'} = scalar(@$cpus); + if ($verbose != $briefMode) { + my $cpus = getCpuInfo(); + if (defined($cpus)) { + $info->{'cpus'} = $cpus; + $info->{'numCpus'} = scalar(@$cpus); + } } # Get available number of CPUs (not disabled CPUs), if possible. @@ -1066,9 +1073,11 @@ sub parseArgs { die("Run: unknown test \"$word\"\n"); } } elsif ($word eq "-q") { - $params->{'verbose'} = 0; + $params->{'verbose'} = $quietMode; } elsif ($word eq "-v") { - $params->{'verbose'} = 2; + $params->{'verbose'} = $verboseMode; + } elsif ($word eq "-b") { + $params->{'verbose'} = $briefMode; } elsif ($word eq "-i") { $params->{'iterations'} = shift(@words); } elsif ($word eq "-c") { @@ -1430,7 +1439,7 @@ sub runOnePass { # Get the command to run. my $command = $params->{'command'}; - if ($verbose > 1) { + if ($verbose == $verboseMode) { printf "\n"; printf "COMMAND: \"%s\"\n", $command; printf "COPIES: \"%d\"\n", $copies; @@ -1497,7 +1506,7 @@ sub runBenchmark { # Set up the benchmark results structure. my $bresult = { 'name' => $bench, 'msg' => $params->{'logmsg'} }; - if ($verbose > 0) { + if ($verbose > $quietMode) { printf "\n%d x %s ", $copies, $params->{'logmsg'}; } @@ -1518,7 +1527,7 @@ sub runBenchmark { # make an attempt to flush buffers system("sync; sleep 1; sync; sleep 2"); # display heartbeat - if ($verbose > 0) { + if ($verbose > $quietMode) { printf " %d", $i; } @@ -1548,7 +1557,7 @@ sub runBenchmark { unlink(${TESTDIR} . "/a.out"); } - if ($verbose > 0) { + if ($verbose > $quietMode) { printf "\n"; } @@ -1603,7 +1612,7 @@ sub runTests { # Display a banner indicating the configuration of the system under test # to the given file desc. sub displaySystem { - my ( $info, $fd ) = @_; + my ( $info, $fd, $verbose ) = @_; # Display basic system info. printf $fd " System: %s: %s\n", $info->{'name'}, $info->{'system'}; @@ -1615,7 +1624,9 @@ sub displaySystem { # Get and display details on the CPUs, if possible. my $cpus = $info->{'cpus'}; if (!defined($cpus)) { - printf $fd " CPU: no details available\n"; + if ($verbose != $briefMode) { + printf $fd " CPU: no details available\n"; + } } else { for (my $i = 0; $i <= $#$cpus; ++$i) { printf $fd " CPU %d: %s (%.1f bogomips)\n", @@ -1833,7 +1844,7 @@ EOF # Display a banner indicating the configuration of the system under test # to the given file desc. sub displaySystemHtml { - my ( $info, $fd ) = @_; + my ( $info, $fd ,$verbose) = @_; printf $fd "
| CPUs: | \n"; - printf $fd "no details available | \n"; - printf $fd "|
| CPUs: | \n"; + printf $fd "no details available | \n"; + printf $fd "|