git: 48ccde43d59c - main - benchmarks/unixbench: Update to the latest commit

From: Luca Pizzamiglio <pizzamig_at_FreeBSD.org>
Date: Thu, 16 Feb 2023 12:52:53 UTC
The branch main has been updated by pizzamig:

URL: https://cgit.FreeBSD.org/ports/commit/?id=48ccde43d59c16ce16c16ac7c49fa5f67e4731d5

commit 48ccde43d59c16ce16c16ac7c49fa5f67e4731d5
Author:     Luca Pizzamiglio <pizzamig@FreeBSD.org>
AuthorDate: 2023-02-16 12:44:16 +0000
Commit:     Luca Pizzamiglio <pizzamig@FreeBSD.org>
CommitDate: 2023-02-16 12:44:16 +0000

    benchmarks/unixbench: Update to the latest commit
    
    Graphics always enabled
    Reported by:    Nilton Jose Rizzo <niltonrizzo@gmail.com>
---
 benchmarks/unixbench/Makefile                  | 10 ++-
 benchmarks/unixbench/distinfo                  |  6 +-
 benchmarks/unixbench/files/patch-Makefile      | 67 +++++++++----------
 benchmarks/unixbench/files/patch-Run           | 92 +++++++++++++++++++-------
 benchmarks/unixbench/files/patch-src_big.c     | 11 ---
 benchmarks/unixbench/files/patch-src_dhry__1.c | 19 ------
 benchmarks/unixbench/files/patch-src_syscall.c | 11 ---
 benchmarks/unixbench/pkg-descr                 |  6 ++
 benchmarks/unixbench/pkg-plist                 |  1 +
 9 files changed, 115 insertions(+), 108 deletions(-)

diff --git a/benchmarks/unixbench/Makefile b/benchmarks/unixbench/Makefile
index 6994ae3713f4..81d71c91c934 100644
--- a/benchmarks/unixbench/Makefile
+++ b/benchmarks/unixbench/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	unixbench
 DISTVERSIONPREFIX=	v
-DISTVERSION=	5.1.3
-PORTREVISION=	2
+DISTVERSION=	5.1.3-51
+DISTVERSIONSUFFIX=	-g6705203
 CATEGORIES=	benchmarks
 
 MAINTAINER=	pizzamig@FreeBSD.org
@@ -12,11 +12,15 @@ LICENSE=	GPLv2
 
 RUN_DEPENDS=	x11perf:x11/x11perf
 
-USES=		gmake perl5 shebangfix
+USES=		gmake gl perl5 shebangfix xorg
 USE_GITHUB=	yes
 GH_ACCOUNT=	kdlucas
 GH_PROJECT=	byte-unixbench
 WRKSRC_SUBDIR=	UnixBench
+USE_GL=	gl
+USE_XORG=	x11 xext
+CFLAGS+=	-I${LOCALBASE}/include \
+			-L${LOCALBASE}/lib
 
 SUB_FILES=	unixbench
 SHEBANG_FILES=	Run pgms/gfx-x11
diff --git a/benchmarks/unixbench/distinfo b/benchmarks/unixbench/distinfo
index 0916f4bbfc18..e324f108b1a3 100644
--- a/benchmarks/unixbench/distinfo
+++ b/benchmarks/unixbench/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1503481858
-SHA256 (kdlucas-byte-unixbench-v5.1.3_GH0.tar.gz) = 3a6bb00f270a5329682dff20fd2c1ab5332ef046eb54a96a0d7bd371005d31a3
-SIZE (kdlucas-byte-unixbench-v5.1.3_GH0.tar.gz) = 145908
+TIMESTAMP = 1675975375
+SHA256 (kdlucas-byte-unixbench-v5.1.3-51-g6705203_GH0.tar.gz) = d94e504f6aac71ada43a3f0a92b7b29fe004da50eb0d40dacc065e4dbfa1f5df
+SIZE (kdlucas-byte-unixbench-v5.1.3-51-g6705203_GH0.tar.gz) = 155193
diff --git a/benchmarks/unixbench/files/patch-Makefile b/benchmarks/unixbench/files/patch-Makefile
index f0ddc57d3c29..282945fef972 100644
--- a/benchmarks/unixbench/files/patch-Makefile
+++ b/benchmarks/unixbench/files/patch-Makefile
@@ -1,15 +1,15 @@
---- Makefile.orig	2015-06-04 17:20:18 UTC
-+++ Makefile
-@@ -38,7 +38,7 @@
- ##############################################################################
- 
- SHELL = /bin/sh
--
-+HZ = 128
- # GRAPHICS TESTS: Uncomment the definition of "GRAPHIC_TESTS" to enable
- # the building of the graphics benchmarks.  This will require the
- # X11 libraries on your system.
-@@ -53,7 +53,7 @@ GL_LIBS = -lGL -lXext -lX11
+--- Makefile.orig	2023-02-07 23:18:07.000000000 +0100
++++ Makefile	2023-02-09 21:57:42.966634000 +0100
+@@ -46,7 +46,7 @@
+ # X11 libraries on your system. (e.g. libX11-devel mesa-libGL-devel)
+ #
+ # Comment the line out to disable these tests.
+-# GRAPHIC_TESTS = defined
++GRAPHIC_TESTS = defined
+ 
+ # Set "GL_LIBS" to the libraries needed to link a GL program.
+ GL_LIBS = -lGL -lXext -lX11
+@@ -55,7 +55,7 @@
  # COMPILER CONFIGURATION: Set "CC" to the name of the compiler to use
  # to build the binary benchmarks.  You should also set "$cCompiler" in the
  # Run script to the name of the compiler you want to test.
@@ -17,30 +17,23 @@
 +#CC=gcc
  
  # OPTIMISATION SETTINGS:
- 
-@@ -71,14 +71,14 @@ CC=gcc
- #	-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
-+OPTON = -O2 -fomit-frame-pointer -ffast-math -Wall
- 
- ## For Digital Unix v4.x, with DEC cc v5.x
- #OPTON = -O4
- #CFLAGS = -DTIME -std1 -verbose -w0
- 
- ## generic gcc CFLAGS.  -DTIME must be included.
--CFLAGS = -DTIME -Wall -pedantic -ansi
-+CFLAGS += -DTIME -Wall -pedantic -ansi
+ # Use gcc option if defined UB_GCC_OPTIONS via "Environment variable" or "Command-line arguments".
+@@ -87,7 +87,7 @@
+   ## (-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'. 
++  ## OS detection.  Comment out if gmake syntax not supported by other 'make'.
+   OSNAME:=$(shell uname -s)
+   ARCH := $(shell uname -p)
+   ifeq ($(OSNAME),Linux)
+@@ -113,6 +113,9 @@
+     CFLAGS += -Wa,-q
+   endif
+ 
++  ifeq ($(OSNAME),FreeBSD)
++	OPTON += -march=native -mtune=native -fomit-frame-pointer
++  endif
+ endif
  
  
- ##############################################################################
-@@ -90,8 +90,6 @@ CFLAGS = -DTIME -Wall -pedantic -ansi
- PROGDIR = ./pgms
- SRCDIR = ./src
- TESTDIR = ./testdir
--RESULTDIR = ./results
--TMPDIR = ./tmp
- # other directories
- INCLDIR = /usr/include
- LIBDIR = /lib
diff --git a/benchmarks/unixbench/files/patch-Run b/benchmarks/unixbench/files/patch-Run
index 0c0c51fc42e0..0d9a131601f9 100644
--- a/benchmarks/unixbench/files/patch-Run
+++ b/benchmarks/unixbench/files/patch-Run
@@ -1,21 +1,21 @@
---- Run.orig	2020-06-11 08:18:10 UTC
-+++ Run
-@@ -91,10 +91,10 @@ chomp($BASEDIR);
- my $BINDIR = getDir('UB_BINDIR', $BASEDIR . "/pgms");
+--- Run.orig	2023-02-09 22:21:08.690117000 +0100
++++ Run	2023-02-09 22:20:31.633214000 +0100
+@@ -91,10 +91,10 @@
+ my $BINDIR = getDir('UB_BINDIR', $FindBin::Bin . "/pgms");
  
  # Temp directory, for temp files.
--my $TMPDIR = getDir('UB_TMPDIR', $BASEDIR . "/tmp");
+-my $TMPDIR = getDir('UB_TMPDIR', $FindBin::Bin . "/tmp");
 +my $TMPDIR = "/tmp";
  
  # Directory to put results in.
--my $RESULTDIR = getDir('UB_RESULTDIR', $BASEDIR . "/results");
+-my $RESULTDIR = getDir('UB_RESULTDIR', $FindBin::Bin . "/results");
 +my $RESULTDIR = "/tmp";
  
  # Directory where the tests are executed.
- my $TESTDIR = getDir('UB_TESTDIR', $BASEDIR . "/testdir");
-@@ -672,6 +672,18 @@ sub processCpuFlags {
- # these fields:
- # describing the model etc.  Returns undef if the information can't be got.
+ my $TESTDIR = getDir('UB_TESTDIR', $FindBin::Bin . "/testdir");
+@@ -698,6 +698,18 @@
+ # future: on systems without /proc/cpuinfo, might check for Perl modules:
+ #   Sys::Info::Device::CPU or Sys::CpuAffinity
  sub getCpuInfo {
 +    my $ncpu = getCmdOutput("sysctl -n hw.ncpu");
 +    my $cpus = [ ];
@@ -29,17 +29,20 @@
 +}
 +
 +sub getCpuInfoBak {
-     open(my $fd, "<", "/proc/cpuinfo") || return undef;
- 
-     my $cpus = [ ];
-@@ -735,12 +747,10 @@ sub getSystemInfo {
+     if (!("$^O" eq "darwin")) {
+         open(my $fd, "<", "/proc/cpuinfo") || return undef;
  
+@@ -815,15 +827,11 @@
      # Get the language info.
      my $lang = getCmdOutput("printenv LANG");
--    my $map = getCmdOutput("locale -k LC_CTYPE | grep charmap");
-+    my $map = getCmdOutput("locale -k | grep charmap");
+     my $map = $^O ne "aix"
+-      ? getCmdOutput("locale -k LC_CTYPE | grep charmap") || ""
++      ? getCmdOutput("locale -k | grep charmap") || ""
+       : getCmdOutput("locale charmap") || "";
      $map =~ s/.*=//;
--    my $coll = getCmdOutput("locale -k LC_COLLATE | grep collate-codeset");
+-    my $coll = $^O ne "aix"
+-      ? getCmdOutput("locale -k LC_COLLATE | grep collate-codeset") || ""
+-      : getCmdOutput("locale | grep LC_COLLATE") || "";
 -    $coll =~ s/.*=//;
 -    $info->{'language'} = sprintf "%s (charmap=%s, collate=%s)",
 -                                   $lang, $map, $coll;
@@ -48,27 +51,27 @@
  
      # Get details on the CPUs, if possible.
      my $cpus = getCpuInfo();
-@@ -750,10 +760,9 @@ sub getSystemInfo {
+@@ -839,10 +847,9 @@
      }
  
      # Get graphics hardware info.
 -    $info->{'graphics'} = getCmdOutput("3dinfo | cut -f1 -d\'(\'");
-+    # $info->{'graphics'} = getCmdOutput("3dinfo | cut -f1 -d\'(\'");
++	#$info->{'graphics'} = getCmdOutput("3dinfo | cut -f1 -d\'(\'");
  
      # Get system run state, load and usage info.
--    $info->{'runlevel'} = getCmdOutput("runlevel | cut -f2 -d\" \"");
+-    $info->{'runlevel'} = getCmdOutput("who -r | awk '{print \$3}'");
      $info->{'load'} = getCmdOutput("uptime");
      $info->{'numUsers'} = getCmdOutput("who | wc -l");
  
-@@ -781,6 +790,7 @@ sub abortRun {
+@@ -870,6 +877,7 @@
  
  # Do checks that everything's ready for testing.
  sub preChecks {
-+    return;
++	return;
      # Set the language.
      $ENV{'LANG'} = $language;
  
-@@ -1386,7 +1396,7 @@ sub displaySystem {
+@@ -1476,7 +1484,7 @@
      }
  
      # Display system load and usage info.
@@ -77,7 +80,25 @@
  }
  
  
-@@ -1603,8 +1613,8 @@ sub displaySystemHtml {
+@@ -1587,7 +1595,7 @@
+ 
+ # Write CSV Headers.
+ #   e.g.: "Concurrency,Dhrystone 2 using register variables,Double-Precision Whetstone"
+-#       
++#
+ sub summarizeRunCsvHeader {
+     my ( $results, $reportFd ) = @_;
+ 
+@@ -1612,7 +1620,7 @@
+ 
+     # Write concurrency value.
+     printf $reportFd "%d", $results->{'copies'};
+-    
++
+     # Write test results.
+     my $isFirstColumn = 1;
+     foreach my $bench (@{$results->{'list'}}) {
+@@ -1735,8 +1743,8 @@
      # Display system runlevel, load and usage info.
      printf $fd "<tr>\n";
      printf $fd "   <td><b>Uptime:</b></td>\n";
@@ -88,3 +109,26 @@
      printf $fd "</tr>\n";
  
      printf $fd "</table></p>\n\n";
+@@ -1896,7 +1904,7 @@
+         $tests = $index;
+     }
+ 
+-    # Create directories.    
++    # Create directories.
+     my @creatingDirectories = ( ${TMPDIR}, ${RESULTDIR} );
+     createDirrectoriesIfNotExists(@creatingDirectories);
+ 
+@@ -1937,7 +1945,7 @@
+     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");
+@@ -1998,4 +2006,3 @@
+ 
+ 
+ exit(main(@ARGV));
+-
diff --git a/benchmarks/unixbench/files/patch-src_big.c b/benchmarks/unixbench/files/patch-src_big.c
deleted file mode 100644
index 7790317c2b9e..000000000000
--- a/benchmarks/unixbench/files/patch-src_big.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/big.c.orig	2015-06-04 17:20:18 UTC
-+++ src/big.c
-@@ -583,7 +583,7 @@ void dumpwork(void)
- void fatal(char *s)
- {
-     int	i;
--    fprintf(stderr, s);
-+    fprintf(stderr, "%s", s);
-     fflush(stderr);
-     perror("Reason?");
-     fflush(stderr);
diff --git a/benchmarks/unixbench/files/patch-src_dhry__1.c b/benchmarks/unixbench/files/patch-src_dhry__1.c
deleted file mode 100644
index 26b7ced39c54..000000000000
--- a/benchmarks/unixbench/files/patch-src_dhry__1.c
+++ /dev/null
@@ -1,19 +0,0 @@
---- src/dhry_1.c.orig	2015-06-04 17:20:18 UTC
-+++ src/dhry_1.c
-@@ -34,6 +34,7 @@
-  ***************************************************************************/
- char SCCSid[] = "@(#) @(#)dhry_1.c:3.4 -- 5/15/91 19:30:21";
- 
-+#include <sys/types.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -81,7 +82,7 @@ extern  int     times ();
-                 /* Measurements should last at least about 2 seconds */
- #endif
- #ifdef TIME
--extern long     time();
-+extern time_t     time();
-                 /* see library function "time"  */
- #define Too_Small_Time 2
-                 /* Measurements should last at least 2 seconds */
diff --git a/benchmarks/unixbench/files/patch-src_syscall.c b/benchmarks/unixbench/files/patch-src_syscall.c
deleted file mode 100644
index 9e920f1e1390..000000000000
--- a/benchmarks/unixbench/files/patch-src_syscall.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/syscall.c.orig	2015-06-04 17:20:18 UTC
-+++ src/syscall.c
-@@ -90,7 +90,7 @@ char	*argv[];
-                     fprintf(stderr,"%s: fork failed\n", argv[0]);
-                     exit(1);
-                 } else if (pid == 0) {
--                    execl("/bin/true", (char *) 0);
-+                    execl("/bin/true", (char *) 0, (char *) 0);
-                     fprintf(stderr,"%s: exec /bin/true failed\n", argv[0]);
-                     exit(1);
-                 } else {
diff --git a/benchmarks/unixbench/pkg-descr b/benchmarks/unixbench/pkg-descr
index 2fbadcb302f9..9c5a6f61ef0a 100644
--- a/benchmarks/unixbench/pkg-descr
+++ b/benchmarks/unixbench/pkg-descr
@@ -1 +1,7 @@
 UnixBench based on the BYTE UNIX Benchmarks v3.
+The purpose of UnixBench is to provide a basic indicator of the performance
+of a Unix-like system; hence, multiple tests are used to test various aspects of
+the system's performance. These test results are then compared to the scores
+from a baseline system to produce an index value, which is generally easier to
+handle than the raw scores. The entire set of index values is then combined to
+make an overall index for the system.
diff --git a/benchmarks/unixbench/pkg-plist b/benchmarks/unixbench/pkg-plist
index 6b7d6d2b3a39..d2e93d5c4ee3 100644
--- a/benchmarks/unixbench/pkg-plist
+++ b/benchmarks/unixbench/pkg-plist
@@ -23,6 +23,7 @@ libexec/unixbench/pgms/short
 libexec/unixbench/pgms/spawn
 libexec/unixbench/pgms/syscall
 libexec/unixbench/pgms/tst.sh
+libexec/unixbench/pgms/ubgears
 libexec/unixbench/pgms/unixbench.logo
 libexec/unixbench/pgms/whetstone-double
 libexec/unixbench/testdir/cctest.c