Skip to contentSkip to conversation

lmbench: three fixes

PATCH New [email protected] 1 participant 4 messages Aug 19, 2014

lore
Share & tools
lore
#0 lore raw

cover lmbench: three fixes

From: Jackie Huang <[email protected]>

--
The following changes since commit 5f532a928c7df863a3f0d32db3918c8f7d227e2b:

cyassl: add recipe (2014-08-15 17:07:45 +0200)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib jhuang0/r_lmbench_140818-3
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=jhuang0/r_lmbench_140818-3

Jackie Huang (3):
lmbench: Fix "make html" graph failure
lmbench: fix lmbench memory check failure
lmbench: fix doc install failure

 .../fix-lmbench-memory-check-failure.patch         |  206 ++++++++++++++++++++
 .../lmbench_result_html_report.patch               |   61 ++++++
 .../recipes-benchmark/lmbench/lmbench_3.0-a9.bb    |    8 +-
 3 files changed, 272 insertions(+), 3 deletions(-)
 create mode 100644 meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/fix-lmbench-memory-check-failure.patch
 create mode 100644 meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/lmbench_result_html_report.patch
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/3 lmbench: Fix "make html" graph failure

From: Jackie Huang <[email protected]>

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.

---
 .../lmbench_result_html_report.patch               |   61 ++++++++++++++++++++
 .../recipes-benchmark/lmbench/lmbench_3.0-a9.bb    |    5 +-
 2 files changed, 64 insertions(+), 2 deletions(-)
 create mode 100644 meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/lmbench_result_html_report.patch
meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/lmbench_result_html_report.patch new file +61 -0
new file mode 100644
index 0000000..cda2f0c
@@ -0,0 +1,61 @@
+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 <[email protected]>
+Signed-off-by: Fupan Li <[email protected]>
+
+Reworded patch description.
+
+Upstream-status: inappropriate [ configuration ]
+
+Signed-off-by: Mark Hatle <[email protected]>
+
+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>
meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb +3 -2
index 41db150..d8238ae 100644
@@ -14,8 +14,9 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \
            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://update-config-script.patch \
+           file://use-base_libdir-instead-of-hardcoded-lib.patch \
+           file://lmbench_result_html_report.patch \
 "
 SRC_URI[md5sum] = "b3351a3294db66a72e2864a199d37cbf"
 SRC_URI[sha256sum] = "cbd5777d15f44eab7666dcac418054c3c09df99826961a397d9acf43d8a2a551"
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/3 lmbench: fix lmbench memory check failure

In reply to [email protected]

From: Jackie Huang <[email protected]>

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.

---
 .../fix-lmbench-memory-check-failure.patch         |  206 ++++++++++++++++++++
 .../recipes-benchmark/lmbench/lmbench_3.0-a9.bb    |    1 +
 2 files changed, 207 insertions(+)
 create mode 100644 meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/fix-lmbench-memory-check-failure.patch
meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/fix-lmbench-memory-check-failure.patch new file +206 -0
new file mode 100644
index 0000000..549a114
@@ -0,0 +1,206 @@
+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 <[email protected]>
+Signed-off-by: Fupan Li <[email protected]>
+
+Add and reword above comments
+
+Upstream-status: inappropriate [ configuration ]
+
+Signed-off-by: Mark Hatle <[email protected]>
+
+diff --git a/scripts/config-run b/scripts/config-run
+index e1f7b6d..31b9256 100755
+--- a/scripts/config-run
++++ b/scripts/config-run
+@@ -214,6 +214,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
+ TMP=""
+@@ -718,10 +724,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
+@@ -765,7 +771,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 d1f0dc6..5098998 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -49,7 +49,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..cf9fe0c 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));
meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb +1 -0
index d8238ae..c5d6ac8 100644
@@ -17,6 +17,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \
            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 \
 "
 SRC_URI[md5sum] = "b3351a3294db66a72e2864a199d37cbf"
 SRC_URI[sha256sum] = "cbd5777d15f44eab7666dcac418054c3c09df99826961a397d9acf43d8a2a551"

--
1.7.9.5

#3 lore raw

PATCH 3/3 lmbench: fix doc install failure

In reply to [email protected]

From: Jackie Huang <[email protected]>

Fix the failure:
cp: cannot create regular file `/usr/share/man/man1/bargraph.1': Permission denied
mkdir: cannot create directory `/usr/share/man/man9': Permission denied

---
 .../recipes-benchmark/lmbench/lmbench_3.0-a9.bb    |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb +1 -1
index c5d6ac8..67392b4 100644
@@ -52,7 +52,7 @@ do_install () {
               > ${D}${sysconfdir}/tmpfiles.d/lmbench.conf
     fi
 
-    oe_runmake 'BASE=${D}${prefix}' \
+    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}/
Signature · 1 line
1.7.9.5