1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-22 00:19:20 +02:00

new package: bonnie: useful tool to determine the speed of your filesystem

This commit is contained in:
Xiangfu Liu 2011-11-03 10:33:37 +08:00
parent e0051768c5
commit 114eb6b5bc
2 changed files with 85 additions and 0 deletions

52
bonnie/Makefile Normal file
View File

@ -0,0 +1,52 @@
#
# Copyright (C) Xiangfu Liu <xiangfu@sharism.cc>
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=bonnie
PKG_VERSION:=1.4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://www.garloff.de/kurt/linux/bonnie/
PKG_RELEASE:=1
PKG_INSTALL:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/bonnie
TITLE:=Bonnie
SECTION:=utils
CATEGORY:=Utilities
URL:=http://www.garloff.de/kurt/linux/bonnie/
endef
define Package/bonnie/description
Bonnie is a simple but useful tool to determine the speed of your filesystem,
your OS caching, the underlying device and your libc
endef
define Build/Configure
$(call Build/Configure/Default)
endef
define Build/Compile
$(call Build/Compile/Default)
endef
define Build/Install
endef
define Package/bonnie/install
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/Bonnie $(1)/usr/bin/$(PKG_NAME)
endef
$(eval $(call BuildPackage,bonnie))
# The following comments configure the Bonnie editor. Just ignore them.
# Local Variables:
# compile-command: "make -C ~/openwrt-xburst.full_system package/bonnie/{clean,compile} V=99"
# End:

View File

@ -0,0 +1,33 @@
diff --git a/Bonnie.c b/Bonnie.c
index 909ca4a..b3a782a 100644
--- a/Bonnie.c
+++ b/Bonnie.c
@@ -77,11 +77,6 @@
#include <sys/wait.h>
#include <stdlib.h>
-#ifdef __linux__
-/* for o_direct */
-#include <asm/page.h>
-#endif
-
#ifdef unix
#include <signal.h>
#endif
@@ -197,13 +192,13 @@ int main(
int volcnt;
register off_t words;
- __buf = malloc(Chunk + ~PAGE_MASK);
+ __buf = malloc(Chunk + ~(sysconf(_SC_PAGE_SIZE)-1));
if (!__buf)
{
- fprintf(stderr, "unable to malloc %d bytes\n", Chunk + ~PAGE_MASK);
+ fprintf(stderr, "unable to malloc %d bytes\n", Chunk + ~(sysconf(_SC_PAGE_SIZE)-1));
exit(1) ;
}
- buf = (int *)((unsigned long)(__buf + ~PAGE_MASK) & PAGE_MASK);
+ buf = (int *)((unsigned long)(__buf + ~(sysconf(_SC_PAGE_SIZE)-1)) & sysconf(_SC_PAGE_SIZE)-1);
basetime = (int) time((time_t *) NULL);
size = 100;