summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2016-03-28 23:25:10 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2016-03-28 23:35:26 +0800
commitc316dadbf874ea47a1beb98f4993bfa24957b308 (patch)
tree277aec4c48cc986361bdabf92a4230a174e36581
parentd5e54e3412872af72e2f9c0d41ea14e58b849b6e (diff)
downloadiozone3_434.tar.gz
support to build in Androidiozone3_434
Change-Id: I17a0a37bb8f5824732aa01868df3008fbed7c98d Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r--Android.mk52
-rw-r--r--src/current/iozone.c56
-rw-r--r--src/current/libasync.c2
-rw-r--r--src/current/libbif.c2
4 files changed, 105 insertions, 7 deletions
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..8e2b7c3
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,52 @@
+LOCAL_PATH := $(call my-dir)
+
+######################################################
+### iozone ###
+######################################################
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := \
+ src/current/libbif.c \
+ src/current/iozone.c \
+
+LOCAL_MODULE_TAGS := debug
+LOCAL_MODULE := iozone
+
+LOCAL_CFLAGS += -Wall \
+ -O3 \
+ -Dunix \
+ -Dlinux \
+ -DHAVE_ANSIC_C \
+ -DHAVE_PREAD \
+ -DNAME='"Android"' \
+ -DLINUX_ARM \
+
+# -DNO_THREADS \
+#LOCAL_MULTILIB := both
+#LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
+#LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
+
+include $(BUILD_EXECUTABLE)
+
+######################################################
+### fileop ###
+######################################################
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := \
+ src/current/fileop.c \
+
+LOCAL_MODULE_TAGS := debug
+LOCAL_MODULE := fileop
+LOCAL_CFLAGS += -Wall -O3 -Dunix -Dlinux
+include $(BUILD_EXECUTABLE)
+
+######################################################
+### pit_server ###
+######################################################
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := \
+ src/current/pit_server.c \
+
+LOCAL_MODULE_TAGS := debug
+LOCAL_MODULE := pit_server
+LOCAL_CFLAGS += -Wall -O3 -Dunix -Dlinux
+include $(BUILD_EXECUTABLE)
diff --git a/src/current/iozone.c b/src/current/iozone.c
index 65c51a3..ea45a6b 100644
--- a/src/current/iozone.c
+++ b/src/current/iozone.c
@@ -92,6 +92,10 @@ extern int h_errno; /* imported for errors */
#include <pthread.h>
#endif
+#if defined(ANDROID)
+#include <time.h>
+#endif
+
#if defined(HAVE_ANSIC_C) && defined(linux)
#include <stdlib.h>
#include <sys/wait.h>
@@ -360,6 +364,7 @@ typedef off_t off64_t;
#ifndef SCO_Unixware_gcc
#ifndef UWIN
#ifndef __DragonFly__
+#ifndef ANDROID
typedef long long off64_t;
#endif
#endif
@@ -369,6 +374,7 @@ typedef long long off64_t;
#endif
#endif
#endif
+#endif
#ifdef __AIX__
#include <fcntl.h>
@@ -980,8 +986,10 @@ static double cputime_so_far();
#endif
static void update_burst_sleep(int, long long, double *);
#ifndef NO_THREADS
+#ifndef ANDROID
static void count_burst(double* burst_acc_time_sec, long long stream_id);
#endif
+#endif
static double time_so_far1(); /* time since start of program */
void get_resolution();
void get_rusage_resolution();
@@ -1043,6 +1051,8 @@ size_t async_write_no_copy();
void end_async();
void async_init();
#else
+int async_read();
+int async_read_no_copy();
size_t async_write();
size_t async_write_no_copy();
void async_release();
@@ -1378,11 +1388,13 @@ off64_t burst_size_kb_64 = -1; /* the size of the burst (in KBytes)
long long burst_sleep_duration_msec = -1; /* the sleep duration between burst */
long long written_this_burst = 0; /* How much data was writen so far in this burst*/
#ifndef NO_THREADS
+#ifndef ANDROID
pthread_barrierattr_t barrier_attr;
pthread_barrier_t *barrier;
off64_t burst_size_per_child = 0;
long long burst_written_so_far[MAXSTREAMS] = {0}; /* How much data was written so far in this burst per stream (thread/process)*/
#endif
+#endif
char bif_filename [MAXNAMESIZE]; /* name of biff file */
char filename [MAXNAMESIZE]; /* name of temporary file */
@@ -3187,6 +3199,7 @@ char **argv;
}
#ifndef NO_THREADS
+#ifndef ANDROID
#if defined( _HPUX_SOURCE ) || defined ( linux )
if(ioz_processor_bind)
{
@@ -3205,6 +3218,7 @@ char **argv;
}
#endif
#endif
+#endif
orig_size=kilobytes64;
if(trflag){
(void)multi_throughput_test(mint,maxt);
@@ -3669,6 +3683,7 @@ throughput_test()
unit="kB";
#ifndef NO_THREADS
+#ifndef ANDROID
/*Init barriers*/
if(use_thread)
{
@@ -3686,6 +3701,7 @@ throughput_test()
if (burst_size_kb_64 != -1)
burst_size_per_child = burst_size_kb_64 * 1024 / num_child;
#endif
+#endif
if(!haveshm)
{
@@ -6952,9 +6968,11 @@ next10:
}
#ifndef NO_THREADS
+#ifndef ANDROID
/* Destroy the barrier */
pthread_barrier_destroy(barrier);
#endif
+#endif
/********************************************************/
/* End of cleanup */
@@ -8076,7 +8094,7 @@ long long *data2;
exit(48);
}
#else
- if((stream=(FILE *)I_FOPEN(filename,how)) == 0)
+ if((stream=I_FOPEN(filename,how)) == 0)
{
#ifdef NO_PRINT_LLD
printf("\nCan not fdopen temp file: %s %d\n",
@@ -8294,7 +8312,7 @@ long long *data1,*data2;
exit(51);
}
#else
- if((stream=(FILE *)I_FOPEN(filename,"r")) == 0)
+ if((stream=I_FOPEN(filename,"r")) == 0)
{
printf("\nCan not fdopen temp file: %s\n",
filename);
@@ -12597,6 +12615,7 @@ thread_write_test( x)
}
#endif
#ifndef NO_THREADS
+#ifndef ANDROID
#if defined(_HPUX_SOURCE) || defined(linux)
if(ioz_processor_bind)
{
@@ -12616,6 +12635,7 @@ thread_write_test( x)
}
#endif
#endif
+#endif
if(use_thread)
nbuff=barray[xx];
else
@@ -12971,8 +12991,10 @@ again:
wval=write(fd, nbuff, (size_t) reclen);
#ifndef NO_THREADS
+#ifndef ANDROID
count_burst(&burst_acc_time_sec, xx);
#endif
+#endif
#if defined(Windows)
}
@@ -13311,6 +13333,7 @@ thread_pwrite_test( x)
}
#endif
#ifndef NO_THREADS
+#ifndef ANDROID
#if defined( _HPUX_SOURCE ) || defined ( linux )
if(ioz_processor_bind)
{
@@ -13329,6 +13352,7 @@ thread_pwrite_test( x)
}
#endif
#endif
+#endif
if(use_thread)
nbuff=barray[xx];
else
@@ -13949,6 +13973,7 @@ thread_rwrite_test(x)
}
#endif
#ifndef NO_THREADS
+#ifndef ANDROID
#if defined( _HPUX_SOURCE ) || defined ( linux )
if(ioz_processor_bind)
{
@@ -13967,6 +13992,7 @@ thread_rwrite_test(x)
}
#endif
#endif
+#endif
if(use_thread)
nbuff=barray[xx];
else
@@ -14263,8 +14289,10 @@ fprintf(newstdout,"Chid: %lld Rewriting offset %lld for length of %lld\n",chid,
wval=write(fd, nbuff, (size_t) reclen);
#ifndef NO_THREADS
+#ifndef ANDROID
count_burst(&burst_acc_time_sec, xx);
#endif
+#endif
if(wval != reclen)
{
if(*stop_flag)
@@ -14547,6 +14575,7 @@ thread_read_test(x)
}
#endif
#ifndef NO_THREADS
+#ifndef ANDROID
#if defined( _HPUX_SOURCE ) || defined ( linux )
if(ioz_processor_bind)
{
@@ -14566,6 +14595,7 @@ thread_read_test(x)
}
#endif
#endif
+#endif
if(use_thread)
nbuff=barray[xx];
else
@@ -15663,6 +15693,7 @@ thread_rread_test(x)
}
#endif
#ifndef NO_THREADS
+#ifndef ANDROID
#if defined( _HPUX_SOURCE ) || defined ( linux )
if(ioz_processor_bind)
{
@@ -15682,6 +15713,7 @@ thread_rread_test(x)
}
#endif
#endif
+#endif
if(use_thread)
nbuff=barray[xx];
else
@@ -16231,6 +16263,7 @@ thread_reverse_read_test(x)
}
#endif
#ifndef NO_THREADS
+#ifndef ANDROID
#if defined( _HPUX_SOURCE ) || defined ( linux )
if(ioz_processor_bind)
{
@@ -16250,6 +16283,7 @@ thread_reverse_read_test(x)
}
#endif
#endif
+#endif
if(use_thread)
nbuff=barray[xx];
else
@@ -16767,6 +16801,7 @@ thread_stride_read_test(x)
}
#endif
#ifndef NO_THREADS
+#ifndef ANDROID
#if defined( _HPUX_SOURCE ) || defined ( linux )
if(ioz_processor_bind)
{
@@ -16786,6 +16821,7 @@ thread_stride_read_test(x)
}
#endif
#endif
+#endif
if(use_thread)
nbuff=barray[xx];
else
@@ -17438,6 +17474,7 @@ thread_ranread_test(x)
}
#endif
#ifndef NO_THREADS
+#ifndef ANDROID
#if defined( _HPUX_SOURCE ) || defined ( linux )
if(ioz_processor_bind)
{
@@ -17457,6 +17494,7 @@ thread_ranread_test(x)
}
#endif
#endif
+#endif
if(use_thread)
nbuff=barray[xx];
else
@@ -18072,6 +18110,7 @@ thread_ranwrite_test( x)
}
#endif
#ifndef NO_THREADS
+#ifndef ANDROID
#if defined( _HPUX_SOURCE ) || defined ( linux )
if(ioz_processor_bind)
{
@@ -18091,6 +18130,7 @@ thread_ranwrite_test( x)
}
#endif
#endif
+#endif
if(use_thread)
nbuff=barray[xx];
else
@@ -18400,8 +18440,10 @@ again:
wval = write(fd, nbuff, (size_t) reclen);
#ifndef NO_THREADS
+#ifndef ANDROID
count_burst(&burst_acc_time_sec, xx);
#endif
+#endif
if(wval != reclen)
{
@@ -23852,7 +23894,7 @@ char *where;
time_t t;
char *value;
t=time(0);
- value=(char *)ctime(&t);
+ value=ctime(&t);
strcpy(where,value);
}
@@ -24873,7 +24915,7 @@ void * thread_fwrite_test( x)
exit(48);
}
#else
- if((stream=(FILE *)I_FOPEN(filename,how)) == 0)
+ if((stream=I_FOPEN(filename,how)) == 0)
{
#ifdef NO_PRINT_LLD
printf("\nCan not fdopen temp file: %s %d\n",
@@ -25007,8 +25049,10 @@ void * thread_fwrite_test( x)
}
#ifndef NO_THREADS
+#ifndef ANDROID
count_burst(&burst_acc_time_sec, xx);
#endif
+#endif
if(hist_summary)
{
@@ -25326,7 +25370,7 @@ void * thread_fread_test( x)
exit(51);
}
#else
- if((stream=(FILE *)I_FOPEN(filename,"r")) == 0)
+ if((stream=I_FOPEN(filename,"r")) == 0)
{
printf("\nCan not fdopen temp file: %s\n",
filename);
@@ -25644,6 +25688,7 @@ static void update_burst_sleep(int fd, long long reclen, double *burst_sleep_tim
}
#ifndef NO_THREADS
+#ifndef ANDROID
static void count_burst(double* burst_acc_time_sec, long long stream_id)
{
double burst_start_time_sec;
@@ -25680,4 +25725,5 @@ static void count_burst(double* burst_acc_time_sec, long long stream_id)
}
}
#endif
+#endif
diff --git a/src/current/libasync.c b/src/current/libasync.c
index 663b9d0..81961c6 100644
--- a/src/current/libasync.c
+++ b/src/current/libasync.c
@@ -95,7 +95,7 @@
*/
#include <sys/types.h>
-#include <aio.h>
+//#include <aio.h>
#if defined(solaris) || defined(linux) || defined(SCO_Unixware_gcc) || defined(__NetBSD__)
#else
#include <sys/timers.h>
diff --git a/src/current/libbif.c b/src/current/libbif.c
index 0f40a36..3bfe134 100644
--- a/src/current/libbif.c
+++ b/src/current/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>