diff --git a/UnixBench/Makefile b/UnixBench/Makefile index d6868ba..1390da1 100644 --- a/UnixBench/Makefile +++ b/UnixBench/Makefile @@ -58,43 +58,52 @@ GL_LIBS = -lGL -lXext -lX11 CC=gcc # OPTIMISATION SETTINGS: +# Use gcc option if defined UB_GCC_OPTIONS via "Environment variable" or "Command-line arguments". +ifdef UB_GCC_OPTIONS + OPTON = $(UB_GCC_OPTIONS) -## Very generic -#OPTON = -O +else + ## Very generic + #OPTON = -O -## For Linux 486/Pentium, GCC 2.7.x and 2.8.x -#OPTON = -O2 -fomit-frame-pointer -fforce-addr -fforce-mem -ffast-math \ -# -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 + ## For Linux 486/Pentium, GCC 2.7.x and 2.8.x + #OPTON = -O2 -fomit-frame-pointer -fforce-addr -fforce-mem -ffast-math \ + # -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -## For Linux, GCC previous to 2.7.0 -#OPTON = -O2 -fomit-frame-pointer -fforce-addr -fforce-mem -ffast-math -m486 + ## For Linux, GCC previous to 2.7.0 + #OPTON = -O2 -fomit-frame-pointer -fforce-addr -fforce-mem -ffast-math -m486 -#OPTON = -O2 -fomit-frame-pointer -fforce-addr -fforce-mem -ffast-math \ -# -m386 -malign-loops=1 -malign-jumps=1 -malign-functions=1 + #OPTON = -O2 -fomit-frame-pointer -fforce-addr -fforce-mem -ffast-math \ + # -m386 -malign-loops=1 -malign-jumps=1 -malign-functions=1 -## For Solaris 2, or general-purpose GCC 2.7.x -#OPTON = -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall + ## For Solaris 2, or general-purpose GCC 2.7.x + #OPTON = -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall -## For Digital Unix v4.x, with DEC cc v5.x -#OPTON = -O4 -#CFLAGS = -DTIME -std1 -verbose -w0 + ## For Digital Unix v4.x, with DEC cc v5.x + #OPTON = -O4 + #CFLAGS = -DTIME -std1 -verbose -w0 -## gcc optimization flags -## (-ffast-math) disables strict IEEE or ISO rules/specifications for math funcs -OPTON = -O3 -ffast-math + ## gcc optimization flags + ## (-ffast-math) disables strict IEEE or ISO rules/specifications for math funcs + OPTON = -O3 -ffast-math -## OS detection. Comment out if gmake syntax not supported by other 'make'. -OSNAME:=$(shell uname -s) + ## OS detection. Comment out if gmake syntax not supported by other 'make'. + OSNAME:=$(shell uname -s) + ifeq ($(OSNAME),Linux) + # Not all CPU architectures support "-march" or "-march=native". + # - Supported : x86, x86_64, ARM, AARCH64, etc.. + # - Not Supported: RISC-V, IBM Power, etc... + OPTON += -march=native -mtune=native + endif + + ifeq ($(OSNAME),Darwin) + # (adjust flags or comment out this section for older versions of XCode or OS X) + # (-mmacosx-versin-min= requires at least that version of SDK be installed) + OPTON += -march=native -mmacosx-version-min=10.10 + #http://stackoverflow.com/questions/9840207/how-to-use-avx-pclmulqdq-on-mac-os-x-lion/19342603#19342603 + CFLAGS += -Wa,-q + endif -ifeq ($(OSNAME),Linux) -OPTON += -march=native -mtune=native -endif -ifeq ($(OSNAME),Darwin) -# (adjust flags or comment out this section for older versions of XCode or OS X) -# (-mmacosx-versin-min= requires at least that version of SDK be installed) -OPTON += -march=native -mmacosx-version-min=10.10 -#http://stackoverflow.com/questions/9840207/how-to-use-avx-pclmulqdq-on-mac-os-x-lion/19342603#19342603 -CFLAGS += -Wa,-q endif diff --git a/UnixBench/Run b/UnixBench/Run index a3c5b81..b4abd26 100755 --- a/UnixBench/Run +++ b/UnixBench/Run @@ -1585,6 +1585,48 @@ sub summarizeRun { } +# Write CSV Headers. +# e.g.: "Concurrency,Dhrystone 2 using register variables,Double-Precision Whetstone" +# +sub summarizeRunCsvHeader { + my ( $results, $reportFd ) = @_; + + # First col is for Concurrency value. + printf $reportFd "Concurrency"; + + # Write CSV Headers of test. + foreach my $bench (@{$results->{'list'}}) { + my $bresult = $results->{$bench}; + printf $reportFd ",%s", $bresult->{'msg'}; + } + printf $reportFd "\n"; +} + +# Write CSV data rows per concurrency as "./Run -c 1 -c 2". +# e.g.: 1,33526940.9,3623.9 +# 2,30386997.8,3678.8 +# 4,31439797.3,3781.4 +# 8,32872262.9,3826.2 +sub summarizeRunCsvRows { + my ( $results, $reportFd) = @_; + + # Write concurrency value. + printf $reportFd "%d", $results->{'copies'}; + + # Write test results. + my $isFirstColumn = 1; + foreach my $bench (@{$results->{'list'}}) { + my $bresult = $results->{$bench}; + + printf $reportFd ",%.1f", $bresult->{'score'}; + $isFirstColumn = 0; + } + + printf $reportFd "\n"; +} + + + ############################################################################ # HTML REPORTS ############################################################################ @@ -1887,13 +1929,26 @@ sub main { # Generate unique file names for the report and log file. my $reportFile = logFile($systemInfo); my $reportHtml = $reportFile . ".html"; + my $reportCsv = $reportFile . ".csv"; my $logFile = $reportFile . ".log"; + # If defined "UB_OUTPUT_CSV" on Environment, output csv file. + my $ubOutputCsv = $ENV{"UB_OUTPUT_CSV"}; + my $isOutputFormatCsv = defined($ubOutputCsv) && $ubOutputCsv eq "true"; + # If write CSV, header needs only once. + my $is_csv_header_written = 0; + # Open the log file for writing. open(my $reportFd, ">", $reportFile) || die("Run: can't write to $reportFile\n"); open(my $reportFd2, ">", $reportHtml) || die("Run: can't write to $reportHtml\n"); + my $reportFd_Csv; + if ($isOutputFormatCsv) { + open($reportFd_Csv, ">", $reportCsv) || + die("Run: can't write to $reportCsv\n"); + } + printf $reportFd " BYTE UNIX Benchmarks (Version %s)\n\n", $version; runHeaderHtml($systemInfo, $reportFd2); @@ -1912,6 +1967,14 @@ sub main { summarizeRun($systemInfo, $results, $verbose, $reportFd); summarizeRunHtml($systemInfo, $results, $verbose, $reportFd2); + + if ($isOutputFormatCsv) { + if ( $is_csv_header_written == 0 ) { + summarizeRunCsvHeader($results, $reportFd_Csv); + $is_csv_header_written = 1; + } + summarizeRunCsvRows($results, $reportFd_Csv); + } } runFooterHtml($reportFd2); @@ -1919,6 +1982,9 @@ sub main { # Finish the report. close($reportFd); close($reportFd2); + if ($isOutputFormatCsv) { + close($reportFd_Csv); + } # Display the report, if not in quiet mode. if ($verbose > 0) { diff --git a/UnixBench/USAGE b/UnixBench/USAGE index 748b033..29e5785 100644 --- a/UnixBench/USAGE +++ b/UnixBench/USAGE @@ -65,12 +65,12 @@ so that randomly-churning background processes don't randomise the results too much. This is particularly true for the graphics tests. -Output can be specified by using the following variables: +Output can be specified by setting the following environment variables: * "UB_RESULTDIR" : Absolute path of output directory of result files. * "UB_TMPDIR" : Absolute path of temporary files for IO tests. * "UB_OUTPUT_FILE_NAME" : Output file name. If exists it will be overwritten. - + * "UB_OUTPUT_CSV" : If set "true", output results(score only) to .csv. ============================================================================ Tests