packages: add lmbench

git-svn-id: svn://svn.openwrt.org/openwrt/packages@30383 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2012-02-08 16:39:23 +00:00
parent e22bcee2e5
commit 21a174a30d
5 changed files with 186 additions and 0 deletions

124
utils/lmbench/Makefile Normal file
View File

@ -0,0 +1,124 @@
#
# Copyright (C) 2009-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=lmbench
PKG_VERSION:=3.0-a9
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=@SF/lmbench/
PKG_MD5SUM:=784b0873361cd5442e02b2544d42917b
PKG_CAT:=cat
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DEPENDS:=librpc
include $(INCLUDE_DIR)/package.mk
define Package/lmbench
SECTION:=utils
CATEGORY:=Utilities
TITLE:=lmbench microbenchmarks
URL:=http://sourceforge.net/projects/lmbench
MENU:=1
endef
define Package/lmbench/description
lmbench is a series of micro benchmarks intended to measure basic operating
system and hardware system metrics.
endef
define Package/lmbench/install
true
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR)/src \
CC="$(TARGET_CC)" \
AR="$(TARGET_CROSS)ar" \
OS="$(ARCH)" \
BASE="$(PKG_INSTALL_DIR)" \
LDLIBS="-lrpc" \
COMPILE="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)" \
lmbench install
endef
define PartGen
define Package/lmbench-$(subst _,-,$(1))
SECTION:=utils
CATEGORY:=Utilities
TITLE:=$(1) microbenchmark
URL:=http://sourceforge.net/projects/lmbench
DEPENDS:=lmbench +librpc
endef
endef
define PartInstall
define Package/lmbench-$(subst _,-,$(1))/install
$(INSTALL_DIR) $$(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/$(1) $$(1)/usr/sbin/$(1)
endef
endef
LMBENCH_FILES:= \
bw_file_rd \
bw_mem \
bw_mmap_rd \
bw_pipe \
bw_tcp \
bw_unix \
cache \
disk \
enough \
flushdisk \
hello \
lat_cmd \
lat_connect \
lat_ctx \
lat_dram_page \
lat_fcntl \
lat_fifo \
lat_fs \
lat_http \
lat_mem_rd \
lat_mmap \
lat_ops \
lat_pagefault \
lat_pipe \
lat_pmake \
lat_proc \
lat_rand \
lat_rpc \
lat_select \
lat_sem \
lat_sig \
lat_syscall \
lat_tcp \
lat_udp \
lat_unix \
lat_unix_connect \
lat_usleep \
line \
lmdd \
lmhttp \
loop_o \
memsize \
mhz \
msleep \
par_mem \
par_ops \
stream \
timing_o \
tlb
$(foreach file,$(LMBENCH_FILES),$(eval $(call PartGen,$(file))))
$(foreach file,$(LMBENCH_FILES),$(eval $(call PartInstall,$(file))))
$(eval $(call BuildPackage,lmbench))
$(foreach file,$(LMBENCH_FILES),$(eval $(call BuildPackage,lmbench-$(subst _,-,$(file)))))

View File

@ -0,0 +1,11 @@
--- 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(__socklen_t_defined))
typedef int socklen_t;
#endif

View File

@ -0,0 +1,10 @@
--- a/src/Makefile
+++ b/src/Makefile
@@ -144,6 +144,7 @@ install-target:
if [ ! -d $(BASE)/include ]; then mkdir $(BASE)/include; fi
if [ ! -d $(BASE)/lib ]; then mkdir $(BASE)/lib; fi
cp $(EXES) $(BASE)/bin
+ cp $(OPT_EXES) $(BASE)/bin
cp $(INCS) $(BASE)/include
cp $O/lmbench.a $(BASE)/lib/libmbench.a
cd ../doc; env MAKEFLAGS="$(MAKEFLAGS)" make CC="${CC}" OS="${OS}" BASE="$(BASE)" install

View File

@ -0,0 +1,30 @@
--- 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 -lrpc"}
# check for HP-UX's ANSI compiler
echo "main(int ac, char *av[]) { int i; }" > ${BASE}$$.c
--- a/src/Makefile
+++ b/src/Makefile
@@ -38,6 +38,7 @@ CC=`../scripts/compiler`
MAKE=`../scripts/make`
AR=ar
ARCREATE=cr
+LDLIBS=
# base of installation location
BASE=/usr/local
@@ -111,7 +112,7 @@ LIBOBJS= $O/lib_tcp.o $O/lib_udp.o $O/li
$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="$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" LDLIBS="$(LDLIBS)" ../scripts/build all
-@env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="k$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build opt
results: lmbench

View File

@ -0,0 +1,11 @@
--- a/src/bw_mem.c
+++ b/src/bw_mem.c
@@ -65,7 +65,7 @@ main(int ac, char **av)
size_t nbytes;
state_t state;
int c;
- char *usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] <size> what [conflict]\nwhat: rd wr rdwr cp fwr frd fcp bzero bcopy\n<size> must be larger than 512";
+ char *usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] <size> what [conflict]\nwhat: rd wr rdwr cp fwr frd fcp bzero bcopy\n<size> must be larger than 512\n";
state.overhead = 0;