added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -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);
}

View File

@@ -0,0 +1,27 @@
From 4bbedd25e74adb5cb181a9ae589adb2052ade630 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 31 Aug 2022 23:34:48 -0700
Subject: [PATCH] bench.h: Fix typo in specifying string.h
Upstream-Status: Pending
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 2ebdf5a..750bebf 100644
--- a/src/bench.h
+++ b/src/bench.h
@@ -21,7 +21,7 @@ typedef unsigned char bool_t;
#include <signal.h>
#include <errno.h>
#ifndef WIN32
-#include <strings.h>
+#include <string.h>
#endif
#include <sys/types.h>
#ifndef WIN32
--
2.37.3

View File

@@ -0,0 +1,30 @@
From 9bf2b363c5173c03adecf366f116415dbc559017 Mon Sep 17 00:00:00 2001
From: Yanfei Xu <yanfei.xu@windriver.com>
Date: Tue, 23 Feb 2021 10:54:26 +0800
Subject: [PATCH 1/2] doc: Fix typos in lat_unix_connect manual page
Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
---
doc/lat_unix_connect.8 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/lat_unix_connect.8 b/doc/lat_unix_connect.8
index b42e9a4..5ab1a51 100644
--- a/doc/lat_unix_connect.8
+++ b/doc/lat_unix_connect.8
@@ -25,9 +25,9 @@ is a client/server program that measures interprocess
connection latencies. The benchmark times the creation and connection of
an AF_UNIX socket to a local server.
.LP
-.B lat_connect
-has three forms of usage: as a server (-s), as a client (lat_connect),
-and as a shutdown (lat_connect -S).
+.B lat_unix_connect
+has three forms of usage: as a server (-s), as a client (lat_unix_connect),
+and as a shutdown (lat_unix_connect -S).
.SH OUTPUT
The reported time is in microseconds per connection.
Output format is like so
--
2.27.0

View File

@@ -0,0 +1,100 @@
From a8d86a2d994a008dab3c3ecad65528c0e5fc2cba Mon Sep 17 00:00:00 2001
From: He Zhe <zhe.he@windriver.com>
Date: Fri, 22 Jan 2021 11:22:48 +0800
Subject: [PATCH] doc: Fix typos in manual pages
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
doc/bw_mem.8 | 2 +-
doc/lat_fcntl.8 | 2 +-
doc/lat_fifo.8 | 2 +-
doc/lat_http.8 | 6 +++---
doc/lat_select.8 | 2 +-
doc/lat_sig.8 | 2 +-
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/doc/bw_mem.8 b/doc/bw_mem.8
index 33df417..9e84d73 100644
--- a/doc/bw_mem.8
+++ b/doc/bw_mem.8
@@ -3,7 +3,7 @@
.SH NAME
bw_mem \- time memory bandwidth
.SH SYNOPSIS
-.B bw_mem_cp
+.B bw_mem
[
.I "-P <parallelism>"
]
diff --git a/doc/lat_fcntl.8 b/doc/lat_fcntl.8
index cf3c93e..2e501d6 100644
--- a/doc/lat_fcntl.8
+++ b/doc/lat_fcntl.8
@@ -3,7 +3,7 @@
.SH NAME
lat_fcntl \- fcntl file locking benchmark
.SH SYNOPSIS
-.B lat_ctx
+.B lat_fcntl
[
.I "-P <parallelism>"
]
diff --git a/doc/lat_fifo.8 b/doc/lat_fifo.8
index 65e5a08..90bc900 100644
--- a/doc/lat_fifo.8
+++ b/doc/lat_fifo.8
@@ -3,7 +3,7 @@
.SH NAME
lat_fifo \- FIFO benchmark
.SH SYNOPSIS
-.B lat_ctx
+.B lat_fifo
[
.I "-P <parallelism>"
]
diff --git a/doc/lat_http.8 b/doc/lat_http.8
index a4bb459..99c5d4a 100644
--- a/doc/lat_http.8
+++ b/doc/lat_http.8
@@ -1,9 +1,9 @@
.\" $Id$
-.TH LAT_FCNTL 8 "$Date$" "(c)1994-2000 Carl Staelin and Larry McVoy" "LMBENCH"
+.TH LAT_HTTP 8 "$Date$" "(c)1994-2000 Carl Staelin and Larry McVoy" "LMBENCH"
.SH NAME
-lat_fcntl \- fcntl file locking benchmark
+lat_http \- http GET request latency
.SH SYNOPSIS
-.B lat_ctx
+.B lat_http
[
.I "-d"
]
diff --git a/doc/lat_select.8 b/doc/lat_select.8
index 03f83bf..e13499f 100644
--- a/doc/lat_select.8
+++ b/doc/lat_select.8
@@ -3,7 +3,7 @@
.SH NAME
lat_select \- select benchmark
.SH SYNOPSIS
-.B lat_ctx
+.B lat_select
[
.I "-P <parallelism>"
]
diff --git a/doc/lat_sig.8 b/doc/lat_sig.8
index 91baf78..19a8838 100644
--- a/doc/lat_sig.8
+++ b/doc/lat_sig.8
@@ -3,7 +3,7 @@
.SH NAME
lat_sig \- select benchmark
.SH SYNOPSIS
-.B lat_ctx
+.B lat_sig
[
.I "-P <parallelism>"
]
--
2.17.1

View File

@@ -0,0 +1,42 @@
From 78912c0ac5e090095a2f2bd6226e02cce949e72e Mon Sep 17 00:00:00 2001
From: He Zhe <zhe.he@windriver.com>
Date: Fri, 22 Jan 2021 10:03:38 +0000
Subject: [PATCH] lat_fifo: Fix cleanup sequence
Files should be unlinked after all users exit.
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
src/lat_fifo.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/lat_fifo.c b/src/lat_fifo.c
index c625161..85bb9d1 100644
--- a/src/lat_fifo.c
+++ b/src/lat_fifo.c
@@ -120,16 +120,16 @@ cleanup(iter_t iterations, void * cookie)
if (iterations) return;
- unlink(state->filename1);
- unlink(state->filename2);
- close(state->wr);
- close(state->rd);
-
if (state->pid > 0) {
- kill(state->pid, 15);
+ kill(state->pid, SIGKILL);
waitpid(state->pid, NULL, 0);
state->pid = 0;
}
+
+ unlink(state->filename1);
+ unlink(state->filename2);
+ close(state->wr);
+ close(state->rd);
}
void
--
2.29.2

View File

@@ -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) {

View File

@@ -0,0 +1,77 @@
From 353e8a62bf3cb5f1b9504efa16b8b974e93cac49 Mon Sep 17 00:00:00 2001
From: He Zhe <zhe.he@windriver.com>
Date: Fri, 22 Jan 2021 10:58:41 +0800
Subject: [PATCH] lmbench: Point webpage-lm to target directory
As webpage-lm.tar has been copied to ${datadir}\lmbench.
Plus improve 'hello' copying in lmbench script.
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
scripts/lmbench | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/scripts/lmbench b/scripts/lmbench
index 7a52cb1..82e36b6 100755
--- a/scripts/lmbench
+++ b/scripts/lmbench
@@ -167,7 +167,7 @@ if [ X$BENCHMARK_OS = XYES -o X$BENCHMARK_UNIX = XYES ]; then
lat_unix -P $SYNC_MAX
fi
if [ X$BENCHMARK_OS = XYES -o X$BENCHMARK_PROC = XYES ]; then
- cp hello /tmp/hello
+ cp `which hello` /tmp/hello
for i in fork exec shell
do lat_proc -P $SYNC_MAX $i
done
@@ -237,14 +237,14 @@ fi
date >> ${OUTPUT}
echo Local networking >> ${OUTPUT}
-if [ ! -d ../../src/webpage-lm ]
-then (cd ../../src && tar xf webpage-lm.tar)
+if [ ! -d /usr/share/lmbench/webpage-lm ]
+then (cd /usr/share/lmbench && tar xf webpage-lm.tar)
sync
sleep 1
fi
SERVERS="lat_udp lat_tcp lat_rpc lat_connect bw_tcp"
for server in $SERVERS; do $server -s; done
-DOCROOT=../../src/webpage-lm lmhttp 8008 &
+DOCROOT=/usr/share/lmbench/webpage-lm lmhttp 8008 &
sleep 2;
if [ X$BENCHMARK_OS = XYES -o X$BENCHMARK_UDP = XYES ]; then
@@ -280,15 +280,15 @@ bw_tcp -S localhost
if [ X$BENCHMARK_OS = XYES -o X$BENCHMARK_HTTP = XYES ]; then
# I want a hot cache number
- lat_http localhost 8008 < ../../src/webpage-lm/URLS > /dev/null 2>&1
- lat_http localhost 8008 < ../../src/webpage-lm/URLS
+ lat_http localhost 8008 < /usr/share/lmbench/webpage-lm/URLS > /dev/null 2>&1
+ lat_http localhost 8008 < /usr/share/lmbench/webpage-lm/URLS
fi
lat_http -S localhost 8008
for remote in $REMOTE
do
echo Networking to $remote >> ${OUTPUT}
- $RCP $SERVERS lmhttp ../../src/webpage-lm.tar ${remote}:/tmp
+ $RCP $SERVERS lmhttp /usr/share/lmbench/webpage-lm.tar ${remote}:/tmp
for server in $SERVERS
do $RSH $remote -n /tmp/$server -s &
done
@@ -327,8 +327,8 @@ do
if [ X$BENCHMARK_OS = XYES -o X$BENCHMARK_HTTP = XYES ]; then
# I want a hot cache number
- lat_http $remote 8008 < ../../src/webpage-lm/URLS > /dev/null 2>&1
- lat_http $remote 8008 < ../../src/webpage-lm/URLS
+ lat_http $remote 8008 < /usr/share/lmbench/webpage-lm/URLS > /dev/null 2>&1
+ lat_http $remote 8008 < /usr/share/lmbench/webpage-lm/URLS
fi
lat_http -S $remote 8008
--
2.17.1

View File

@@ -0,0 +1,239 @@
From bcc6816b92ecf409357865589069a82883d589f7 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 6 Sep 2022 22:53:51 -0700
Subject: [PATCH] scripts/build: Fix the tests to build with clang15
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
scripts/build | 50 +++++++++++++++++++++++++-------------------------
1 file changed, 25 insertions(+), 25 deletions(-)
--- a/scripts/build
+++ b/scripts/build
@@ -21,7 +21,7 @@ trap 'rm -f ${BASE}$$.s ${BASE}$$.c ${BA
LDLIBS="$LDLIBS -lm"
# check for HP-UX's ANSI compiler
-echo "main(int ac, char *av[]) { int i; }" > ${BASE}$$.c
+echo "int main(int ac, char *av[]) { int i; }" > ${BASE}$$.c
if ${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c 1>${NULL} 2>${NULL}
then
true;
@@ -39,7 +39,7 @@ arch=`echo $OS | awk -F- '{print $1;}'`
if [ "X$CC" = "Xcc" -a "X$arch" = "Xia64" ]
then
echo "#include <stdlib.h>" > ${BASE}$$.c
- echo "main(int ac, char *av[])" >> ${BASE}$$.c
+ echo "int main(int ac, char *av[])" >> ${BASE}$$.c
echo "{ long* p = (long*)malloc(sizeof(long));" >> ${BASE}$$.c
echo "*p = 0; exit((int)*p); }" >> ${BASE}$$.c
${CC} ${CFLAGS} +DD64 -o ${BASE}$$ ${BASE}$$.c 1>${NULL} 2>${NULL} \
@@ -51,14 +51,14 @@ fi
# check for bcopy (optionally set the SYS5 flag)
echo "#include <string.h>" > ${BASE}$$.c
-echo "main() { char a[256], b[256]; bcopy(a, b, 256); }" >> ${BASE}$$.c
+echo "int main() { char a[256], b[256]; bcopy(a, b, 256); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
|| CFLAGS="${CFLAGS} -DSYS5"
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
# check for valloc
echo "#include <stdlib.h>" > ${BASE}$$.c
-echo "main() { char* buf = valloc(123); }" >> ${BASE}$$.c
+echo "int main() { char* buf = valloc(123); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
|| CFLAGS="${CFLAGS} -Dvalloc=malloc"
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -67,7 +67,7 @@ rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
echo "#include <stdlib.h>" > ${BASE}$$.c
echo "#include <sys/types.h>" >> ${BASE}$$.c
echo "#include <unistd.h>" >> ${BASE}$$.c
-echo "main() { off64_t off; }" >> ${BASE}$$.c
+echo "int main() { off64_t off; }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DHAVE_off64_t"
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -76,7 +76,7 @@ rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
echo "#include <stdlib.h>" > ${BASE}$$.c
echo "#include <sys/types.h>" >> ${BASE}$$.c
echo "#include <unistd.h>" >> ${BASE}$$.c
-echo "main() { int fd = 0; off64_t off = 0; off = lseek64(fd, off, SEEK_SET); }" >> ${BASE}$$.c
+echo "int main() { int fd = 0; off64_t off = 0; off = lseek64(fd, off, SEEK_SET); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DHAVE_lseek64"
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -88,7 +88,7 @@ echo "#include <sys/resource.h>" >> ${BA
echo "#ifndef RUSAGE_SELF" >> ${BASE}$$.c
echo "#define RUSAGE_SELF 0" >> ${BASE}$$.c
echo "#endif /* RUSAGE_SELF */" >> ${BASE}$$.c
-echo "main() { struct rusage ru; getrusage(RUSAGE_SELF, &ru); }" >> ${BASE}$$.c
+echo "int main() { struct rusage ru; getrusage(RUSAGE_SELF, &ru); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DRUSAGE"
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -125,24 +125,24 @@ fi
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
# check for -lrpc (cygwin/Windows)
-echo "extern int pmap_set(); main() { pmap_set(); }" >${BASE}$$.c
+echo "extern int pmap_set(void); int main() { pmap_set(); }" >${BASE}$$.c
if ${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL}; then
true;
-else
- ${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} -lrpc 1>${NULL} 2>${NULL} \
- && LDLIBS="${LDLIBS} -lrpc"
+elif ${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} -lrpc 1>${NULL} 2>${NULL}; then
+ LDLIBS="${LDLIBS} -lrpc"
+else ${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} -ltirpc 1>${NULL} 2>${NULL} && LDLIBS="${LDLIBS} -ltirpc"
fi
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
# check for OSs that have S_IFFIFO instead of S_IFIFO
echo "#include <sys/stat.h>" > ${BASE}$$.c
-echo "main() { return (S_IFIFO); }" >> ${BASE}$$.c
+echo "int main() { return (S_IFIFO); }" >> ${BASE}$$.c
if ${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL}; then
true;
else
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
echo "#include <sys/stat.h>" > ${BASE}$$.c
- echo "main() { return (S_IFFIFO); }" >> ${BASE}$$.c
+ echo "int main() { return (S_IFFIFO); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
|| CFLAGS="${CFLAGS} -DS_IFIFO=S_IFFIFO"
fi
@@ -151,7 +151,7 @@ rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
# check that we have uint
echo "#include <stdlib.h>" > ${BASE}$$.c
echo "#include <sys/types.h>" >> ${BASE}$$.c
-echo "main() { uint i = 0; return (i); }" >> ${BASE}$$.c
+echo "int main() { uint i = 0; return (i); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DHAVE_uint=1";
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -161,7 +161,7 @@ HAVE_uint64=0
echo "#include <stdlib.h>" > ${BASE}$$.c
echo "#include <sys/types.h>" >> ${BASE}$$.c
echo "#include <rpc/types.h>" >> ${BASE}$$.c
-echo "main() { uint64 i = 0; return (int)(i); }" >> ${BASE}$$.c
+echo "int main() { uint64 i = 0; return (int)(i); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DHAVE_uint64=1" && HAVE_uint64=1;
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -170,7 +170,7 @@ rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
if [ ${HAVE_uint64} = 0 ]; then
echo "#include <stdlib.h>" > ${BASE}$$.c
echo "#include <sys/types.h>" >> ${BASE}$$.c
- echo "main() { uint64_t i = 0; return (int)(i); }" >> ${BASE}$$.c
+ echo "int main() { uint64_t i = 0; return (int)(i); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DHAVE_uint64_t=1";
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -181,7 +181,7 @@ HAVE_int64=0
echo "#include <stdlib.h>" > ${BASE}$$.c
echo "#include <sys/types.h>" >> ${BASE}$$.c
echo "#include <rpc/types.h>" >> ${BASE}$$.c
-echo "main() { int64 i = 0; return (int)(i); }" >> ${BASE}$$.c
+echo "int main() { int64 i = 0; return (int)(i); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DHAVE_int64=1" && HAVE_int64=1;
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -190,7 +190,7 @@ rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
if [ ${HAVE_int64} = 0 ]; then
echo "#include <stdlib.h>" > ${BASE}$$.c
echo "#include <sys/types.h>" >> ${BASE}$$.c
- echo "main() { int64_t i = 0; return (int)(i); }" >> ${BASE}$$.c
+ echo "int main() { int64_t i = 0; return (int)(i); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DHAVE_int64_t=1";
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -209,7 +209,7 @@ rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
echo "#include <stdlib.h>" > ${BASE}$$.c
echo "#include <sys/types.h>" >> ${BASE}$$.c
echo "#include <sys/socket.h>" >> ${BASE}$$.c
-echo "main() { int s; struct sockaddr dest; socklen_t len; getsockname(s, &dest, &len); }" >> ${BASE}$$.c
+echo "int main() { int s; struct sockaddr dest; socklen_t len; getsockname(s, &dest, &len); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DHAVE_socklen_t"
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -217,7 +217,7 @@ rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
# check that we have drand48 and srand48
HAVE_RANDOM=0
echo "#include <stdlib.h>" > ${BASE}$$.c
-echo "main() { srand48(973); return (int)(1.0E9 * drand48()); }" >> ${BASE}$$.c
+echo "int main() { srand48(973); return (int)(1.0E9 * drand48()); }" >> ${BASE}$$.c
if ${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL}; then
CFLAGS="${CFLAGS} -DHAVE_DRAND48"
HAVE_RANDOM=1
@@ -226,7 +226,7 @@ rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
if [ ${HAVE_RANDOM} -eq 0 ]; then
echo "#include <stdlib.h>" > ${BASE}$$.c
- echo "main() { srand(973); return (10 * rand()) / RAND_MAX; }" >> ${BASE}$$.c
+ echo "int main() { srand(973); return (10 * rand()) / RAND_MAX; }" >> ${BASE}$$.c
if ${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL}; then
CFLAGS="${CFLAGS} -DHAVE_RAND"
HAVE_RANDOM=1
@@ -236,7 +236,7 @@ fi
if [ ${HAVE_RANDOM} -eq 0 ]; then
echo "#include <stdlib.h>" > ${BASE}$$.c
- echo "main() { srandom(973); return (10 * random()) / RAND_MAX; }" >> ${BASE}$$.c
+ echo "int main() { srandom(973); return (10 * random()) / RAND_MAX; }" >> ${BASE}$$.c
if ${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL}; then
CFLAGS="${CFLAGS} -DHAVE_RANDOM"
HAVE_RANDOM=1
@@ -247,7 +247,7 @@ fi
# check that we have sysmp
echo "#include <sys/types.h>" > ${BASE}$$.c
echo "#include <sys/sysmp.h>" >> ${BASE}$$.c
-echo "main() { return (int)sysmp(MP_NPROCS); }" >> ${BASE}$$.c
+echo "int main() { return (int)sysmp(MP_NPROCS); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DHAVE_SYSMP=1";
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -257,7 +257,7 @@ echo "#include <stdlib.h>" > ${BASE}$$.c
echo "#include <unistd.h>" >> ${BASE}$$.c
echo "#include <sys/types.h>" >> ${BASE}$$.c
echo "#include <sys/processor.h>" >> ${BASE}$$.c
-echo "main() { return bindprocessor(BINDPROCESS, getpid(), 0); }" >> ${BASE}$$.c
+echo "int main() { return bindprocessor(BINDPROCESS, getpid(), 0); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DHAVE_BINDPROCESSOR=1";
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -267,16 +267,17 @@ echo "#include <stdlib.h>" > ${BASE}$$.c
echo "#include <sys/types.h>" >> ${BASE}$$.c
echo "#include <sys/processor.h>" >> ${BASE}$$.c
echo "#include <sys/procset.h>" >> ${BASE}$$.c
-echo "main() { return processor(P_PID, P_MYPID, 0, NULL); }" >> ${BASE}$$.c
+echo "int main() { return processor(P_PID, P_MYPID, 0, NULL); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DHAVE_BINDPROCESSOR=1";
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
# check that we have sched_setaffinity
-echo "#include <stdlib.h>" > ${BASE}$$.c
+echo "#define _GNU_SOURCE" > ${BASE}$$.c
+echo "#include <stdlib.h>" >> ${BASE}$$.c
echo "#include <unistd.h>" >> ${BASE}$$.c
echo "#include <sched.h>" >> ${BASE}$$.c
-echo "main() { unsigned long mask = 1; return sched_setaffinity(0, sizeof(unsigned long), &mask); }" >> ${BASE}$$.c
+echo "int main() { unsigned long mask = 1; return sched_setaffinity(0, sizeof(unsigned long), &mask); }" >> ${BASE}$$.c
${CC} ${CFLAGS} -o ${BASE}$$ ${BASE}$$.c ${LDLIBS} 1>${NULL} 2>${NULL} \
&& CFLAGS="${CFLAGS} -DHAVE_SCHED_SETAFFINITY=1";
rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
@@ -285,4 +286,4 @@ rm -f ${BASE}$$ ${BASE}$$.o ${BASE}$$.c
if [ ! -d ${BINDIR} ]; then mkdir -p ${BINDIR}; fi
# now go ahead and build everything!
-${MAKE} OS="${OS}" CC="${CC}" CFLAGS="${CFLAGS}" LDLIBS="${LDLIBS}" O="${BINDIR}" $*
+${MAKE} OS="${OS}" CC="${CC}" CFLAGS="${CFLAGS}" LDLIBS="${LDLIBS}" O="${BINDIR}" ${EXTRA_OEMAKE} $*
--- a/src/lib_sched.c
+++ b/src/lib_sched.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE
#include "bench.h"
/* #define _DEBUG */

View File

@@ -0,0 +1,34 @@
From ea683a0dbaa30a0bf101adb09a1a2531c7112c62 Mon Sep 17 00:00:00 2001
From: Mingli Yu <Mingli.Yu@windriver.com>
Date: Mon, 27 Aug 2018 11:02:45 +0800
Subject: [PATCH] src/Makefile: use libdir instead of hardcoded /lib
use libdir instead of hardcoded /lib
Upstream-Status: Inappropriate [configuration]
Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
---
src/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Makefile b/src/Makefile
index 4678d54..b73ddb6 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -141,10 +141,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 $(DESTDIR)$(libdir) ]; then mkdir $(DESTDIR)$(libdir); fi
cp $(EXES) $(BASE)/bin
cp $(INCS) $(BASE)/include
- cp $O/lmbench.a $(BASE)/lib/libmbench.a
+ cp $O/lmbench.a $(DESTDIR)$(libdir)/libmbench.a
cd ../doc; env MAKEFLAGS="$(MAKEFLAGS)" make CC="${CC}" OS="${OS}" BASE="$(BASE)" install
--
2.7.4

View File

@@ -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="$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:

View File

@@ -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));

View File

@@ -0,0 +1,22 @@
#!/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/
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"

View File

@@ -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>

View File

@@ -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

View File

@@ -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 ""

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,104 @@
SUMMARY = "Tools for performance analysis"
HOMEPAGE = "http://lmbench.sourceforge.net/"
SECTION = "console/utils"
LICENSE = "GPL-2.0-only & GPL-2.0-with-lmbench-restriction"
LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
file://COPYING-2;md5=8e9aee2ccc75d61d107e43794a25cdf9"
inherit autotools-brokensep update-alternatives
DEPENDS += "libtirpc"
CFLAGS += "-I${STAGING_INCDIR}/tirpc"
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://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://0002-build-Adjust-CFLAGS-LDFLAGS-to-append-values-passed-.patch \
file://0001-src-Makefile-use-libdir-instead-of-hardcoded-lib.patch \
file://0001-lmbench-Point-webpage-lm-to-target-directory.patch \
file://0001-doc-Fix-typos-in-manual-pages.patch \
file://0001-lat_fifo-Fix-cleanup-sequence.patch \
file://0001-doc-Fix-typos-in-lat_unix_connect-manual-page.patch \
file://0001-bench.h-Fix-typo-in-specifying-string.h.patch \
file://0001-scripts-build-Fix-the-tests-to-build-with-clang15.patch \
"
SRC_URI[md5sum] = "b3351a3294db66a72e2864a199d37cbf"
SRC_URI[sha256sum] = "cbd5777d15f44eab7666dcac418054c3c09df99826961a397d9acf43d8a2a551"
UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/lmbench/files/development/"
UPSTREAM_CHECK_REGEX = "lmbench-(?P<pver>\d+(\.\d+)+-[a-z]+\d+)"
export OS = "${TARGET_SYS}"
export TARGET = "${TARGET_OS}"
EXTRA_OEMAKE = 'CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" CFLAGS="${CFLAGS}" \
LDFLAGS="${LDFLAGS}" 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}
${S}/scripts/build
}
do_install () {
install -d ${D}${sysconfdir}/default/volatiles \
${D}${bindir} ${D}${mandir} \
${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}" \
DESTDIR="${D}" \
-C src install
mv ${D}${bindir}/line ${D}${bindir}/lm_line
install -m 0755 ${WORKDIR}/lmbench-run ${D}${bindir}/
install -m 0755 ${S}/bin/${TARGET_SYS}/cache ${D}${bindir}/
sed -i -e 's,^SHAREDIR=.*$,SHAREDIR=${datadir}/${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
install -m 0644 ${S}/src/webpage-lm.tar ${D}${datadir}/lmbench
}
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"
ALTERNATIVE:${PN} = "stream hello"
ALTERNATIVE_LINK_NAME[stream] = "${bindir}/stream"
ALTERNATIVE_LINK_NAME[hello] = "${bindir}/hello"