summaryrefslogtreecommitdiffstats
path: root/meta-openembedded/meta-oe/recipes-benchmark/lmbench
diff options
context:
space:
mode:
authorDave Cobbley <david.j.cobbley@linux.intel.com>2018-08-14 10:05:37 -0700
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-08-22 21:26:31 -0400
commiteb8dc40360f0cfef56fb6947cc817a547d6d9bc6 (patch)
treede291a73dc37168da6370e2cf16c347d1eba9df8 /meta-openembedded/meta-oe/recipes-benchmark/lmbench
parent9c3cf826d853102535ead04cebc2d6023eff3032 (diff)
downloadblackbird-openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.tar.gz
blackbird-openbmc-eb8dc40360f0cfef56fb6947cc817a547d6d9bc6.zip
[Subtree] Removing import-layers directory
As part of the move to subtrees, need to bring all the import layers content to the top level. Change-Id: I4a163d10898cbc6e11c27f776f60e1a470049d8f Signed-off-by: Dave Cobbley <david.j.cobbley@linux.intel.com> Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-openembedded/meta-oe/recipes-benchmark/lmbench')
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0001-Check-for-musl-define-guard-before-redefining-sockle.patch27
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0001-lat_http.c-Add-printf-format.patch24
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch73
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/fix-lmbench-memory-check-failure.patch215
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/lmbench_result_html_report.patch69
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/obey-ranlib.patch36
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-config-script.patch22
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-results-script.patch170
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/use-base_libdir-instead-of-hardcoded-lib.patch30
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/0001-avoid-gcc-optimize-away-the-loops.patch80
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/lmbench-run23
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/rename-line-binary.patch30
-rw-r--r--meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb88
13 files changed, 887 insertions, 0 deletions
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0001-Check-for-musl-define-guard-before-redefining-sockle.patch b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0001-Check-for-musl-define-guard-before-redefining-sockle.patch
new file mode 100644
index 000000000..d7169495f
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0001-Check-for-musl-define-guard-before-redefining-sockle.patch
@@ -0,0 +1,27 @@
+From ac1657e11cbb0545bdf4d1124def8c013958ed7e Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 12 Jul 2017 18:08:51 -0700
+Subject: [PATCH] Check for musl define guard before redefining socklen_t
+
+musl uses __DEFINED_socklen_t so check for that as well
+along with HAVE_socklen_t
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ src/bench.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/bench.h b/src/bench.h
+index 597d068..2ebdf5a 100644
+--- a/src/bench.h
++++ b/src/bench.h
+@@ -77,7 +77,7 @@ typedef long long int64;
+ #endif /* HAVE_int64_t */
+ #endif /* HAVE_int64 */
+
+-#ifndef HAVE_socklen_t
++#if !defined(HAVE_socklen_t) && !defined(__DEFINED_socklen_t)
+ typedef int socklen_t;
+ #endif
+
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0001-lat_http.c-Add-printf-format.patch b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0001-lat_http.c-Add-printf-format.patch
new file mode 100644
index 000000000..943b3ec88
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0001-lat_http.c-Add-printf-format.patch
@@ -0,0 +1,24 @@
+From 7c05fa5353ad91acae6e5e8a01f65d54935ef778 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 27 Jun 2017 14:39:10 -0700
+Subject: [PATCH] lat_http.c: Add printf format
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ src/lat_http.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/lat_http.c b/src/lat_http.c
+index c630d59..28d04f7 100644
+--- a/src/lat_http.c
++++ b/src/lat_http.c
+@@ -27,7 +27,7 @@ http(char *server, char *file, int prog)
+ sock = tcp_connect(server, prog, SOCKOPT_REUSE);
+ sprintf(buf, "GET /%s HTTP/1.0\r\n\r\n\n", file);
+ if (debug) {
+- printf(buf);
++ printf("%s", buf);
+ }
+ write(sock, buf, strlen(buf));
+ while ((n = read(sock, buf, XFERSIZE)) > 0) {
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch
new file mode 100644
index 000000000..353d80b3b
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch
@@ -0,0 +1,73 @@
+From b27c253bfb78fa3c5f416e6caee101098a4b58cc Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 12 Jul 2017 18:09:46 -0700
+Subject: [PATCH] build: Adjust CFLAGS/LDFLAGS to append values passed from env
+
+For musl we have to pass additional arguments via cflags and ldflags
+to link in librirpc, make room for those changes to take effect
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+---
+ scripts/build | 2 +-
+ src/Makefile | 14 +++++++-------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/scripts/build b/scripts/build
+index 34a1371..3786741 100755
+--- a/scripts/build
++++ b/scripts/build
+@@ -18,7 +18,7 @@ done
+
+ trap 'rm -f ${BASE}$$.s ${BASE}$$.c ${BASE}$$.o ${BASE}$$; exit 1' 1 2 15
+
+-LDLIBS=-lm
++LDLIBS+=-lm
+
+ # check for HP-UX's ANSI compiler
+ echo "main(int ac, char *av[]) { int i; }" > ${BASE}$$.c
+diff --git a/src/Makefile b/src/Makefile
+index d9efd54..96467d7 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -112,8 +112,8 @@ LIBOBJS= $O/lib_tcp.o $O/lib_udp.o $O/lib_unix.o $O/lib_timing.o \
+ $O/lib_sched.o
+
+ lmbench: $(UTILS)
+- @env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build all
+- -@env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="k$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build opt
++ @env CFLAGS+=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build all
++ -@env CFLAGS+=-O MAKE="$(MAKE)" MAKEFLAGS="k$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build opt
+
+ results: lmbench
+ @env OS="${OS}" ../scripts/config-run
+@@ -137,7 +137,7 @@ os: lmbench
+ @env OS="${OS}" BENCHMARK_HARDWARE=NO BENCHMARK_OS=YES ../scripts/results
+
+ install: lmbench
+- @env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build install-target
++ @env CFLAGS+=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build install-target
+
+ install-target:
+ if [ ! -d $(BASE) ]; then mkdir $(BASE); fi
+@@ -155,16 +155,16 @@ all: $(EXES) $O/lmbench
+ opt: $(OPT_EXES)
+ asm: $(ASMS)
+ $(ASMS):
+- $(CC) -S $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ `basename $@ .s`.c
++ $(CC) -S $(CFLAGS) $(CPPFLAGS) -o $@ `basename $@ .s`.c $(LDFLAGS)
+
+ Wall:
+- @env CFLAGS="-g -O -Wall" MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build all opt
++ @env CFLAGS+="-g -O -Wall" MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build all opt
+
+ debug:
+- @env CFLAGS="-g -O -DDEBUG" MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build all opt
++ @env CFLAGS+="-g -O -DDEBUG" MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build all opt
+
+ assembler:
+- @env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build asm
++ @env CFLAGS+=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="${CC}" OS="${OS}" ../scripts/build asm
+
+
+ tag:
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/fix-lmbench-memory-check-failure.patch b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/fix-lmbench-memory-check-failure.patch
new file mode 100644
index 000000000..cbab5c424
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/fix-lmbench-memory-check-failure.patch
@@ -0,0 +1,215 @@
+From 65180976c9963432d166b47a0b692260a69c0d47 Mon Sep 17 00:00:00 2001
+From: Qingming Su <qingming.su@windriver.com>
+Date: Tue, 19 Aug 2014 05:16:17 -0400
+Subject: [PATCH] lmbench: Can't proceed on some targets
+
+lmbench can't proceed on some targets. The memory check fails because the
+memory latency of each page is longer then 10us, which is a time limit set
+in the original memsize.c.
+
+The memory latency is very different on different targets due to the
+hardware and current system load. The targets with slower memory
+chips or heavy system load need much longer time to read or write
+the memory.
+
+This fix changes the fixed time limit of 10us to a specific value calculated
+from the runtime target.
+
+Also set an upper limit of memory size used for lmbench testing. The memory
+check sometimes fails if the target has a large amount of memory, for
+example more than 4G.
+
+Signed-off-by: Qingming Su <qingming.su@windriver.com>
+Signed-off-by: Fupan Li <fupan.li@windriver.com>
+
+Add and reword above comments
+
+Upstream-status: inappropriate [ configuration ]
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+---
+ scripts/config-run | 12 +++++++---
+ src/Makefile | 4 ++--
+ src/memsize.c | 66 +++++++++++++++++++++++++++++++++++-------------------
+ 3 files changed, 54 insertions(+), 28 deletions(-)
+
+diff --git a/scripts/config-run b/scripts/config-run
+index 918cbdf..096ed12 100755
+--- a/scripts/config-run
++++ b/scripts/config-run
+@@ -197,6 +197,12 @@ The bigger the range, the more accurate the results, but larger sizes
+ take somewhat longer to run the benchmark.
+
+ EOF
++
++# By default, use 512M memory as the upper limit for lmbench test
++if [ $MB -gt 512 ];then
++MB=512
++fi
++
+ echo $ECHON "MB [default $MB]: $ECHOC"
+ read TMP
+ if [ X$TMP != X ]
+@@ -687,10 +693,10 @@ case $MAIL in
+ ;;
+ esac
+
+-INFO=`../scripts/info`
++INFO=`../scripts/hostinfo`
+ if [ $MAIL = yes ]
+ then if [ ! -f $INFO ]
+- then cp ../scripts/info-template $INFO
++ then cp ../scripts/hostinfo-template $INFO
+ chmod +w $INFO
+ REUSE=no
+ else
+@@ -733,7 +739,7 @@ EOF
+ then EDITOR=$TMP
+ fi
+ if [ X$EDITOR != "none" ]
+- then $EDITOR `../scripts/info`
++ then $EDITOR `../scripts/hostinfo`
+ fi
+ fi
+ fi
+diff --git a/src/Makefile b/src/Makefile
+index c7e4e3c..d9efd54 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -50,7 +50,7 @@ TARGET=`../scripts/target`
+ BINDIR=../bin/$(OS)
+ CONFIG=../bin/$(OS)/`../scripts/config`
+ UTILS=../scripts/target ../scripts/os ../scripts/gnu-os ../scripts/compiler \
+- ../scripts/info ../scripts/info-template ../scripts/version \
++ ../scripts/hostinfo ../scripts/hostinfo-template ../scripts/version \
+ ../scripts/config ../scripts/config-run ../scripts/results \
+ ../scripts/lmbench ../scripts/make ../scripts/build
+ INSTALL=cp
+@@ -240,7 +240,7 @@ $O/getopt.o : getopt.c $(INCS)
+ $(COMPILE) -c getopt.c -o $O/getopt.o
+
+ $(UTILS) :
+- -cd ../scripts; make get
++ -cd ../scripts; cp info hostinfo; cp info-template hostinfo-template
+
+ # Do not remove the next line, $(MAKE) depend needs it
+ # MAKEDEPEND follows
+diff --git a/src/memsize.c b/src/memsize.c
+index eb25a09..82d7faf 100644
+--- a/src/memsize.c
++++ b/src/memsize.c
+@@ -14,9 +14,12 @@ char *id = "$Id$\n";
+
+ #define CHK(x) if ((x) == -1) { perror("x"); exit(1); }
+
+-#ifndef TOO_LONG
+-#define TOO_LONG 10 /* usecs */
+-#endif
++//#ifndef TOO_LONG
++//#define TOO_LONG 10 /* usecs */
++//#endif
++
++#define MEMORY_SIZE_1MB (1024 * 1024)
++#define MEMORY_SIZE_8MB (8 * 1024 * 1024)
+
+ int alarm_triggered = 0;
+
+@@ -35,10 +38,10 @@ main(int ac, char **av)
+ size_t delta;
+
+ if (ac == 2) {
+- max = size = bytes(av[1]) * 1024 * 1024;
++ max = size = bytes(av[1]) * MEMORY_SIZE_1MB;
+ }
+- if (max < 1024 * 1024) {
+- max = size = 1024 * 1024 * 1024;
++ if (max < MEMORY_SIZE_1MB) {
++ max = size = 1024 * MEMORY_SIZE_1MB;
+ }
+ /*
+ * Binary search down and then binary search up
+@@ -48,7 +51,7 @@ main(int ac, char **av)
+ }
+ /* delta = size / (2 * 1024 * 1024) */
+ for (delta = (size >> 21); delta > 0; delta >>= 1) {
+- uint64 sz = (uint64)size + (uint64)delta * 1024 * 1024;
++ uint64 sz = (uint64)size + (uint64)delta * MEMORY_SIZE_1MB;
+ size_t check = sz;
+ if (max < sz) continue;
+ if (check < sz || !test_malloc(sz)) break;
+@@ -66,41 +69,58 @@ timeit(char *where, size_t size)
+ {
+ int sum = 0;
+ size_t n;
+- size_t s_prev;
++ size_t s_prev = MEMORY_SIZE_8MB;
+ size_t range;
+- size_t incr = 1024 * 1024;
++ size_t incr = MEMORY_SIZE_1MB;
+ size_t pagesize = getpagesize();
+- unsigned long long s;
+-
+- if (size < 1024*1024 - 16*1024) {
+- fprintf(stderr, "Bad size\n");
+- return;
+- }
++ size_t time_each_page = 0;
++ size_t too_long = 0;
++ unsigned long long s;
++
++ if (pagesize < MEMORY_SIZE_1MB)
++ range = MEMORY_SIZE_1MB;
++ else
++ range = MEMORY_SIZE_8MB;
++
++ incr = MEMORY_SIZE_1MB;
++
++ if (size < range) {
++ fprintf(stderr, "Bad size\n");
++ return;
++ }
++
++ //Touch range of memory, get the average time (usec) of operating each memory page on this system
++ start(0);
++ touchRange(where, range, pagesize);
++ sum = stop(0, 0);
++
++ if ((time_each_page = sum * pagesize / range) < 1)
++ time_each_page = 1;
++ //Set the uper limit of time spending on one page
++ too_long = 10 * time_each_page;
+
+- range = 1024 * 1024;
+- incr = 1024 * 1024;
+- touchRange(where, range, pagesize);
+ for (range += incr; range <= size; range += incr) {
+ n = range / pagesize;
+- set_alarm(n * TOO_LONG);
++ set_alarm(n * too_long);
+ touchRange(where + range - incr, incr, pagesize);
+ clear_alarm();
+- set_alarm(n * TOO_LONG);
++ set_alarm(n * too_long);
+ start(0);
+ touchRange(where, range, pagesize);
+ sum = stop(0, 0);
+ clear_alarm();
+- if ((sum / n) > TOO_LONG || alarm_triggered) {
++ if ((sum / n) > too_long || alarm_triggered) {
+ size = range - incr;
++ fprintf(stderr, "Error! Memory testing timeout! Touch one page of memory needs more than %d (usecs)\n ", too_long);
+ break;
+ }
+- for (s = 8 * 1024 * 1024; s <= range; s_prev = s, s *= 2)
++ for (s = s_prev; s <= range; s_prev = s, s *= 2)
+ if (s < s_prev) break;
+ incr = s / 8;
+ if (range < size && size < range + incr) {
+ incr = size - range;
+ }
+- fprintf(stderr, "%dMB OK\r", (int)(range/(1024*1024)));
++ fprintf(stderr, "%dMB OK\r", (int)(range/MEMORY_SIZE_1MB));
+ }
+ fprintf(stderr, "\n");
+ printf("%d\n", (int)(size>>20));
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/lmbench_result_html_report.patch b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/lmbench_result_html_report.patch
new file mode 100644
index 000000000..30708c81d
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/lmbench_result_html_report.patch
@@ -0,0 +1,69 @@
+From b21ca9f3911628fb66f308c6916485bbbcfb29a4 Mon Sep 17 00:00:00 2001
+From: Lin Yu <lin.yu@windriver.com>
+Date: Tue, 19 Aug 2014 05:16:16 -0400
+Subject: [PATCH] lmbench: Fix "make html" graph failure
+
+The html-list perl script cannot parse the first line of the result
+files about the lmbench version.
+
+Additional fixes are to make the result's html pages easier to understand.
+
+Signed-off-by: Lin Yu <lin.yu@windriver.com>
+Signed-off-by: Fupan Li <fupan.li@windriver.com>
+
+Reworded patch description.
+
+Upstream-status: inappropriate [ configuration ]
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+---
+ results/Makefile | 1 +
+ scripts/html-list | 7 ++-----
+ 2 files changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/results/Makefile b/results/Makefile
+index 0935376..1ef9a15 100644
+--- a/results/Makefile
++++ b/results/Makefile
+@@ -186,6 +186,7 @@ paper:
+ # scratch makes you want a Ghz machine.
+ html: dirs
+ -make clean
++ make ps
+ #$(SCRIPTS)bghtml $(BG)
+ $(SCRIPTS)html-list $(LIST)
+ $(MK) LIST="$(LIST)" summary > HTML/summary.out 2> HTML/summary.errs
+diff --git a/scripts/html-list b/scripts/html-list
+index 9850461..6383115 100755
+--- a/scripts/html-list
++++ b/scripts/html-list
+@@ -14,7 +14,7 @@ open(H, ">HTML/specific.html");
+ print H <<EOF;
+ <title>LMBENCH System Results</title>
+ <h1>LMBENCH System Results</h1>
+-<h2><a href=summary>Summary of results</a></h2>
++<h2><a href=summary.out>Summary of results</a></h2>
+ <hr>
+ EOF
+
+@@ -47,7 +47,7 @@ foreach $os (@os) {
+ open(F, $file);
+ $_ = <F>;
+ close(F);
+- next unless /lmbench1.[01]/;
++ next unless /lmbench[0-9]+.[01]/;
+ chop;
+ $title = $_;
+ #s/.lmbench1.? results for //;
+@@ -103,10 +103,7 @@ EOF
+ if $i < $#os;
+ print S<<EOF;
+ <h4>$title</h4>
+-<a href=../$doc{$what}>Information on this benchmark</a> (Not up to date)
+ <p><IMG SRC="${what}${scale}$N.gif">\n<p>
+-<a href=../lmbench.html>
+-<img align=middle src="../gifs/arrows/b_arrow.gif">LMBENCH table of contents</a>
+ <a href=specific.html>
+ <img align=middle src=\"../gifs/graph.gif\">System results table of contents</a>
+ <p>
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/obey-ranlib.patch b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/obey-ranlib.patch
new file mode 100644
index 000000000..fa5e6dbda
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/obey-ranlib.patch
@@ -0,0 +1,36 @@
+From 182a5d3dba3f440bbf35551da6d21ab1c990eb58 Mon Sep 17 00:00:00 2001
+From: Noor Ahsan <noor_ahsan@mentor.com>
+Date: Mon, 29 Aug 2011 16:17:51 +0000
+Subject: [PATCH] lmbench: Add version 3.0-a9 (initial recipe)
+
+In some cases the host may have too old of a ranlib to work. Since it's
+not exactly a great idea to not be using the cross ranlib anyhow, fix the
+Makefile so we can override ranlib and then override it
+
+Upstream-Status: Inappropriate [build system specific change]
+
+---
+ src/Makefile | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index 4962815..c7a8c79 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -38,6 +38,7 @@ CC=`../scripts/compiler`
+ MAKE=`../scripts/make`
+ AR=ar
+ ARCREATE=cr
++RANLIB=ranlib
+
+ # base of installation location
+ BASE=/usr/local
+@@ -217,7 +218,7 @@ $O/lmbench : ../scripts/lmbench version.h
+ $O/lmbench.a: $(LIBOBJS)
+ /bin/rm -f $O/lmbench.a
+ $(AR) $(ARCREATE) $O/lmbench.a $(LIBOBJS)
+- -ranlib $O/lmbench.a
++ -$(RANLIB) $O/lmbench.a
+
+ $O/lib_timing.o : lib_timing.c $(INCS)
+ $(COMPILE) -c lib_timing.c -o $O/lib_timing.o
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-config-script.patch b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-config-script.patch
new file mode 100644
index 000000000..44bc7bbcd
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-config-script.patch
@@ -0,0 +1,22 @@
+From aca1a59d888421c1fc553229b8049be47e8b3ddf Mon Sep 17 00:00:00 2001
+From: Chunrong Guo <b40290@freescale.com>
+Date: Fri, 1 Mar 2013 09:50:42 +0000
+Subject: [PATCH] lmbench: update config script
+
+Upstream-Status: Pending
+
+---
+ scripts/config | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/config b/scripts/config
+index b58cb60..25d9d77 100755
+--- a/scripts/config
++++ b/scripts/config
+@@ -3,5 +3,5 @@
+ UNAME=`uname -n 2>/dev/null`
+ if [ X$UNAME = X ]
+ then echo CONFIG
+-else echo CONFIG.$UNAME
++else echo ../scripts/CONFIG.$UNAME
+ fi
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-results-script.patch b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-results-script.patch
new file mode 100644
index 000000000..31c4aecbb
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-results-script.patch
@@ -0,0 +1,170 @@
+From 4955021bc283be404df62b97b86af3943efd29de Mon Sep 17 00:00:00 2001
+From: Noor Ahsan <noor_ahsan@mentor.com>
+Date: Mon, 29 Aug 2011 16:17:51 +0000
+Subject: [PATCH] lmbench: Add version 3.0-a9 (initial recipe)
+
+Now that we have our binaries in /usr/bin rather than the normal
+lmbench hierarchy we need to update the scripts as well to behave well here.
+
+Upstream-Status: Inappropriate [This is related to the OE-specific behavior
+of installing into /usr/bin, etc, rather than dumping everything into
+/usr/share/lmbench or similar]
+
+---
+ scripts/config-run | 40 ++++++++++++++++++++--------------------
+ scripts/results | 8 +++-----
+ 2 files changed, 23 insertions(+), 25 deletions(-)
+
+diff --git a/scripts/config-run b/scripts/config-run
+index a2d5ba4..918cbdf 100755
+--- a/scripts/config-run
++++ b/scripts/config-run
+@@ -132,20 +132,20 @@ export LMBENCH_SCHED
+ ############################################################################
+ echo $L; echo "";
+ echo "Hang on, we are calculating your timing granularity."
+-../bin/$OS/msleep 250
+-ENOUGH=`../bin/$OS/enough`
++msleep 250
++ENOUGH=`enough`
+ export ENOUGH
+ echo "OK, it looks like you can time stuff down to $ENOUGH usec resolution."
+ echo ""
+ echo "Hang on, we are calculating your timing overhead."
+-../bin/$OS/msleep 250
+-TIMING_O=`../bin/$OS/timing_o`
++msleep 250
++TIMING_O=`timing_o`
+ export TIMING_O
+ echo "OK, it looks like your gettimeofday() costs $TIMING_O usecs."
+ echo ""
+ echo "Hang on, we are calculating your loop overhead."
+-../bin/$OS/msleep 250
+-LOOP_O=`../bin/$OS/loop_o`
++msleep 250
++LOOP_O=`loop_o`
+ export LOOP_O
+ echo "OK, it looks like your benchmark loop costs $LOOP_O usecs."
+ echo ""
+@@ -177,7 +177,7 @@ then
+ fi
+ if [ X$MB = X ]
+ then $ECHON "Probing system for available memory: $ECHOC"
+- MB=`../bin/$OS/memsize 4096`
++ MB=`memsize 4096`
+ fi
+ TOTAL_MEM=$MB
+ MB=`echo \( $MB \* 7 \) / 10 | bc 2>/dev/null`
+@@ -205,9 +205,9 @@ fi
+ # Certain machines tend to barf when you try and bcopy 8MB.
+ # Figure out how much we can use.
+ echo "Checking to see if you have $MB MB; please wait for a moment..."
+-MB=`../bin/$OS/memsize $MB`
+-MB=`../bin/$OS/memsize $MB`
+-MB=`../bin/$OS/memsize $MB`
++MB=`memsize $MB`
++MB=`memsize $MB`
++MB=`memsize $MB`
+ if [ `expr $SYNC_MAX \* $MB` -gt `expr $TOTAL_MEM` ]
+ then
+ MB=`expr $TOTAL_MEM / $SYNC_MAX`
+@@ -223,8 +223,8 @@ then echo Warning: you have only ${MB}MB available memory.
+ fi
+
+ echo "Hang on, we are calculating your cache line size."
+-../bin/$OS/msleep 250
+-LINE_SIZE=`../bin/$OS/lm_line -M ${MB}M`
++msleep 250
++LINE_SIZE=`lm_line -M ${MB}M`
+ export LINE_SIZE
+ echo "OK, it looks like your cache line is $LINE_SIZE bytes."
+ echo ""
+@@ -479,7 +479,7 @@ EOF
+ then
+ for i in $disks
+ do if [ -r $i ]
+- then ../bin/$OS/flushdisk $i
++ then flushdisk $i
+ if [ $? -eq 1 ]
+ then echo "Must be root to run disk benchmarks."
+ echo "Root is needed to flush the buffer cache"
+@@ -584,7 +584,7 @@ fi
+ echo $L
+ echo ""
+ echo "Calculating mhz, please wait for a moment..."
+-MHZ=`../bin/$OS/mhz`
++MHZ=`mhz`
+ cat<<EOF
+ I think your CPU mhz is
+
+@@ -689,9 +689,9 @@ esac
+
+ INFO=`../scripts/info`
+ if [ $MAIL = yes ]
+-then if [ ! -f ../bin/$OS/$INFO ]
+- then cp ../scripts/info-template ../bin/$OS/$INFO
+- chmod +w ../bin/$OS/$INFO
++then if [ ! -f $INFO ]
++ then cp ../scripts/info-template $INFO
++ chmod +w $INFO
+ REUSE=no
+ else
+ REUSE=view
+@@ -705,7 +705,7 @@ then if [ ! -f ../bin/$OS/$INFO ]
+ ;;
+ [Vv]*) REUSE=view
+ echo $L
+- more ../bin/$OS/$INFO
++ more $INFO
+ echo $L
+ ;;
+ *) REUSE=yes
+@@ -733,7 +733,7 @@ EOF
+ then EDITOR=$TMP
+ fi
+ if [ X$EDITOR != "none" ]
+- then $EDITOR ../bin/$OS/`../scripts/info`
++ then $EDITOR `../scripts/info`
+ fi
+ fi
+ fi
+@@ -750,7 +750,7 @@ EOF
+
+ VERSION=`../scripts/version`
+
+-C=../bin/$OS/`../scripts/config`
++C=`../scripts/config`
+ echo DISKS=\"$DISKS\" > $C
+ echo DISK_DESC=\"$DISK_DESC\" >> $C
+ echo OUTPUT=$OUTPUT >> $C
+diff --git a/scripts/results b/scripts/results
+index cd07c15..d5aa558 100755
+--- a/scripts/results
++++ b/scripts/results
+@@ -8,11 +8,11 @@ RESULTS=results/$OS
+ BASE=../$RESULTS/`uname -n`
+ EXT=0
+
+-if [ ! -f "../bin/$OS/$CONFIG" ]
++if [ ! -f "$CONFIG" ]
+ then echo "No config file?"
+ exit 1
+ fi
+-. ../bin/$OS/$CONFIG
++. $CONFIG
+
+ if [ ! -d ../$RESULTS ]
+ then mkdir -p ../$RESULTS
+@@ -23,11 +23,9 @@ do EXT=`expr $EXT + 1`
+ RESULTS=$BASE.$EXT
+ done
+
+-cd ../bin/$OS
+-PATH=.:${PATH}; export PATH
+ export SYNC_MAX
+ export OUTPUT
+-lmbench $CONFIG 2>../${RESULTS}
++lmbench $CONFIG 2>${RESULTS}
+
+ if [ X$MAIL = Xyes ]
+ then echo Mailing results
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/use-base_libdir-instead-of-hardcoded-lib.patch b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/use-base_libdir-instead-of-hardcoded-lib.patch
new file mode 100644
index 000000000..c6e9465ac
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/use-base_libdir-instead-of-hardcoded-lib.patch
@@ -0,0 +1,30 @@
+From 73fdc58ca4eb9e2f24d854b3af3a4e5daac5a33e Mon Sep 17 00:00:00 2001
+From: Ting Liu <b28495@freescale.com>
+Date: Fri, 22 Nov 2013 15:20:08 +0800
+Subject: [PATCH] use base_libdir instead of hardcoded /lib
+
+Upstream Status: Inappropriate [configuration]
+
+Signed-off-by: Ting Liu <b28495@freescale.com>
+
+---
+ src/Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index c7a8c79..c7e4e3c 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -143,10 +143,10 @@ install-target:
+ if [ ! -d $(BASE) ]; then mkdir $(BASE); fi
+ if [ ! -d $(BASE)/bin ]; then mkdir $(BASE)/bin; fi
+ if [ ! -d $(BASE)/include ]; then mkdir $(BASE)/include; fi
+- if [ ! -d $(BASE)/lib ]; then mkdir $(BASE)/lib; fi
++ if [ ! -d $(BASE)$(base_libdir) ]; then mkdir $(BASE)$(base_libdir); fi
+ cp $(EXES) $(BASE)/bin
+ cp $(INCS) $(BASE)/include
+- cp $O/lmbench.a $(BASE)/lib/libmbench.a
++ cp $O/lmbench.a $(BASE)$(base_libdir)
+ cd ../doc; env MAKEFLAGS="$(MAKEFLAGS)" make CC="${CC}" OS="${OS}" BASE="$(BASE)" install
+
+
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/0001-avoid-gcc-optimize-away-the-loops.patch b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/0001-avoid-gcc-optimize-away-the-loops.patch
new file mode 100644
index 000000000..b964bef1f
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/0001-avoid-gcc-optimize-away-the-loops.patch
@@ -0,0 +1,80 @@
+From 25738bb9c75f94b451201acfd6bcab13bdeee512 Mon Sep 17 00:00:00 2001
+From: Roy Li <rongqing.li@windriver.com>
+Date: Thu, 5 May 2016 09:52:01 +0800
+Subject: [PATCH] [PATCH] avoid gcc optimize-away the loops
+
+Upstream-Status: pending
+
+Change expression used in do_integer_mul and do_uint64_mul
+benchmarks so GCC doesn't optimize-away the loops, other
+things are same:
+- TEN(r *= s;); r -= t;
++ i = 0;
++ while ( i++ < 10)
++ r *= s;
++ r -= t;
+
+and TEN is macro:
+ #define TEN(a) a a a a a a a a a a
+
+Signed-off-by: Roy Li <rongqing.li@windriver.com>
+
+---
+ src/lat_ops.c | 30 +++++++++++++++++++++++++-----
+ 1 file changed, 25 insertions(+), 5 deletions(-)
+
+diff --git a/src/lat_ops.c b/src/lat_ops.c
+index d343ff3..457072b 100644
+--- a/src/lat_ops.c
++++ b/src/lat_ops.c
+@@ -126,11 +126,23 @@ do_integer_mul(iter_t iterations, void* cookie)
+ struct _state *pState = (struct _state*)cookie;
+ register int r = pState->N + 37431;
+ register int s = pState->N + 4;
+- register int t = r * s * s * s * s * s * s * s * s * s * s - r;
++ register int t = r;
++ int i = 0;
++
++ while ( i++ < 10)
++ t *= s;
++ t -= r;
+
+ while (iterations-- > 0) {
+- TEN(r *= s;); r -= t;
+- TEN(r *= s;); r -= t;
++ i = 0;
++ while ( i++ < 10)
++ r *= s;
++ r -= t;
++
++ i = 0;
++ while ( i++ < 10)
++ r *= s;
++ r -= t;
+ }
+ use_int(r);
+ }
+@@ -207,13 +219,21 @@ do_int64_mul(iter_t iterations, void* cookie)
+ register int64 r = (int64)pState->N + 37420;
+ register int64 s = (int64)pState->N + 4;
+ register int64 t;
++ int i = 0;
+
+ r += (int64)(pState->N + 6)<<32;
+ t = r * s * s * s * s * s * s * s * s * s * s - r;
+
+ while (iterations-- > 0) {
+- TEN(r *= s;); r -= t;
+- TEN(r *= s;); r -= t;
++ i = 0;
++ while ( i++ < 10)
++ r *= s;
++ r -= t;
++
++ i = 0;
++ while ( i++ < 10)
++ r *= s;
++ r -= t;
+ }
+ use_int((int)r);
+ }
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/lmbench-run b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/lmbench-run
new file mode 100644
index 000000000..e904c75e4
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/lmbench-run
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Wrapper script for lmbench written for the
+# Debian GNU/Linux distribution by
+# Javier Fernandez-Sanguino.
+# Distributed under the GPL
+SHAREDIR=/usr/share/lmbench/
+BINDIR=/usr/lib/lmbench/
+SCRIPTSDIR=$SHAREDIR/scripts
+RESULTSDIR=$SHAREDIR/results
+CONFIG=/var/lib/lmbench/config/`$SCRIPTSDIR/config`
+runuid=`id -u`
+
+[ $runuid -gt 0 ] && {
+ echo "You must run this as the root user"
+ exit 0
+}
+cd $SCRIPTSDIR
+[ ! -f $CONFIG ] && ./config-run
+./results
+
+echo "Benchmark run finished...."
+echo "Remember you can find the results of the benchmark "
+echo "under $RESULTSDIR"
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/rename-line-binary.patch b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/rename-line-binary.patch
new file mode 100644
index 000000000..b42ee7d0f
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/rename-line-binary.patch
@@ -0,0 +1,30 @@
+From 16823f5c3d3d5adad0b70e9055c08cb4e18d255b Mon Sep 17 00:00:00 2001
+From: Noor Ahsan <noor_ahsan@mentor.com>
+Date: Mon, 29 Aug 2011 16:17:51 +0000
+Subject: [PATCH] lmbench: Add version 3.0-a9 (initial recipe)
+
+Both lmbench and util-linux-ng packages provide own /usr/bin/line binaries.
+Even though the binaries name is the same, their functionality is different.
+This patch renames lmbench's line binary as lm_line to avoid conflicts with
+util-linux-ng. script/config-run is also modified (patch) to call lm_line
+instead of line.
+
+Upstream-Status: Inappropriate [build system specific change]
+
+---
+ scripts/config-run | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/config-run b/scripts/config-run
+index f620c15..a2d5ba4 100755
+--- a/scripts/config-run
++++ b/scripts/config-run
+@@ -224,7 +224,7 @@ fi
+
+ echo "Hang on, we are calculating your cache line size."
+ ../bin/$OS/msleep 250
+-LINE_SIZE=`../bin/$OS/line -M ${MB}M`
++LINE_SIZE=`../bin/$OS/lm_line -M ${MB}M`
+ export LINE_SIZE
+ echo "OK, it looks like your cache line is $LINE_SIZE bytes."
+ echo ""
diff --git a/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb
new file mode 100644
index 000000000..03b3721ca
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb
@@ -0,0 +1,88 @@
+SUMMARY = "Tools for performance analysis"
+HOMEPAGE = "http://lmbench.sourceforge.net/"
+SECTION = "console/utils"
+LICENSE = "GPLv2 & GPL-2.0-with-lmbench-restriction"
+LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
+ file://COPYING-2;md5=8e9aee2ccc75d61d107e43794a25cdf9"
+
+inherit autotools-brokensep
+
+DEPENDS_append_libc-musl = " libtirpc"
+CFLAGS_append_libc-musl = " -I${STAGING_INCDIR}/tirpc"
+LDLIBS_append_libc-musl = " -ltirpc "
+
+PR = "r2"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \
+ file://lmbench-run \
+ file://rename-line-binary.patch \
+ file://update-results-script.patch \
+ file://obey-ranlib.patch \
+ file://update-config-script.patch \
+ file://use-base_libdir-instead-of-hardcoded-lib.patch \
+ file://lmbench_result_html_report.patch \
+ file://fix-lmbench-memory-check-failure.patch \
+ file://0001-avoid-gcc-optimize-away-the-loops.patch \
+ file://0001-lat_http.c-Add-printf-format.patch \
+ file://0001-Check-for-musl-define-guard-before-redefining-sockle.patch \
+ file://0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch \
+ "
+SRC_URI[md5sum] = "b3351a3294db66a72e2864a199d37cbf"
+SRC_URI[sha256sum] = "cbd5777d15f44eab7666dcac418054c3c09df99826961a397d9acf43d8a2a551"
+
+EXTRA_OEMAKE = 'CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" LDLIBS="${LDLIBS}" LD="${LD}" OS="${TARGET_SYS}" \
+ TARGET="${TARGET_OS}" BASE="${prefix}" MANDIR="${mandir}"'
+
+do_configure() {
+ :
+}
+
+do_compile () {
+ for CONFIG_SITE_ITEM in $CONFIG_SITE; do
+ . $CONFIG_SITE_ITEM
+ done
+ if [ X"$ac_cv_uint" = X"yes" ]; then
+ CFLAGS="${CFLAGS} -DHAVE_uint"
+ fi
+ install -d ${S}/bin/${TARGET_SYS}
+ oe_runmake -C src
+}
+
+do_install () {
+ install -d ${D}${sysconfdir}/default/volatiles \
+ ${D}${bindir} ${D}${mandir} ${D}${libdir}/lmbench \
+ ${D}${datadir}/lmbench/scripts
+
+ echo "d root root 0755 ${localstatedir}/run/${BPN} none" \
+ > ${D}${sysconfdir}/default/volatiles/99_lmbench
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+ install -d ${D}${sysconfdir}/tmpfiles.d
+ echo "d /run/${BPN} - - - -" \
+ > ${D}${sysconfdir}/tmpfiles.d/lmbench.conf
+ fi
+
+ oe_runmake BASE="${D}${prefix}" MANDIR="${D}${mandir}" \
+ -C src install
+ mv ${D}${bindir}/line ${D}${bindir}/lm_line
+ install -m 0755 ${WORKDIR}/lmbench-run ${D}${bindir}/
+ sed -i -e 's,^SHAREDIR=.*$,SHAREDIR=${datadir}/${BPN},;' \
+ -e 's,^BINDIR=.*$,BINDIR=${libdir}/${BPN},;' \
+ -e 's,^CONFIG=.*$,CONFIG=`$SCRIPTSDIR/config`,;' \
+ ${D}${bindir}/lmbench-run
+ install -m 0755 ${S}/scripts/lmbench ${D}${bindir}
+ install -m 0755 ${S}/scripts/* ${D}${datadir}/lmbench/scripts
+}
+
+pkg_postinst_${PN} () {
+ if [ -z "$D" ]; then
+ if command -v systemd-tmpfiles >/dev/null; then
+ systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/lmbench.conf
+ elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
+ ${sysconfdir}/init.d/populate-volatile.sh update
+ fi
+ fi
+}
+
+RDEPENDS_${PN} = "perl"
+FILES_${PN} += "${datadir}/lmbench ${libdir}/lmbench"
OpenPOWER on IntegriCloud