main/unixbench: add aport for a benchmarking tool (!145)

Adds an aport for unixbench and a wrapper so it can be started with
ubench without requiring write permissions in /usr. To launch the
benchmark on a phone and have it finish in a reasonable amount of time:

$ ubench dhry whets
Output on an i7-7700HQ in the pmbootstrap chroot:
Dhrystone 2 using register variables      146273178.2 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                    44390.3 MWIPS (9.7 s, 7 samples)

System Benchmarks Partial Index              BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0  146273178.2  12534.1
Double-Precision Whetstone                       55.0      44390.3   8071.0
                                                                   ========
System Benchmarks Index Score (Partial Only)                        10057.9

This is a neat way to get relative performance between devices and
testing performance for upstream/downstream kernels.
This commit is contained in:
Martijn Braam 2019-01-14 01:32:15 +01:00 committed by Oliver Smith
parent bccf3d10e2
commit fb436c7b29
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
5 changed files with 80 additions and 0 deletions

38
main/unixbench/APKBUILD Normal file
View file

@ -0,0 +1,38 @@
pkgname=unixbench
pkgver=5.1.3
pkgrel=0
pkgdesc="The original BYTE UNIX benchmark suite"
url="https://github.com/kdlucas/byte-unixbench"
arch="all"
license="GPL2"
depends="perl make"
makedepends=""
install=""
options="!check"
source="
${pkgname}-${pkgver}.tar.gz::https://github.com/kdlucas/byte-unixbench/archive/v${pkgver}.tar.gz
modern_compiler_optimizations.patch
unreasonable_multicore-whetstone_results_fix.patch
use_volatile.patch
ubench
"
builddir="$srcdir/byte-unixbench-${pkgver}/UnixBench"
build() {
cd "$builddir"
make
}
package() {
cd "$builddir"
install -Dm775 ${srcdir}/ubench "${pkgdir}/usr/bin/ubench"
install -Dm775 Run "${pkgdir}/usr/share/unixbench/Run"
cp -a pgms testdir Makefile src ${pkgdir}/usr/share/unixbench
}
sha512sums="12a88f1606aba156e96b8addf9a6fbf1de4ddbb4b9163548554c16d78f4af167d148b27688b2e367cff01e9f8d776ff96c486577b5336c36686480f4002b4dce unixbench-5.1.3.tar.gz
5cee4101cb49c58d24e2dc453de5bac05e9f2f5e396d0220d5d811ea1b0ad67c009de4bddad1d62dbfb3491b0f6840058c571f67c21b41653e4301ab9fa27a04 modern_compiler_optimizations.patch
831f466284336cb7462cadfd4440364ea7ed543b94dd559e58497a81b1d58e35d567fb8d13885245bea250b29ae187e58e139ea27010009243f541bc6cff7405 unreasonable_multicore-whetstone_results_fix.patch
264de2ca75ef7d0977613f3dc86b8fcfbabb18bd3153214f5ba78aa256eed496f3ae88b4ebfc4399395db91fcb1bb5cd88acde735508c7fd38b4c88bfbf88bb7 use_volatile.patch
91590bfaac3b118ad9a7ec66200ecc7b5ff88b84f5e8552c6b30fcc4436669eb4467d6b9a89d0be8682903e88b843fc4e40e3c7f90406c398449edb187ad6771 ubench"

View file

@ -0,0 +1,12 @@
diff -ruN UnixBench/Makefile b/Makefile
--- a/Makefile 2015-08-15 01:52:22.539585616 -0600
+++ b/Makefile 2015-08-15 02:00:13.772259951 -0600
@@ -71,7 +71,7 @@
# -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 -ffast-math -Wall -march=native
## For Digital Unix v4.x, with DEC cc v5.x
#OPTON = -O4

7
main/unixbench/ubench Normal file
View file

@ -0,0 +1,7 @@
#!/bin/sh -e
export UB_RESULTDIR=`pwd`/ub-results
export UB_TMPDIR=/var/tmp/unixbench
mkdir -p $UB_RESULTDIR
cd /usr/share/unixbench
./Run $@ 2>/dev/null

View file

@ -0,0 +1,12 @@
diff -ruN UnixBench/Makefile b/Makefile
--- a/Makefile 2015-06-04 11:20:18.000000000 -0600
+++ b/Makefile 2015-08-15 01:47:44.310787298 -0600
@@ -196,7 +196,7 @@
$(PROGDIR)/double: $(SRCDIR)/arith.c
$(CC) -o $(PROGDIR)/double ${CFLAGS} ${OPTON} -Ddatum=double $(SRCDIR)/arith.c
$(PROGDIR)/whetstone-double: $(SRCDIR)/whets.c
- $(CC) -o $(PROGDIR)/whetstone-double ${CFLAGS} ${OPTON} -DDP -DUNIX -DUNIXBENCH $(SRCDIR)/whets.c -lm
+ $(CC) -o $(PROGDIR)/whetstone-double ${CFLAGS} ${OPTON} -DDP -DGTODay -DUNIXBENCH $(SRCDIR)/whets.c -lm
$(PROGDIR)/hanoi: $(SRCDIR)/hanoi.c
$(CC) -o $(PROGDIR)/hanoi ${CFLAGS} ${OPTON} $(SRCDIR)/hanoi.c

View file

@ -0,0 +1,11 @@
--- b/src/arith.c 2011-01-17 23:44:53.000000000 -0700
+++ a/src/arith.c 2015-03-21 20:38:49.082836753 -0600
@@ -35,7 +35,7 @@
int dumb_stuff(int);
-unsigned long iter;
+unsigned volatile long iter;
/* this function is called when the alarm expires */
void report()