Porting filesystem benchmarking tool iozone on android

转载请注明来源, please acknowledge to the origin post when repost: http://blog.csdn.net/zhangjing_tju

iozone

iozone is a filesystem benchmark tool. The benchmark generates and measures a variety of file operations. Iozone has been ported to many machines and runs under many operating systems.

Benchmark Features:

  • ANSII C source
  • POSIX async I/O
  • Mmap() file I/O
  • Normal file I/O
  • Single stream measurement
  • Multiple stream measurement
  • Distributed fileserver measurements (Cluster)
  • POSIX pthreads
  • Multi-process measurement
  • Excel importable output for graph generation
  • Latency plots
  • 64bit compatible source
  • Large file compatible
  • Stonewalling in throughput tests to eliminate straggler effects
  • Processor cache size configurable
  • Selectable measurements with fsync, OSYNC
  • Builds for: AIX, BSDI, HP-UX, IRIX, FreeBSD, Linux, OpenBSD, NetBSD, OSFV3, OSFV4, OSFV5, SCO OpenServer, Solaris, MAC OS X, Windows (95/98/Me/NT/2K/XP)

android patch to iozone

diff --git a/src/jni/Android.mk b/src/jni/Android.mk
new file mode 100644
index 0000000..250669a
--- /dev/null
+++ b/src/jni/Android.mk
@@ -0,0 +1,18 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := iozone
+
+LOCAL_SRC_FILES := iozone.c libbif.c
+
+LOCAL_CFLAGS := -c -O3 -Dunix -DHAVE_ANSIC_C -DHAVE_PREAD \
+               -DNAME='"linux-arm"' -DLINUX_ARM  \
+               -Dlinux -Dandroid
+#-D_LARGEFILE64_SOURCE  -DASYNC_IO
+
+#LOCAL_LDLIBS := -lrt -lpthread
+LOCAL_SHARED_LIBRARIES := rt pthread
+
+include $(BUILD_EXECUTABLE)
+
diff --git a/src/jni/Application.mk b/src/jni/Application.mk
new file mode 100644
index 0000000..ed6e6d1
--- /dev/null
+++ b/src/jni/Application.mk
@@ -0,0 +1,2 @@
+APP_ABI := armeabi-v7a #armeabi
+APP_PLATFORM := android-21
diff --git a/src/jni/iozone.c b/src/jni/iozone.c
index 1bbf206..0958e90 100644
--- a/src/jni/iozone.c
+++ b/src/jni/iozone.c
@@ -308,6 +308,18 @@ THISVERSION,
 #endif
 #endif

+#if defined(android)
+#ifndef O_RSYNC
+#define O_RSYNC O_SYNC
+#endif
+
+__attribute__((weak)) int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize,
+                                  const cpu_set_t *cpuset)
+{
+  return sched_setaffinity(pthread_gettid_np(thread), cpusetsize, cpuset);
+}
+#endif
+
 #if ((defined(solaris) && defined(__LP64__)) || defined(__s390x__))
 /* If we are building for 64-bit Solaris, all functions that return pointers
  * must be declared before they are used; otherwise the compiler will assume
diff --git a/src/jni/libbif.c b/src/jni/libbif.c
index 890e226..a78f80b 100644
--- a/src/jni/libbif.c
+++ b/src/jni/libbif.c
@@ -17,7 +17,7 @@
 #include <sys/types.h>
 #include <stdio.h>
 #include <sys/file.h>
-#if defined(__AIX__) || defined(__FreeBSD__) || defined(__DragonFly__)
+#if defined(__AIX__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(android)
 #include <fcntl.h>
 #else
 #include <sys/fcntl.h>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值