From 21a174a30da1718ae55136ec5b5db8c06c4d1c52 Mon Sep 17 00:00:00 2001 From: juhosg Date: Wed, 8 Feb 2012 16:39:23 +0000 Subject: [PATCH] packages: add lmbench git-svn-id: svn://svn.openwrt.org/openwrt/packages@30383 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- utils/lmbench/Makefile | 124 ++++++++++++++++++ .../patches/001-fix_socklen_t_define.patch | 11 ++ utils/lmbench/patches/002-install-cache.patch | 10 ++ utils/lmbench/patches/003-add-LDLIBS.patch | 30 +++++ .../100-bw_mem-add-newline-after-usage.patch | 11 ++ 5 files changed, 186 insertions(+) create mode 100644 utils/lmbench/Makefile create mode 100644 utils/lmbench/patches/001-fix_socklen_t_define.patch create mode 100644 utils/lmbench/patches/002-install-cache.patch create mode 100644 utils/lmbench/patches/003-add-LDLIBS.patch create mode 100644 utils/lmbench/patches/100-bw_mem-add-newline-after-usage.patch diff --git a/utils/lmbench/Makefile b/utils/lmbench/Makefile new file mode 100644 index 000000000..f124c92e0 --- /dev/null +++ b/utils/lmbench/Makefile @@ -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))))) diff --git a/utils/lmbench/patches/001-fix_socklen_t_define.patch b/utils/lmbench/patches/001-fix_socklen_t_define.patch new file mode 100644 index 000000000..967e207cc --- /dev/null +++ b/utils/lmbench/patches/001-fix_socklen_t_define.patch @@ -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 + diff --git a/utils/lmbench/patches/002-install-cache.patch b/utils/lmbench/patches/002-install-cache.patch new file mode 100644 index 000000000..89543b83f --- /dev/null +++ b/utils/lmbench/patches/002-install-cache.patch @@ -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 diff --git a/utils/lmbench/patches/003-add-LDLIBS.patch b/utils/lmbench/patches/003-add-LDLIBS.patch new file mode 100644 index 000000000..66a7243ae --- /dev/null +++ b/utils/lmbench/patches/003-add-LDLIBS.patch @@ -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 diff --git a/utils/lmbench/patches/100-bw_mem-add-newline-after-usage.patch b/utils/lmbench/patches/100-bw_mem-add-newline-after-usage.patch new file mode 100644 index 000000000..d03ad4a9f --- /dev/null +++ b/utils/lmbench/patches/100-bw_mem-add-newline-after-usage.patch @@ -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 ] [-W ] [-N ] what [conflict]\nwhat: rd wr rdwr cp fwr frd fcp bzero bcopy\n must be larger than 512"; ++ char *usage = "[-P ] [-W ] [-N ] what [conflict]\nwhat: rd wr rdwr cp fwr frd fcp bzero bcopy\n must be larger than 512\n"; + + state.overhead = 0; +