PAPI  5.0.1.0
iozone.c File Reference
Include dependency graph for iozone.c:

Go to the source code of this file.

Data Structures

struct  child_stats
struct  runtime
struct  client_command
struct  client_neutral_command
struct  master_command
struct  master_neutral_command
struct  size_entry
struct  child_ident

Defines

#define THISVERSION   " Version $Revision$"
#define MODE   "\tCompiled for 32 bit mode."
#define MAP_FAILED   -1
#define VOLATILE
#define DEDUPSEED   0x2719362
#define R_CHILD_JOIN   1
#define R_STAT_DATA   2
#define R_FLAG_DATA   3
#define R_JOIN_ACK   4
#define R_STOP_FLAG   5
#define R_TERMINATE   6
#define R_DEATH   7
#define CACHE_LINE_SIZE   32
#define CACHE_SIZE   ( 1024 * 1024 )
#define MEG   (1024 * 1024)
#define STRIDE   17
#define IBUFSIZE   100
#define DISRUPT   100
#define LARGE_REC   65536
#define KILOBYTES   512
#define RECLEN   1024
#define FILESIZE   (KILOBYTES*1024)
#define NUMRECS   FILESIZE/RECLEN
#define CROSSOVER   (16*1024)
#define MAXBUFFERSIZE   (16*1024*1024)
#define MAXSTREAMS   256
#define MINBUFFERSIZE   128
#define TOOFAST   10
#define MAXTESTS   12
#define PATTERN   get_pattern();
#define PATTERN1   0xBB
#define MAX_X   100
#define MAX_Y   512
#define USAGE   "\tUsage: For usage information type iozone -h \n\n"
#define MAXNAMESIZE   1000
#define CONTROL_STRING1   "%16lld%8ld%8ld%8ld%8ld%8ld%8ld%8ld %8ld %8ld%8ld%8ld%8ld%9ld%9ld\n"
#define CONTROL_STRING2   "%16s%8s%8s%8s%8s%10s%8s%8s%8s %8s %8s%9s%9s%8s%9s\n"
#define CONTROL_STRING3   "%16s%8s%8s%8s%8s%10s%8s%8s%8s %8s %8s%9s%9s%8s%9s\n"
#define CONTROL_STRING4   "%16s%8s%8s%8s%8s%10s\n"
#define KILOBYTES_START   64
#define KILOBYTES_END   (1024*512)
#define RECLEN_START   4096
#define RECLEN_END   (MAXBUFFERSIZE)
#define MULTIPLIER   2
#define WRITER_TEST   0
#define READER_TEST   1
#define RANDOM_RW_TEST   2
#define REVERSE_TEST   3
#define REWRITE_REC_TEST   4
#define STRIDE_READ_TEST   5
#define FWRITER_TEST   6
#define FREADER_TEST   7
#define RANDOM_MIX_TEST   8
#define WRITER_MASK   (1 << WRITER_TEST)
#define READER_MASK   (1 << READER_TEST)
#define RANDOM_RW_MASK   (1 << RANDOM_RW_TEST)
#define RANDOM_MIX_MASK   (1 << RANDOM_MIX_TEST)
#define REVERSE_MASK   (1 << REVERSE_TEST)
#define REWRITE_REC_MASK   (1 << REWRITE_REC_TEST)
#define STRIDE_READ_MASK   (1 << STRIDE_READ_TEST)
#define FWRITER_MASK   (1 << FWRITER_TEST)
#define FREADER_MASK   (1 << FREADER_TEST)
#define CHILD_STATE_HOLD   0
#define CHILD_STATE_READY   1
#define CHILD_STATE_BEGIN   2
#define CHILD_STATE_DONE   3
#define MERSENNE
#define cputime_so_far()   time_so_far()
#define I_LSEEK(x, y, z)   lseek(x,(off_t)(y),z)
#define I_OPEN(x, y, z)   open(x,(int)(y),(int)(z))
#define I_CREAT(x, y)   creat(x,(int)(y))
#define I_FOPEN(x, y)   fopen(x,y)
#define I_STAT(x, y)   stat(x,y)
#define I_MMAP(a, b, c, d, e, f)   mmap((void *)(a),(size_t)(b),(int)(c),(int)(d),(int)(e),(off_t)(f))
#define SHMSIZE   ((( sizeof(struct child_stats) * MAXSTREAMS) )+4096 )
#define HOST_LIST_PORT   20000
#define HOST_ESEND_PORT   (HOST_LIST_PORT+MAXSTREAMS)
#define HOST_ASEND_PORT   (HOST_ESEND_PORT+MAXSTREAMS)
#define CHILD_ESEND_PORT   (HOST_ASEND_PORT+MAXSTREAMS)
#define CHILD_LIST_PORT   (CHILD_ESEND_PORT+MAXSTREAMS)
#define CHILD_ALIST_PORT   (CHILD_LIST_PORT+MAXSTREAMS)
#define SP_CHILD_LISTEN_PORT   31000
#define SP_CHILD_ESEND_PORT   (SP_CHILD_LISTEN_PORT+10)
#define SP_MASTER_LISTEN_PORT   (SP_CHILD_ESEND_PORT+10)
#define SP_MASTER_ESEND_PORT   (SP_MASTER_LISTEN_PORT+10)
#define SP_MASTER_RESULTS_PORT   (SP_MASTER_ESEND_PORT+10)
#define THREAD_WRITE_TEST   1
#define THREAD_REWRITE_TEST   2
#define THREAD_READ_TEST   3
#define THREAD_REREAD_TEST   4
#define THREAD_STRIDE_TEST   5
#define THREAD_RANDOM_READ_TEST   6
#define THREAD_RANDOM_WRITE_TEST   7
#define THREAD_REVERSE_READ_TEST   8
#define THREAD_RANDOM_MIX_TEST   9
#define THREAD_PWRITE_TEST   10
#define THREAD_PREAD_TEST   11
#define THREAD_FWRITE_TEST   12
#define THREAD_FREAD_TEST   13
#define THREAD_CLEANUP_TEST   14
#define C_STATE_ZERO   1
#define C_STATE_WAIT_WHO   2
#define C_STATE_WAIT_BARRIER   3
#define NN   312
#define MM   156
#define MATRIX_A   0xB5026F5AA96619E9ULL
#define UM   0xFFFFFFFF80000000ULL /* Most significant 33 bits */
#define LM   0x7FFFFFFFULL /* Least significant 31 bits */
#define DFLT_SERVICE   "PIT" /* Default service name. */
#define INVALID_DESC   -1 /* Invalid file (socket) descriptor. */
#define MAXBFRSIZE   256 /* Max bfr sz to read remote TOD. */
#define BUCKETS   40

Typedefs

typedef long long off64_t
typedef struct sockaddr_in sockaddr_in_t
typedef struct sockaddr_in6 sockaddr_in6_t

Enumerations

enum  boolean { false = 0, true }

Functions

int atoi ()
int close ()
int unlink ()
int main ()
void record_command_line ()
int wait ()
int fsync ()
void srand48 ()
long lrand48 ()
void create_list ()
void Poll ()
void print_header ()
void Kill ()
long long l_min ()
long long l_max ()
long long mythread_create ()
int gen_new_buf ()
void touch_dedup ()
void init_by_array64 (unsigned long long *, unsigned long long)
unsigned long long genrand64_int64 (void)
char * initfile ()
int pit_gettimeofday ()
static int openSckt (const char *, const char *, unsigned int)
static void pit (int, struct timeval *)
void mmap_end ()
void alloc_pbuf ()
void auto_test ()
void show_help ()
static double time_so_far ()
static double time_so_far1 ()
void get_resolution ()
void get_rusage_resolution ()
void signal_handler ()
void begin ()
void fetchit ()
void purgeit ()
void throughput_test ()
void multi_throughput_test ()
void prepage ()
void get_date ()
int get_pattern ()
float do_compute ()
void write_perf_test ()
void fwrite_perf_test ()
void fread_perf_test ()
void read_perf_test ()
void mix_perf_test ()
void random_perf_test ()
void reverse_perf_test ()
void rewriterec_perf_test ()
void read_stride_perf_test ()
void store_dvalue ()
void dump_excel ()
void dump_throughput ()
int sp_start_child_send ()
int sp_start_master_listen ()
void do_speed_check ()
char * getenv ()
char * inet_ntoa ()
int system ()
void my_nap ()
void my_unap ()
int thread_exit ()
void close_xls ()
void do_label ()
int create_xls ()
void do_float ()
int mylockf ()
int mylockr ()
int rand ()
void srand ()
int get_client_info ()
void exit ()
void find_remote_shell ()
void traj_vers ()
void r_traj_size ()
long long w_traj_size ()
FILE * open_w_traj ()
FILE * open_r_traj ()
void create_temp ()
void fill_buffer ()
char * alloc_mem ()
void *() thread_rwrite_test ()
void *() thread_write_test ()
void *() thread_fwrite_test ()
void *() thread_fread_test ()
void *() thread_read_test ()
void *() thread_cleanup_test ()
void *() thread_ranread_test ()
void *() thread_mix_test ()
void *() thread_ranwrite_test ()
void *() thread_rread_test ()
void *() thread_reverse_read_test ()
void *() thread_stride_read_test ()
void *() thread_set_base ()
void *() thread_join ()
void disrupt ()
long long get_traj ()
void init_file_sizes ()
off64_t get_next_file_size ()
void add_file_size ()
void init_record_sizes ()
off64_t get_next_record_size ()
void add_record_size ()
void dump_cputimes ()
static double cpu_util ()
void del_record_sizes ()
void hist_insert ()
void dump_hist ()
void child_send ()
int start_child_listen ()
int start_child_listen_async ()
void start_child_listen_loop ()
void child_listen ()
void child_listen_async ()
void stop_child_send ()
void stop_child_listen ()
void cleanup_comm ()
void master_send ()
int start_master_send ()
int start_master_listen ()
int check_filename ()
void master_listen ()
void stop_master_send ()
void stop_master_listen ()
long long start_child_proc ()
int parse_client_line ()
void wait_dist_join ()
void tell_children_begin ()
void start_master_listen_loop ()
void wait_for_master_go ()
void tell_master_ready ()
void stop_master_listen_loop ()
void tell_master_stats ()
void become_client ()
int pick_client ()
void child_remove_files ()
void terminate_child_async ()
void distribute_stop ()
void send_stop ()
void cleanup_children ()
int main (int argc, char **argv)
void record_command_line (int argc, char **argv)
void begin (off64_t kilos64, long long reclength)
void fetchit (char *buffer, long long length)
long long verify_buffer (char *buffer, long long length, off64_t recnum, long long recsize, unsigned long long patt, char sverify)
void fill_buffer (char *buffer, long long length, long long pattern, char sverify, long long recnum)
void purgeit (char *buffer, long long reclen)
void prepage (char *buffer, long long reclen)
void write_perf_test (off64_t kilo64, long long reclen, long long *data1, long long *data2)
void fwrite_perf_test (off64_t kilo64, long long reclen, long long *data1, long long *data2)
void fread_perf_test (off64_t kilo64, long long reclen, long long *data1, long long *data2)
void read_perf_test (off64_t kilo64, long long reclen, long long *data1, long long *data2)
void random_perf_test (off64_t kilo64, long long reclen, long long *data1, long long *data2)
void reverse_perf_test (off64_t kilo64, long long reclen, long long *data1, long long *data2)
void rewriterec_perf_test (off64_t kilo64, long long reclen, long long *data1, long long *data2)
void read_stride_perf_test (off64_t kilos64, long long reclen, long long *data1, long long *data2)
 store_value (off64_t value)
 store_times (double walltime, double cputime)
 dump_report (long long who)
 dump_times (long long who)
char * alloc_mem (long long size, int shared_flag)
void Poll (longlong time1)
long long l_max (long long one, long long two)
void Kill (long long pid, long long sig)
long long l_min (long long num1, long long num2)
void multi_throughput_test (long long mint, long long maxt)
 purge_buffer_cache ()
void * thread_write_test (x)
void * thread_rwrite_test (x)
void * thread_read_test (x)
void * thread_rread_test (x)
void * thread_reverse_read_test (x)
void * thread_stride_read_test (x)
void * thread_mix_test (x)
void * thread_ranread_test (x)
void * thread_ranwrite_test (x)
void * thread_cleanup_test (x)
long long mythread_create (void *(*func)(void *), void *x)
pthread_t mythread_self ()
void * thread_join (long long tid, void *status)
void dump_throughput_cpu ()
void store_dvalue (double value)
char * initfile (int fd, off64_t filebytes, int flag, int prot)
void mmap_end (char *buffer, long long size)
 fill_area (long long *src_buffer, long long *dest_buffer, long long length)
int async_read ()
size_t async_write_no_copy ()
size_t async_write ()
void async_init ()
int async_read_no_copy ()
void async_release ()
void my_nap (int ntime)
void my_unap (unsigned long long microsecs)
static double cpu_util (double cputime, double walltime)
int mylockf (int fd, int op, int rdwr)
int mylockr (int fd, int op, int rdwr, off64_t offset, off64_t size)
float do_compute (float comp_delay)
void disrupt (int fd)
long long get_traj (FILE *traj_fd, long long *traj_size, float *delay, long which)
void init_file_sizes (off64_t min_f_size, off64_t max_f_size)
void add_file_size (off64_t size)
off64_t get_next_file_size (off64_t size)
void init_record_sizes (off64_t min_r_size, off64_t max_r_size)
void add_record_size (off64_t size)
off64_t get_next_record_size (off64_t size)
void master_listen (int sock, int size_of_message)
void child_send (char *controlling_host_name, struct master_command *send_buffer, int send_size)
void master_send (int child_socket_val, char *host_name, struct client_command *send_buffer, int send_size)
void stop_child_listen (int child_socket_val)
void O_stop_child_send (int child_socket_val)
void stop_master_listen (int master_socket_val)
void stop_master_send (int child_socket_val)
int start_child_listen (int size_of_message)
int child_attach (int s, int flag)
void child_listen (int sock, int size_of_message)
int start_child_listen_async (int size_of_message)
void child_listen_async (int sock, int size_of_message)
int start_master_send (char *child_host_name, int child_port, struct in_addr *my_s_addr)
int start_master_send_async (char *child_host_name, int child_port, struct in_addr my_s_addr)
long long start_child_proc (int testnum, long long numrecs64, long long reclen)
int pick_client (int testnum, long long numrecs64, long long reclen)
void tell_master_stats (int testnum, long long chid, double throughput, double actual, float cpu_time, double wall_time, char stop_flag, long long child_flag)
void tell_master_ready (long long chid)
void wait_for_master_go (long long chid)
void start_master_listen_loop (int num)
void tell_children_begin (long long childnum)
int parse_client_line (char *buffer, int line_num)
void child_remove_files (int i)
void find_remote_shell (char *shell)
void find_external_mon (char *imon_start, char *imon_stop)
void mix_perf_test (off64_t kilo64, long long reclen, long long *data1, long long *data2)
void sp_send_result (int, int, float)
void sp_get_result (int, int)
void sp_do_child_t (void)
void sp_do_master_t (void)
void speed_main (char *, char *, long long, long long, int)
int sp_start_master_send (char *sp_child_host_name, int sp_child_listen_port, struct in_addr *sp_my_ms_addr)
int sp_start_child_listen (int listen_port, int size_of_message)
int sp_start_master_listen (int sp_master_listen_port, int sp_size_of_message)
int sp_start_child_send (char *sp_master_host_name, int sp_master_listen_port, struct in_addr *sp_my_cs_addr)
void do_speed_check (int client_flag)
 get_date (char *where)
 check_filename (char *name)
 start_monitor (char *test)
 stop_monitor (char *test)
int gen_new_buf (char *ibuf, char *obuf, long seed, int size, int percent, int percent_interior, int percent_compress, int all)
void touch_dedup (char *i, int size)
void init_genrand64 (unsigned long long seed)
void init_by_array64 (unsigned long long init_key[], unsigned long long key_length)
long long genrand64_int63 (void)
double genrand64_real1 (void)
double genrand64_real2 (void)
double genrand64_real3 (void)
int pit_gettimeofday (struct timeval *tp, struct timezone *foo, char *pit_hostname, char *pit_service)
void hist_insert (double my_value)
void dump_hist (char *what, int id)
void * thread_fwrite_test (x)
void * thread_fread_test (x)

Variables

int errno
int h_errno
char * help []
char * head1 []
long long page_size = 4096
struct child_statschild_stat
void(* func [])()
char * test_output []
long long test_soutput [] = {2,2,2,1,1,1,2,2,2,2,2,2,2,2}
struct child_statsshmaddr
double totaltime
double total_time
double temp_time
double total_kilos
off64_t report_array [100][512]
double report_darray [100][256]
double time_res
double cputime_res
long long throughput_array [100]
short current_x
short current_y
long long orig_size
long long max_x
long long max_y
unsigned long long goodkilos
off64_t kilobytes64 = (off64_t) 512
long long goodrecl
off64_t offset = 0
off64_t offset64 = 0
off64_t filebytes64
off64_t r_range [100]
off64_t s_range [100]
int t_range [100]
int t_count = 0
int r_count
int s_count
char * barray [256]
char * haveshm
int optind
long long onetime
long long auto_mode
long long sfd
long long multi_buffer
int fd
int sp_msfd
int sp_mrfd
int sp_csfd
int sp_crfd
int begin_proc
int num_processors
int ioz_processor_bind
long long res_prob
long long rec_prob
char silent
char read_sync
char master_iozone
char client_iozone
char distributed
int bif_fd
int bif_row
int bif_column
int dedup_mseed = 1
int hist_summary
int op_rate
int op_rate_flag
char aflag
char Eflag
char hflag
char Rflag
char rflag
char sflag
char diag_v
char sent_stop
char dedup
char dedup_interior
char dedup_compress
char * dedup_ibuf
char * dedup_temp
char bif_flag
int rlocking
int share_file
int ecount
char gflag
char nflag
char yflag
char qflag
char * build_name = NAME
char imon_start [256]
char imon_stop [256]
char imon_sync
char trflag
char cpuutilflag
char seq_mix
long base_time
long long mint
long long maxt
long long w_traj_ops
long long r_traj_ops
long long w_traj_fsize
long long r_traj_fsize
long long r_traj_ops_completed
long long r_traj_bytes_completed
long long w_traj_ops_completed
long long w_traj_bytes_completed
int w_traj_items
int r_traj_items
char fflag
char Uflag
char uflag
char lflag
char include_tflag
struct runtime runtimes [100][512]
long long include_test [50]
long long include_mask
char RWONLYflag
char NOCROSSflag
char mfflag
long long status
long long x
long long y
long long childids [256+1]
long long myid
long long num_child
int pct_read
int speed_code
pthread_t p_childids [256+1]
off64_t next64
char wol_opened
char rol_opened
FILE * wqfd
FILE * rwqfd
FILE * rqfd
FILE * rrqfd
char * optarg
long long ret
struct size_entrysize_list = 0
struct size_entryrec_size_list = 0
off64_t maximum_file_size
off64_t minimum_file_size
char bif_filename [1000]
char filename [1000]
char mountname [1000]
char dummyfile [256][1000]
char dummyfile1 [1000]
char * filearray [256]
char tfile [] = "iozone"
char * buffer
char * buffer1
char * mbuffer
char * mainbuffer
FILE * pi
FILE * r_traj_fd
FILE * w_traj_fd
char * pbuffer
char * default_filename = "iozone.tmp"
char stoptime
char Cflag
char use_thread = 0
long long debug1 = 0
long long debug = 0
unsigned long cache_size = ( 1024 * 1024 )
unsigned long cache_line_size = 32
long long * pstatus
off64_t min_file_size = 64
off64_t max_file_size = (1024*512)
long long min_rec_size = 4096
long long max_rec_size = ( (16*1024*1024) )
long long orig_min_rec_size = 4096
long long orig_max_rec_size = ( (16*1024*1024) )
long long xover = (16*1024)
char * throughput_tests []
char command_line [1024] = "\0"
int argcsave
char ** argvsave
char splash [80][80]
int splash_line
char client_filename [256]
char remote_shell [256]
int client_error
char pit_hostname [40]
char pit_service [8]
int junk
int controlling_host_port = 20000
int c_port
int a_port
int child_port
int child_async_port
int client_listen_pid
int master_join_count
int l_sock
int l_async_sock
char master_rcv_buf [4096]
int master_listen_pid
char master_send_buf [4096]
char child_rcv_buf [4096]
char child_async_rcv_buf [4096]
char child_send_buf [4096]
int child_send_socket
int child_listen_socket
int child_listen_socket_async
int master_send_socket
int master_send_sockets [256]
int master_send_async_sockets [256]
int master_listen_port
int master_listen_socket
int clients_found
FILE * newstdin
FILE * newstdout
FILE * newstderr
char toutput [20][20]
int toutputindex
int cdebug = 0
int mdebug = 0
int aggflag
struct sockaddr_in child_sync_sock child_async_sock
int proto_version = 25
char controlling_host_name [100]
struct child_ident child_idents [256]
int Kplus_readers
char write_traj_filename [1000]
char read_traj_filename [1000]
char oflag
char jflag
char k_flag
char h_flag
char mflag
char pflag
char unbuffered
char Kplus_flag
char noretest
char notruncate
char async_flag
char stride_flag
char mmapflag
char mmapasflag
char mmapssflag
char mmapnsflag
char mmap_mix
char verify = 1
int restf
char sverify = 1
char odsync = 0
char Q_flag
char OPS_flag
char L_flag = 0
char no_copy_flag
char include_close
char include_flush
char disrupt_flag
char compute_flag
char xflag
char Z_flag
char X_flag
int no_unlink = 0
int no_write = 0
int r_traj_flag
int w_traj_flag
int mygen
char MS_flag
int advise_op
int advise_flag
int direct_flag
int current_client_number
long long chid
int file_lock
unsigned int pattern
long long stride = 17
long long delay
long long purge
long long fetchon
off64_t numrecs64 = (off64_t) ( 512 *1024) / 1024
long long reclen = 1024
long long delay_start
long long depth
char * stop_flag
float compute_time
int multiplier = 2
long long rest_val
int nap_once
double nap_res
struct sockaddr_in listener_sync_sock
char * sp_dest
int sp_child_listen_port = 31000
int sp_child_esend_port = ( 31000 +10)
int sp_master_listen_port = ( ( 31000 +10) +10)
int sp_master_esend_port = ( ( ( 31000 +10) +10) +10)
int sp_master_results_port = ( ( ( ( 31000 +10) +10) +10) +10)
struct in_addr sp_my_cs_addr
struct in_addr sp_my_ms_addr
struct sockaddr_in
sp_child_sync_sock 
sp_child_async_sock
struct sockaddr_in
sp_master_sync_sock 
sp_master_async_sock
char * sp_buf
char sp_command [1024]
char sp_remote_shell [100]
int sp_child_mode
int sp_count
int sp_msize
int sp_once
int sp_tcount
double sp_start_time
double sp_finish_time
int sp_cret
char sp_remote_host [256]
char sp_master_host [256]
char sp_location [256]
static unsigned long long mt [312]
static int mti = 312 +1
long long buckets [40]
long long bucket_val [40]

Define Documentation

#define BUCKETS   40

Definition at line 24211 of file iozone.c.

#define C_STATE_WAIT_BARRIER   3

Definition at line 1451 of file iozone.c.

#define C_STATE_WAIT_WHO   2

Definition at line 1450 of file iozone.c.

#define C_STATE_ZERO   1

Definition at line 1449 of file iozone.c.

#define CACHE_LINE_SIZE   32

Definition at line 750 of file iozone.c.

#define CACHE_SIZE   ( 1024 * 1024 )

Definition at line 751 of file iozone.c.

Definition at line 1419 of file iozone.c.

Definition at line 1415 of file iozone.c.

Definition at line 1416 of file iozone.c.

#define CHILD_STATE_BEGIN   2

Definition at line 946 of file iozone.c.

#define CHILD_STATE_DONE   3

Definition at line 948 of file iozone.c.

#define CHILD_STATE_HOLD   0

Definition at line 942 of file iozone.c.

#define CHILD_STATE_READY   1

Definition at line 944 of file iozone.c.

#define CONTROL_STRING1   "%16lld%8ld%8ld%8ld%8ld%8ld%8ld%8ld %8ld %8ld%8ld%8ld%8ld%9ld%9ld\n"

Definition at line 876 of file iozone.c.

#define CONTROL_STRING2   "%16s%8s%8s%8s%8s%10s%8s%8s%8s %8s %8s%9s%9s%8s%9s\n"

Definition at line 877 of file iozone.c.

#define CONTROL_STRING3   "%16s%8s%8s%8s%8s%10s%8s%8s%8s %8s %8s%9s%9s%8s%9s\n"

Definition at line 878 of file iozone.c.

#define CONTROL_STRING4   "%16s%8s%8s%8s%8s%10s\n"

Definition at line 879 of file iozone.c.

#define cputime_so_far ( )    time_so_far()

Definition at line 973 of file iozone.c.

#define CROSSOVER   (16*1024)

Definition at line 807 of file iozone.c.

#define DEDUPSEED   0x2719362

Definition at line 449 of file iozone.c.

#define DFLT_SERVICE   "PIT" /* Default service name. */

Definition at line 24038 of file iozone.c.

#define DISRUPT   100

Definition at line 779 of file iozone.c.

#define FILESIZE   (KILOBYTES*1024)

Definition at line 795 of file iozone.c.

#define FREADER_MASK   (1 << FREADER_TEST)

Definition at line 928 of file iozone.c.

#define FREADER_TEST   7

Definition at line 909 of file iozone.c.

#define FWRITER_MASK   (1 << FWRITER_TEST)

Definition at line 927 of file iozone.c.

#define FWRITER_TEST   6

Definition at line 908 of file iozone.c.

Definition at line 1409 of file iozone.c.

Definition at line 1408 of file iozone.c.

#define HOST_LIST_PORT   20000

Definition at line 1407 of file iozone.c.

#define I_CREAT (   x,
  y 
)    creat(x,(int)(y))

Definition at line 1184 of file iozone.c.

#define I_FOPEN (   x,
  y 
)    fopen(x,y)

Definition at line 1185 of file iozone.c.

#define I_LSEEK (   x,
  y,
 
)    lseek(x,(off_t)(y),z)

Definition at line 1182 of file iozone.c.

#define I_MMAP (   a,
  b,
  c,
  d,
  e,
  f 
)    mmap((void *)(a),(size_t)(b),(int)(c),(int)(d),(int)(e),(off_t)(f))

Definition at line 1191 of file iozone.c.

#define I_OPEN (   x,
  y,
 
)    open(x,(int)(y),(int)(z))

Definition at line 1183 of file iozone.c.

#define I_STAT (   x,
  y 
)    stat(x,y)

Definition at line 1186 of file iozone.c.

#define IBUFSIZE   100

Definition at line 775 of file iozone.c.

#define INVALID_DESC   -1 /* Invalid file (socket) descriptor. */

Definition at line 24039 of file iozone.c.

#define KILOBYTES   512

Definition at line 789 of file iozone.c.

#define KILOBYTES_END   (1024*512)

Definition at line 891 of file iozone.c.

#define KILOBYTES_START   64

Definition at line 889 of file iozone.c.

#define LARGE_REC   65536

Definition at line 786 of file iozone.c.

#define LM   0x7FFFFFFFULL /* Least significant 31 bits */

Definition at line 23878 of file iozone.c.

#define MAP_FAILED   -1

Definition at line 336 of file iozone.c.

#define MATRIX_A   0xB5026F5AA96619E9ULL

Definition at line 23876 of file iozone.c.

#define MAX_X   100

Definition at line 825 of file iozone.c.

#define MAX_Y   512

Definition at line 827 of file iozone.c.

#define MAXBFRSIZE   256 /* Max bfr sz to read remote TOD. */

Definition at line 24040 of file iozone.c.

#define MAXBUFFERSIZE   (16*1024*1024)

Definition at line 809 of file iozone.c.

#define MAXNAMESIZE   1000

Definition at line 833 of file iozone.c.

#define MAXSTREAMS   256

Definition at line 813 of file iozone.c.

#define MAXTESTS   12

Definition at line 820 of file iozone.c.

#define MEG   (1024 * 1024)

Definition at line 754 of file iozone.c.

#define MERSENNE

Definition at line 950 of file iozone.c.

#define MINBUFFERSIZE   128

Definition at line 816 of file iozone.c.

#define MM   156

Definition at line 23875 of file iozone.c.

#define MODE   "\tCompiled for 32 bit mode."

Definition at line 88 of file iozone.c.

#define MULTIPLIER   2

Definition at line 897 of file iozone.c.

#define NN   312

Definition at line 23874 of file iozone.c.

#define NUMRECS   FILESIZE/RECLEN

Definition at line 798 of file iozone.c.

#define PATTERN   get_pattern();

Definition at line 822 of file iozone.c.

#define PATTERN1   0xBB

Definition at line 823 of file iozone.c.

#define R_CHILD_JOIN   1

Definition at line 731 of file iozone.c.

#define R_DEATH   7

Definition at line 744 of file iozone.c.

#define R_FLAG_DATA   3

Definition at line 733 of file iozone.c.

#define R_JOIN_ACK   4

Definition at line 741 of file iozone.c.

#define R_STAT_DATA   2

Definition at line 732 of file iozone.c.

#define R_STOP_FLAG   5

Definition at line 742 of file iozone.c.

#define R_TERMINATE   6

Definition at line 743 of file iozone.c.

#define RANDOM_MIX_MASK   (1 << RANDOM_MIX_TEST)

Definition at line 923 of file iozone.c.

#define RANDOM_MIX_TEST   8

Definition at line 910 of file iozone.c.

#define RANDOM_RW_MASK   (1 << RANDOM_RW_TEST)

Definition at line 922 of file iozone.c.

#define RANDOM_RW_TEST   2

Definition at line 904 of file iozone.c.

#define READER_MASK   (1 << READER_TEST)

Definition at line 921 of file iozone.c.

#define READER_TEST   1

Definition at line 903 of file iozone.c.

#define RECLEN   1024

Definition at line 792 of file iozone.c.

#define RECLEN_END   (MAXBUFFERSIZE)

Definition at line 895 of file iozone.c.

#define RECLEN_START   4096

Definition at line 893 of file iozone.c.

#define REVERSE_MASK   (1 << REVERSE_TEST)

Definition at line 924 of file iozone.c.

#define REVERSE_TEST   3

Definition at line 905 of file iozone.c.

#define REWRITE_REC_MASK   (1 << REWRITE_REC_TEST)

Definition at line 925 of file iozone.c.

#define REWRITE_REC_TEST   4

Definition at line 906 of file iozone.c.

#define SHMSIZE   ((( sizeof(struct child_stats) * MAXSTREAMS) )+4096 )

Definition at line 1263 of file iozone.c.

Definition at line 1423 of file iozone.c.

#define SP_CHILD_LISTEN_PORT   31000

Definition at line 1422 of file iozone.c.

Definition at line 1425 of file iozone.c.

Definition at line 1424 of file iozone.c.

Definition at line 1426 of file iozone.c.

#define STRIDE   17

Definition at line 760 of file iozone.c.

#define STRIDE_READ_MASK   (1 << STRIDE_READ_TEST)

Definition at line 926 of file iozone.c.

#define STRIDE_READ_TEST   5

Definition at line 907 of file iozone.c.

#define THISVERSION   " Version $Revision$"

Definition at line 63 of file iozone.c.

#define THREAD_CLEANUP_TEST   14

Definition at line 1442 of file iozone.c.

#define THREAD_FREAD_TEST   13

Definition at line 1441 of file iozone.c.

#define THREAD_FWRITE_TEST   12

Definition at line 1440 of file iozone.c.

#define THREAD_PREAD_TEST   11

Definition at line 1439 of file iozone.c.

#define THREAD_PWRITE_TEST   10

Definition at line 1438 of file iozone.c.

#define THREAD_RANDOM_MIX_TEST   9

Definition at line 1437 of file iozone.c.

#define THREAD_RANDOM_READ_TEST   6

Definition at line 1434 of file iozone.c.

#define THREAD_RANDOM_WRITE_TEST   7

Definition at line 1435 of file iozone.c.

#define THREAD_READ_TEST   3

Definition at line 1431 of file iozone.c.

#define THREAD_REREAD_TEST   4

Definition at line 1432 of file iozone.c.

#define THREAD_REVERSE_READ_TEST   8

Definition at line 1436 of file iozone.c.

#define THREAD_REWRITE_TEST   2

Definition at line 1430 of file iozone.c.

#define THREAD_STRIDE_TEST   5

Definition at line 1433 of file iozone.c.

#define THREAD_WRITE_TEST   1

Definition at line 1429 of file iozone.c.

#define TOOFAST   10

Definition at line 818 of file iozone.c.

#define UM   0xFFFFFFFF80000000ULL /* Most significant 33 bits */

Definition at line 23877 of file iozone.c.

#define USAGE   "\tUsage: For usage information type iozone -h \n\n"

Definition at line 829 of file iozone.c.

#define VOLATILE

Definition at line 395 of file iozone.c.

#define WRITER_MASK   (1 << WRITER_TEST)

Definition at line 920 of file iozone.c.

#define WRITER_TEST   0

Definition at line 902 of file iozone.c.


Typedef Documentation

typedef long long off64_t

Definition at line 357 of file iozone.c.

typedef struct sockaddr_in6 sockaddr_in6_t

Definition at line 24052 of file iozone.c.

typedef struct sockaddr_in sockaddr_in_t

Definition at line 24051 of file iozone.c.


Enumeration Type Documentation

enum boolean
Enumerator:
false 
true 

Definition at line 24049 of file iozone.c.

{ false = 0, true } boolean;

Function Documentation

void add_file_size ( )

Here is the caller graph for this function:

void add_file_size ( off64_t  size)

Definition at line 20032 of file iozone.c.

{
    struct size_entry *size_listp;
    struct size_entry *nsize_list;
    
    size_listp=size_list;
    
    if(size_list)
    {
        if(size_listp->next)
            while(size_listp->next!=0)
                size_listp=size_listp->next;
    }
    nsize_list=(struct size_entry *)malloc(sizeof(struct size_entry));
    if(nsize_list==0)
    {
        printf("Malloc failed in add_file_size\n");
        exit(180);
    }   
    nsize_list->next=0;
    nsize_list->size=size;
    if(size_list == 0)
        size_list=nsize_list;
    else
        size_listp->next=nsize_list;
    size_listp=size_list;
}

Here is the call graph for this function:

void add_record_size ( )

Here is the caller graph for this function:

void add_record_size ( off64_t  size)

Definition at line 20155 of file iozone.c.

{
    struct size_entry *size_listp;
    struct size_entry *nsize_list;
    
    size_listp=rec_size_list;
    
    if(rec_size_list)
    {
        if(size_listp->next)
            while(size_listp->next!=0)
                size_listp=size_listp->next;
    }
    nsize_list=(struct size_entry *)malloc(sizeof(struct size_entry));
    if(nsize_list==0)
    {
        printf("Malloc failed in add_file_size\n");
        exit(180);
    }   
    nsize_list->next=0;
    nsize_list->size=size;
    if(rec_size_list == 0)
        rec_size_list=nsize_list;
    else
        size_listp->next=nsize_list;
    size_listp=rec_size_list;
}

Here is the call graph for this function:

char* alloc_mem ( )

Here is the caller graph for this function:

char* alloc_mem ( long long  size,
int  shared_flag 
)

Definition at line 12022 of file iozone.c.

{
    long long size1;
    char *addr,*dumb;
    int shmid;
    int tfd;
    long long tmp;
#if defined(solaris) 
        char mmapFileName[]="mmap_tmp_XXXXXX";
#endif

    tmp = 0;
    dumb = (char *)0;
    tfd=0;
    size1=l_max(size,page_size);
    if(!distributed)
    {
        if(!trflag)
        {
            addr=(char *)malloc((size_t)size1);
            return(addr);
        }
        if(use_thread)
        {
            addr=(char *)malloc((size_t)size1);
            return(addr);
        }
    }
    if(!shared_flag)
    {
        addr=(char *)malloc((size_t)size1);
        return(addr);
    }
#ifdef SHARED_MEM
    size1=l_max(size,page_size);
    size1=(size1 +page_size) & ~(page_size-1);
    shmid=(int)shmget((key_t)(IPC_PRIVATE), (size_t)size1 , (int)(IPC_CREAT|0666));
        if(shmid < (int)0)
        {
                printf("\nUnable to get shared memory segment(shmget)\n");
#ifdef NO_PRINT_LLD
                printf("shmid = %d, size = %ld, size1 = %lu, Error %d\n",shmid,size,(size_t)size1,errno);
#else
                printf("shmid = %d, size = %lld, size1 = %lu, Error %d\n",shmid,size,(unsigned long)size1,errno);
#endif
                exit(119);
        }
        /*addr = (char *)shmat(shmid, 0, SHM_W);*/
    /* Some systems will not take the above but
     * will default to read/write if no flags
     * are provided. (AIX)
     * The POSIX standard states that if SHM_RDONLY
     * is not specified then it will be read/write.
     */
        addr = (char *)shmat((int)shmid, 0, 0);
#ifdef _64BIT_ARCH_
        if((long long)addr == (long long)-1)
#else
        if((long)addr == (long)-1)
#endif
        {
                printf("\nUnable to get shared memory segment\n");
                printf("..Error %d\n",errno);
                exit(120);
        }
    shmctl(shmid, IPC_RMID, 0);
    return(addr);
#else

    size1=l_max(size,page_size);
    size1=(size1 +page_size) & ~(page_size-1);
#if defined(bsd4_2) && !defined(macosx)
    if((tfd = creat("mmap.tmp", 0666))<0)
    {
        printf("Unable to create tmp file\n");
        exit(121);
    }
    addr=(char *)mmap(0,&size1,PROT_WRITE|PROT_READ,
        MAP_ANON|MAP_SHARED, tfd, 0);
    unlink("mmap.tmp");
#else


#if defined(solaris) 
    tfd=mkstemp(mmapFileName);
        if(tfd < 0)
    {
        printf("Unable to create tmp file\n");
        exit(121);
    }
    dumb=(char *)malloc((size_t)size1);
    bzero(dumb,size1);
    write(tfd,dumb,size1);
    free(dumb);
    addr=(char *)mmap(0,(size_t)size1,PROT_WRITE|PROT_READ,
        MAP_SHARED, tfd, 0);
    unlink(mmapFileName);
#else
#if defined(SCO) || defined(SCO_Unixware_gcc) || defined(Windows)
        char mmapFileName[]="mmap_tmp_XXXXXX";
    tfd=mkstemp(mmapFileName);
        if(tfd < 0)
        {
                printf("Unable to create tmp file\n");
                exit(121);
        }
        dumb=(char *)malloc((size_t)size1);
    bzero(dumb,size1);
        write(tfd,dumb,size1);
        free(dumb);
        addr=(char *)mmap(0,(size_t)size1,PROT_WRITE|PROT_READ,
                MAP_SHARED, tfd, 0);
    unlink(mmapFileName);
#else
    addr=(char *)mmap(0,(size_t)size1,PROT_WRITE|PROT_READ,
        MAP_ANONYMOUS|MAP_SHARED, -1, 0);
#endif
#endif
#endif
    if((char *)addr == (char *)-1)
    {
        printf("\nUnable to get memory segment\n");
        printf("Error %d\n",errno);
        exit(122);
    }
    if(debug1)
        printf("Got shared memory for size %d\n",size1);

    return(addr);
#endif
}

Here is the call graph for this function:

alloc_pbuf ( void  )

Definition at line 23620 of file iozone.c.

{
    pbuffer = (char *) alloc_mem((long long)(3 * cache_size),(int)0);
    if(pbuffer == 0) {
                perror("Memory allocation failed:");
                exit(9);
    }
#ifdef _64BIT_ARCH_
    pbuffer = (char *) 
        (((unsigned long long)pbuffer + cache_size ) 
        & ~(cache_size-1));
#else
    pbuffer = (char *) 
        (((long)pbuffer + (long)cache_size ) 
        & ~((long)cache_size-1));
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void async_init ( )

Definition at line 19044 of file iozone.c.

{
    printf("Your system does not support async I/O\n");
    exit(172);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int async_read ( )

Definition at line 19026 of file iozone.c.

{
    printf("Your system does not support async I/O\n");
    exit(169);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 19050 of file iozone.c.

{
    printf("Your system does not support async I/O\n");
    exit(172);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void async_release ( )

Definition at line 19056 of file iozone.c.

{
    printf("Your system does not support async I/O\n");
    exit(173);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 19038 of file iozone.c.

{
    printf("Your system does not support async I/O\n");
    exit(171);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 19032 of file iozone.c.

{
    printf("Your system does not support async I/O\n");
    exit(170);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int atoi ( )

Here is the caller graph for this function:

void auto_test ( )

Definition at line 3404 of file iozone.c.

{
        off64_t kilosi;
    long long recszi,count1;
    long long mult;
    long long xx;

    /****************************************************************/
    /* Start with file size of 1 megabyte and repeat the test   */
    /* KILOBYTES_ITER_LIMIT                     */
    /* times.  Each time we run, the file size is doubled       */
    /****************************************************************/
/*
        if(sflag) {
          min_file_size = kilobytes64;
          max_file_size = kilobytes64;
        }
        if(rflag) {
          min_rec_size = reclen;
          max_rec_size = reclen;
        }
*/
    if(gflag)
        max_file_size = maximum_file_size;
    if(nflag)
        min_file_size = minimum_file_size;

        if (min_rec_size > (long long)(min_file_size*1024)) {
#ifdef NO_PRINT_LLD
            printf("Error: record length %ld is greater than filesize %ld KB\n ",
                                min_rec_size,min_file_size);
#else
            printf("Error: record length %lld is greater than filesize %lld KB\n ",
                                min_rec_size,min_file_size);
#endif
                exit(23);
        }

    if(NOCROSSflag) xover = max_file_size;

    init_file_sizes(min_file_size, max_file_size);
    del_record_sizes();
    orig_min_rec_size=min_rec_size;
    orig_max_rec_size=max_rec_size;
    init_record_sizes(min_rec_size, max_rec_size);

        for(kilosi=get_next_file_size((off64_t)0); kilosi>0; kilosi=get_next_file_size(kilosi))
        {
    /****************************************************************/
    /* Start with record size of min_rec_size bytes and repeat the  */
    /* test, multiplying the record size by MULTIPLIER each time,   */
    /* until we reach max_rec_size.  At the CROSSOVER we stop doing */
    /* small buffers as it takes forever and becomes very       */
    /* un-interesting.                      */
    /****************************************************************/
             if(!rflag && !sflag && !yflag && !qflag)
                if(kilosi > xover){
                    min_rec_size = LARGE_REC;
            mult = orig_min_rec_size/1024;
            del_record_sizes();
            init_record_sizes(min_rec_size, max_rec_size);
                /************************************/
            /* Generate dummy entries in the    */
            /* Excel buffer for skipped         */
            /* record sizes          */
            /************************************/
            for(count1=min_rec_size;
                    (count1 != orig_min_rec_size) && (
                        mult <= (kilosi*1024)) ;
                        count1=(count1>>1))
            {
                    current_x=0;
                    store_value((off64_t)kilosi);
                    store_value((off64_t)mult);
                    for(xx=0;xx<20;xx++)
                        store_value((off64_t)0);
                    mult=mult*2;
                    current_y++;
                    if(current_y>max_y)
                        max_y=current_y;
                    current_x=0;
            }
         }

             for (recszi=get_next_record_size((off64_t)0);recszi!=0;recszi=get_next_record_size(recszi))
             {
                     if(recszi > (kilosi*1024)) 
            break;
                     begin(kilosi, recszi );
             current_x=0;
             current_y++;
             }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void become_client ( )

Definition at line 21555 of file iozone.c.

{
    int x,testnum;
    struct master_command mc;
    struct client_command cc;
    struct client_neutral_command *cnc;
    char client_name[100];
    char *workdir;

    bzero(&mc,sizeof(struct master_command));
    x=fork(); /* Become a daemon so that remote shell will return. */
    if(x != 0)
        exit(0);
    /*
     * I am the child 
     */
    (void)gethostname(client_name,100);

    fflush(stdout);
    fflush(stderr);
    if(cdebug)
    {
        newstdin=freopen("/tmp/don_in","r+",stdin);
        newstdout=freopen("/tmp/don_out","a+",stdout);
        newstderr=freopen("/tmp/don_err","a+",stderr);
    }
    else
    {
        fclose(stdin);
        fclose(stdout);
        fclose(stderr);
    }
    if(cdebug>=1)
    {
        fprintf(newstdout,"My name = %s, Controller's name = %s\n",client_name, controlling_host_name);
        fflush(newstdout);
    }

    /* 1. Start client receive channel              */

    l_sock = start_child_listen(sizeof(struct client_neutral_command));
    l_async_sock = start_child_listen_async(sizeof(struct client_neutral_command));

    /* 2. Send message to controller saying I'm joining.        */

    strcpy(mc.m_host_name,controlling_host_name);
    strcpy(mc.m_client_name,client_name);
    mc.m_child_port = child_port;
    mc.m_child_async_port = child_async_port;
    mc.m_command = R_CHILD_JOIN;
    mc.m_version = proto_version;
    
    if(cdebug)
    {
        fprintf(newstdout,"Child %s sends JOIN to master %s Host Port %d\n",
            client_name,controlling_host_name,controlling_host_port);
        fflush(newstdout);
    }
    child_send(controlling_host_name,(struct master_command *)&mc, sizeof(struct master_command));

    l_sock=child_attach(l_sock,0);
    l_async_sock=child_attach(l_async_sock,1);
    
    /* 4. Go into a loop and get all instructions from      */
        /*    the controlling process.                  */

    if(cdebug>=1)
    {
        fprintf(newstdout,"Child %s waiting for who am I\n",client_name);
        fflush(newstdout);
    }
    child_listen(l_sock,sizeof(struct client_neutral_command));
    cnc = (struct client_neutral_command *)&child_rcv_buf;
    bzero(&cc, sizeof(struct client_command));
    
    /* Convert from string format to arch format */
    sscanf(cnc->c_command,"%d",&cc.c_command);
    sscanf(cnc->c_client_name,"%s",cc.c_client_name);
    sscanf(cnc->c_client_number,"%d",&cc.c_client_number);
    sscanf(cnc->c_host_name,"%s",cc.c_host_name);
    sscanf(cnc->c_pit_hostname,"%s",cc.c_pit_hostname);

    if(cc.c_command == R_TERMINATE || cc.c_command==R_DEATH)
    {
        if(cdebug)
        {
            fprintf(newstdout,"Child %d received terminate on sync channel !!\n",(int)chid);
            fflush(newstdout);
        }
        exit(1);
    }
    
    if(cdebug)
    {
         fprintf(newstdout,"Child sees: \n Client name %s \n Client_num # %d \n Host_name %s\n"
            ,cc.c_client_name,cc.c_client_number,cc.c_host_name);
     fflush(newstdout);
    }

    /*
     * Now import all of the values of the flags that the child on this 
     * machine needs to be able to run the test requested.
     */

    /* 5. Get state information from the master */

#ifdef NO_PRINT_LLD
    sscanf(cnc->c_numrecs64,"%ld",&cc.c_numrecs64);
    sscanf(cnc->c_reclen,"%ld",&cc.c_reclen);
    sscanf(cnc->c_fetchon,"%ld",&cc.c_fetchon);
    sscanf(cnc->c_purge,"%ld",&cc.c_purge);
    sscanf(cnc->c_delay,"%ld",&cc.c_delay);
    sscanf(cnc->c_stride,"%ld",&cc.c_stride);
    sscanf(cnc->c_rest_val,"%ld",&cc.c_rest_val);
    sscanf(cnc->c_delay_start,"%ld",&cc.c_delay_start);
    sscanf(cnc->c_depth,"%ld",&cc.c_depth);
#else
    sscanf(cnc->c_numrecs64,"%lld",&cc.c_numrecs64);
    sscanf(cnc->c_reclen,"%lld",&cc.c_reclen);
    sscanf(cnc->c_fetchon,"%lld",&cc.c_fetchon);
    sscanf(cnc->c_purge,"%lld",&cc.c_purge);
    sscanf(cnc->c_delay,"%lld",&cc.c_delay);
    sscanf(cnc->c_stride,"%lld",&cc.c_stride);
    sscanf(cnc->c_rest_val,"%lld",&cc.c_rest_val);
    sscanf(cnc->c_delay_start,"%lld",&cc.c_delay_start);
    sscanf(cnc->c_depth,"%lld",&cc.c_depth);
#endif
    sscanf(cnc->c_pit_hostname,"%s",cc.c_pit_hostname);
    sscanf(cnc->c_pit_service,"%s",cc.c_pit_service);
    sscanf(cnc->c_testnum,"%d",&cc.c_testnum);
    sscanf(cnc->c_client_number,"%d",&cc.c_client_number);
    sscanf(cnc->c_working_dir,"%s",cc.c_working_dir);
    sscanf(cnc->c_file_name,"%s",cc.c_file_name);
    sscanf(cnc->c_write_traj_filename,"%s",cc.c_write_traj_filename);
    sscanf(cnc->c_read_traj_filename,"%s",cc.c_read_traj_filename);
    sscanf(cnc->c_noretest,"%d",&cc.c_noretest);
    sscanf(cnc->c_notruncate,"%d",&cc.c_notruncate);
    sscanf(cnc->c_read_sync,"%d",&cc.c_read_sync);
    sscanf(cnc->c_jflag,"%d",&cc.c_jflag);
    sscanf(cnc->c_direct_flag,"%d",&cc.c_direct_flag);
    sscanf(cnc->c_cpuutilflag,"%d",&cc.c_cpuutilflag);
    sscanf(cnc->c_seq_mix,"%d",&cc.c_seq_mix);
    sscanf(cnc->c_async_flag,"%d",&cc.c_async_flag);
    sscanf(cnc->c_k_flag,"%d",&cc.c_k_flag);
    sscanf(cnc->c_h_flag,"%d",&cc.c_h_flag);
    sscanf(cnc->c_mflag,"%d",&cc.c_mflag);
    sscanf(cnc->c_pflag,"%d",&cc.c_pflag);
    sscanf(cnc->c_stride_flag,"%d",&cc.c_stride_flag);
    sscanf(cnc->c_verify,"%d",&cc.c_verify);
    sscanf(cnc->c_sverify,"%d",&cc.c_sverify);
    sscanf(cnc->c_odsync,"%d",&cc.c_odsync);
    sscanf(cnc->c_diag_v,"%d",&cc.c_diag_v);
    sscanf(cnc->c_dedup,"%d",&cc.c_dedup);
    sscanf(cnc->c_dedup_interior,"%d",&cc.c_dedup_interior);
    sscanf(cnc->c_dedup_compress,"%d",&cc.c_dedup_compress);
    sscanf(cnc->c_dedup_mseed,"%d",&cc.c_dedup_mseed);
    sscanf(cnc->c_hist_summary,"%d",&cc.c_hist_summary);
    sscanf(cnc->c_op_rate,"%d",&cc.c_op_rate);
    sscanf(cnc->c_op_rate_flag,"%d",&cc.c_op_rate_flag);
    sscanf(cnc->c_file_lock,"%d",&cc.c_file_lock);
    sscanf(cnc->c_rec_lock,"%d",&cc.c_rec_lock);
    sscanf(cnc->c_Kplus_readers,"%d",&cc.c_Kplus_readers);
    sscanf(cnc->c_multiplier,"%d",&cc.c_multiplier);
    sscanf(cnc->c_share_file,"%d",&cc.c_share_file);
    sscanf(cnc->c_pattern,"%d",&cc.c_pattern);
    sscanf(cnc->c_version,"%d",&cc.c_version);
    sscanf(cnc->c_base_time,"%d",&cc.c_base_time);
    sscanf(cnc->c_num_child,"%d",&cc.c_num_child);
    sscanf(cnc->c_pct_read,"%d",&cc.c_pct_read);
    sscanf(cnc->c_advise_op,"%d",&cc.c_advise_op);
    sscanf(cnc->c_advise_flag,"%d",&cc.c_advise_flag);
    sscanf(cnc->c_restf,"%d",&cc.c_restf);
    sscanf(cnc->c_mygen,"%d",&cc.c_mygen);
    sscanf(cnc->c_oflag,"%d",&cc.c_oflag);
    sscanf(cnc->c_mfflag,"%d",&cc.c_mfflag);
    sscanf(cnc->c_unbuffered,"%d",&cc.c_unbuffered);
    sscanf(cnc->c_Q_flag,"%d",&cc.c_Q_flag);
    sscanf(cnc->c_L_flag,"%d",&cc.c_L_flag);
    sscanf(cnc->c_xflag,"%d",&cc.c_xflag);
    sscanf(cnc->c_include_flush,"%d",&cc.c_include_flush);
    sscanf(cnc->c_OPS_flag,"%d",&cc.c_OPS_flag);
    sscanf(cnc->c_mmapflag,"%d",&cc.c_mmapflag);
    sscanf(cnc->c_mmapasflag,"%d",&cc.c_mmapasflag);
    sscanf(cnc->c_mmapnsflag,"%d",&cc.c_mmapnsflag);
    sscanf(cnc->c_mmapssflag,"%d",&cc.c_mmapssflag);
    sscanf(cnc->c_no_copy_flag,"%d",&cc.c_no_copy_flag);
    sscanf(cnc->c_w_traj_flag,"%d",&cc.c_w_traj_flag);
    sscanf(cnc->c_r_traj_flag,"%d",&cc.c_r_traj_flag);
    sscanf(cnc->c_no_unlink,"%d",&cc.c_no_unlink);
    sscanf(cnc->c_no_write,"%d",&cc.c_no_write);
    sscanf(cnc->c_include_close,"%d",&cc.c_include_close);
    sscanf(cnc->c_disrupt_flag,"%d",&cc.c_disrupt_flag);
    sscanf(cnc->c_compute_flag,"%d",&cc.c_compute_flag);
    sscanf(cnc->c_MS_flag,"%d",&cc.c_MS_flag);
    sscanf(cnc->c_mmap_mix,"%d",&cc.c_mmap_mix);
    sscanf(cnc->c_Kplus_flag,"%d",&cc.c_Kplus_flag);
    sscanf(cnc->c_compute_time,"%f",&cc.c_compute_time);

    strcpy(write_traj_filename,cc.c_write_traj_filename);
    strcpy(read_traj_filename,cc.c_read_traj_filename);
    numrecs64 = cc.c_numrecs64;
    strcpy(pit_hostname,cc.c_pit_hostname);
    strcpy(pit_service,cc.c_pit_service);
    reclen = cc.c_reclen;
    testnum = cc.c_testnum;
    chid = cc.c_client_number;
    workdir=cc.c_working_dir;
    oflag = cc.c_oflag;
    /* Child's absolute filename to use is provided */
    mfflag = cc.c_mfflag;
    if(mfflag)
        strcpy(filearray[chid],cc.c_file_name);
    if(cdebug)
    {
        fprintf(newstdout,"File name given %s\n",cc.c_file_name);
        fflush(newstdout);
    }
    unbuffered = cc.c_unbuffered;
    noretest = cc.c_noretest;
    notruncate = cc.c_notruncate;
    read_sync = cc.c_read_sync;
    jflag = cc.c_jflag;
    direct_flag = cc.c_direct_flag;
    cpuutilflag = cc.c_cpuutilflag;
    seq_mix = cc.c_seq_mix;
    async_flag = cc.c_async_flag;
    k_flag = cc.c_k_flag;
    h_flag = cc.c_h_flag;
    mflag = cc.c_mflag;
    pflag = cc.c_pflag;
    stride_flag = cc.c_stride_flag;
    fetchon = cc.c_fetchon;
    verify = cc.c_verify;
    diag_v = cc.c_diag_v;
    dedup = cc.c_dedup;
    dedup_interior = cc.c_dedup_interior;
    dedup_compress = cc.c_dedup_compress;
    dedup_mseed = cc.c_dedup_mseed;
    hist_summary = cc.c_hist_summary;
    op_rate = cc.c_op_rate;
    op_rate_flag = cc.c_op_rate_flag;
    if(diag_v)
        sverify = 0;
    else
        sverify = cc.c_sverify;
    file_lock = cc.c_file_lock;
    rlocking = cc.c_rec_lock;
    Kplus_readers = cc.c_Kplus_readers;
    multiplier = cc.c_multiplier;
    share_file = cc.c_share_file;
    pattern = cc.c_pattern;
    /* proto_version = cc.c_version; Don't copy it back. */
    base_time=cc.c_base_time;
    num_child=(long long)cc.c_num_child;
    pct_read=cc.c_pct_read;
    advise_op=cc.c_advise_op;
    advise_flag=cc.c_advise_flag;
    restf=cc.c_restf;
    mygen=cc.c_mygen;
    Q_flag = cc.c_Q_flag;
    L_flag = cc.c_L_flag;
    xflag = cc.c_xflag;
    w_traj_flag = cc.c_w_traj_flag;
    r_traj_flag = cc.c_r_traj_flag;
    include_flush = cc.c_include_flush;
    OPS_flag = cc.c_OPS_flag;
    purge = cc.c_purge;
    mmapflag = cc.c_mmapflag;
    mmapasflag = cc.c_mmapasflag;
    mmapnsflag = cc.c_mmapnsflag;
    mmapssflag = cc.c_mmapssflag; 
    no_copy_flag = cc.c_no_copy_flag;
    no_unlink = cc.c_no_unlink;
    no_write = cc.c_no_write;
    include_close = cc.c_include_close;
    disrupt_flag = cc.c_disrupt_flag;
    compute_flag = cc.c_compute_flag;
    MS_flag = cc.c_MS_flag;
    mmap_mix = cc.c_mmap_mix;
    Kplus_flag = cc.c_Kplus_flag;
    delay = cc.c_delay;
    stride = cc.c_stride;
    rest_val = cc.c_rest_val;
    depth = cc.c_depth;
    delay_start = cc.c_delay_start;
    compute_time = cc.c_compute_time;
    if(cdebug)
    {
        fprintf(newstdout,"Child %d change directory to %s\n",(int)chid,workdir);
        fflush(newstdout);
    }
    if(purge)
        alloc_pbuf();

    /* 6. Change to the working directory */

    if(chdir(workdir)<0)
        client_error=errno;
    start_child_listen_loop(); /* The async channel listener */

    /* Need to start this after getting into the correct directory */
    if(w_traj_flag)
        w_traj_size();
    if(r_traj_flag)
        r_traj_size();

    get_resolution();       /* Get my clock resolution */
    if(hist_summary)
    {
        printf("Child got HISTORY flag\n");
    }

    /* 7. Run the test */
    switch(testnum) {

    case THREAD_WRITE_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running thread_write_test\n",(int)chid);
            fflush(newstdout);
        }
        thread_write_test((long)0);
        break;
#ifdef HAVE_PREAD
    case THREAD_PWRITE_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running thread_pwrite_test\n",(int)chid);
            fflush(newstdout);
        }
        thread_pwrite_test((long)0);
        break;
#endif
    case THREAD_REWRITE_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running thread_rewrite_test\n",(int)chid);
            fflush(newstdout);
        }
        thread_rwrite_test((long)0);
        break;
    case THREAD_READ_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running thread_read_test\n",(int)chid);
            fflush(newstdout);
        }
        thread_read_test((long)0);
        break;
#ifdef HAVE_PREAD
    case THREAD_PREAD_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running thread_read_test\n",(int)chid);
            fflush(newstdout);
        }
        thread_pread_test((long)0);
        break;
#endif
    case THREAD_REREAD_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running thread_reread_test\n",(int)chid);
            fflush(newstdout);
        }
        thread_rread_test((long)0);
        break;
    case THREAD_STRIDE_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running thread_stride_read_test\n",(int)chid);
            fflush(newstdout);
        }
        thread_stride_read_test((long)0);
        break;
    case THREAD_RANDOM_READ_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running random read test\n",(int)chid);
            fflush(newstdout);
        }
        thread_ranread_test((long)0);
        break;
    case THREAD_RANDOM_WRITE_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running random write test\n",(int)chid);
            fflush(newstdout);
        }
        thread_ranwrite_test((long)0);
        break;
    case THREAD_REVERSE_READ_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running reverse read test\n",(int)chid);
            fflush(newstdout);
        }
        thread_reverse_read_test((long)0);
        break;
    case THREAD_RANDOM_MIX_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running mixed workload test\n",(int)chid);
            fflush(newstdout);
        }
        thread_mix_test((long)0);
        break;
    case THREAD_FWRITE_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running thread_fwrite_test\n",(int)chid);
            fflush(newstdout);
        }
        thread_fwrite_test((long)0);
        break;
    case THREAD_FREAD_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running thread_fread_test\n",(int)chid);
            fflush(newstdout);
        }
        thread_fread_test((long)0);
        break;
    case THREAD_CLEANUP_TEST : 
        if(cdebug>=1)
        {
            fprintf(newstdout,"Child %d running cleanup\n",(int)chid);
            fflush(newstdout);
        }
        thread_cleanup_test((long)0);
        break;
    };
    if(cdebug>=1)
    {
        fprintf(newstdout,"Child %d finished running test.\n",(int)chid);
        fflush(newstdout);
    }
    
    /* 8. Release the listen and send sockets to the master */
    stop_child_listen(l_sock);

    exit(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void begin ( )

Here is the caller graph for this function:

void begin ( off64_t  kilos64,
long long  reclength 
)

Definition at line 3179 of file iozone.c.

{
    long long num_tests,test_num,i,j;
    long long data1[MAXTESTS], data2[MAXTESTS];
    num_tests = sizeof(func)/sizeof(char *);
#if defined(HAVE_PREAD) 
    if(!Eflag)
    {
#if defined(HAVE_PREAD) && defined(HAVE_PREADV)
        num_tests -= 4;
#else
        num_tests -= 2;
#endif
        if(mmapflag || async_flag)
        {
            num_tests -= 2;
        }
    }
    else
    {
        if(mmapflag || async_flag)
#if defined(HAVE_PREAD) && defined(HAVE_PREADV)
            num_tests -= 6;
#else
            num_tests -= 4;
#endif
    }
#else
    if(mmapflag || async_flag)
    {
        num_tests -= 2;
    }
#endif

    if(RWONLYflag) num_tests = 2;       /* kcollins 8-21-96*/
    sync();         /* just in case there were some dirty */
    sync();
    kilobytes64=kilos64;
    reclen=reclength;
    numrecs64 = (kilobytes64*1024)/reclen;
    store_value(kilobytes64);
    if(r_traj_flag || w_traj_flag)
        store_value((off64_t)0);
    else    
        store_value((off64_t)(reclen/1024));

#ifdef NO_PRINT_LLD
    if(!silent) printf("%16ld",kilobytes64);
    if(r_traj_flag || w_traj_flag)
    {
        if(!silent) printf("%8ld",0);
    }
    else
    {
        if(!silent) printf("%8ld",reclen/1024);
    }
#else
    if(!silent) printf("%16lld",kilobytes64);
    if(r_traj_flag || w_traj_flag)
    {
        if(!silent) printf("%8lld",(long long )0);
    }
    else
    {
        if(!silent) printf("%8lld",reclen/1024);
    }
#endif
    if(include_tflag)
    {
        for(i=0;i<num_tests;i++)
        {
            if(include_mask & (long long)(1<<i))
               func[i](kilobytes64,reclen,&data1[i],&data2[i]);
            else
            {
                    if(!silent) printf("%s",test_output[i]); 
                fflush(stdout);
                for(j=0;j<test_soutput[i];j++)
                    store_value((off64_t)0);
            }
        }
    }
    else
    {
        for(test_num=0;test_num < num_tests;test_num++)
        {
            func[test_num](kilobytes64,reclen,&data1[test_num],&data2[test_num]);
        };
    }
    if(!silent) printf("\n");
    if(!OPS_flag && !include_tflag){            /* Report in ops/sec ? */
       if(data1[1]!=0 && data2[1] != 0)
       {   
        totaltime = data1[1] + data1[0];
        if (totaltime < TOOFAST) 
        {
            goodkilos = (TOOFAST/totaltime)*2*kilobytes64;
                printf("\nThe test completed too quickly to give a good result\n");
                printf("You will get a more precise measure of this machine's\n");
                printf("performance by re-running iozone using the command:\n");
#ifdef NO_PRINT_LLD
                printf("\n\tiozone %ld ", goodkilos);
                printf("\t(i.e., file size = %ld kilobytes64)\n", goodkilos);
#else
                printf("\n\tiozone %lld ", goodkilos);
                printf("\t(i.e., file size = %lld kilobytes64)\n", goodkilos);
#endif
        }
       } else {
            goodrecl = reclen/2;
            printf("\nI/O error during read.  Try again with the command:\n");
#ifdef NO_PRINT_LLD
            printf("\n\tiozone %ld %ld ", kilobytes64,  goodrecl);
            printf("\t(i.e. record size = %ld bytes)\n",  goodrecl);
#else
            printf("\n\tiozone %lld %lld ", kilobytes64,  goodrecl);
            printf("\t(i.e. record size = %lld bytes)\n",  goodrecl);
#endif
       }
    }
    if (!no_unlink)
    {
        if(check_filename(filename))
              unlink(filename); /* delete the file */
    }
                    /*stop timer*/
    return ;
}

Here is the call graph for this function:

int check_filename ( )

Here is the caller graph for this function:

check_filename ( char *  name)

Definition at line 23647 of file iozone.c.

{
#ifdef _LARGEFILE64_SOURCE
    struct stat64 mystat;
#else
    struct stat mystat;
#endif
    int x;
    if(strlen(name)==0)
        return(0);
    /* Lets try stat first.. may get an error if file is too big */
    x=I_STAT(name,&mystat);
    if(x<0)
    {
        return(0);
        /* printf("Stat failed %d\n",x); */
    }
    if(mystat.st_mode & S_IFREG)
    {
        /*printf("Is a regular file\n");*/
        return(1);
    }
    return(0);
}
int child_attach ( int  s,
int  flag 
)

Definition at line 20831 of file iozone.c.

{
    unsigned int me;
    int ns;
    struct sockaddr_in *addr;
    if(flag)
    {
        addr=&child_async_sock;
        if(cdebug)
        {
            fprintf(newstdout,"Child %d attach async\n",(int)chid);
            fflush(newstdout);
        }
    }
    else
    {
        addr=&child_sync_sock;
        if(cdebug)
        {
            fprintf(newstdout,"Child %d attach sync\n",(int)chid);
            fflush(newstdout);
        }
    }
    me=sizeof(struct sockaddr_in);
    if(cdebug)
    {
        printf("Child %d enters listen\n",(int)chid);
        fflush(stdout);
    }
    listen(s,10);
    if(cdebug)
    {
        fprintf(newstdout,"Child %d enters accept\n",(int)chid);
        fflush(newstdout);
    }
    ns=accept(s,(void *)addr,&me);
    if(cdebug)
    {
        fprintf(newstdout,"Child %d attached for receive. Sock %d  %d\n",
            (int)chid, ns,errno);
        fflush(newstdout);
    }
    return(ns);
}

Here is the caller graph for this function:

void child_listen ( )

Here is the caller graph for this function:

void child_listen ( int  sock,
int  size_of_message 
)

Definition at line 20888 of file iozone.c.

{
    int tsize;
    int rcvd;
    int s;
    int rc;
    char *cnc;

    cnc = (char *)&child_rcv_buf[0];
    bzero(cnc, sizeof(child_rcv_buf));
    s = sock;
    tsize=size_of_message; /* Number of messages to receive */
    rcvd = 0;
    while(rcvd < tsize)
    {
        if(cdebug ==1)
        {
            fprintf(newstdout,"Child %d In recieve \n",(int)chid);
            fflush(newstdout);
        }
        rc=read(s,cnc,size_of_message);
        if(rc < 0)
        {
            fprintf(newstdout,"Read failed. Errno %d \n",errno);
            fflush(newstdout);
            exit(21);
        }
        if(cdebug >= 1)
        {
            fprintf(newstdout,"Child %d: Got %d bytes\n",(int)chid, rc);
            fflush(newstdout);
        }
        rcvd+=rc;
        cnc+=rc;
    }
    if(cdebug >= 1)
    {
        fprintf(newstdout,"Child %d: return from listen\n",(int)chid);
        fflush(newstdout);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void child_listen_async ( int  sock,
int  size_of_message 
)

Definition at line 21010 of file iozone.c.

{
    int tsize;
    int rcvd;
    int s;
    int rc;
    char *cnc;

    cnc = &child_async_rcv_buf[0];
    s = sock;
    tsize=size_of_message; /* Number of messages to receive */
    rcvd = 0;
    while(rcvd < tsize)
    {
        if(cdebug ==1)
        {
            fprintf(newstdout,"Child %d In async recieve \n",(int)chid);
            fflush(newstdout);
        }
        rc=read(s,cnc,size_of_message);
        if(rc < 0)
        {
            fprintf(newstdout,"Read failed. Errno %d \n",errno);
            fflush(newstdout);
            exit(21);
        }
        /* Special case. If master gets final results, it can 
                   exit, and close the connection to the async child
                   too quickly. When this happens the child gets a 
           read() that returns 0. It just needs to exit here.
        */
        if(rc==0)
            exit(0);
        if(cdebug >= 1)
        {
            fprintf(newstdout,"Child %d: Got %d bytes (async) \n",(int)chid,rc);
            fflush(newstdout);
        }
        rcvd+=rc;
        cnc+=rc;
    }
    if(cdebug >= 1)
    {
        fprintf(newstdout,"Child %d: return from async listen\n",(int)chid);
        fflush(newstdout);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void child_remove_files ( int  i)

Definition at line 22504 of file iozone.c.

{

    char *dummyfile[MAXSTREAMS];           /* name of dummy file     */
    dummyfile[i]=(char *)malloc((size_t)MAXNAMESIZE);
    if(mfflag)
    {
        sprintf(dummyfile[i],"%s",filearray[i]);
    }
    else
    {
        sprintf(dummyfile[i],"%s.DUMMY.%d",filearray[i],i);
    }
    if(cdebug)
    {
        fprintf(newstdout,"Child %d remove: %s \n",(int)chid, dummyfile[i]);
        fflush(newstdout);
    }
    if(check_filename(dummyfile[i]))
        unlink(dummyfile[i]);
}

Here is the call graph for this function:

void child_send ( )

Here is the caller graph for this function:

void child_send ( char *  controlling_host_name,
struct master_command send_buffer,
int  send_size 
)

Definition at line 20406 of file iozone.c.

{

        int rc,child_socket_val;
        struct hostent *he;
        int tmp_port;
        struct in_addr *ip;
        struct sockaddr_in cs_addr,cs_raddr;
    struct master_neutral_command outbuf;
    struct timespec req,rem;

    req.tv_sec = 0;
    req.tv_nsec = 10000000;
    rem.tv_sec = 0;
    rem.tv_nsec = 10000000;

        if(cdebug)
    {
           fprintf(newstdout,"Start_child_send: %s  Size %d\n",controlling_host_name,send_size);
       fflush(newstdout);
    }
        he = gethostbyname(controlling_host_name);
        if (he == NULL)
        {
                exit(22);
        }
        ip = (struct in_addr *)he->h_addr_list[0];

over:
        cs_raddr.sin_family = AF_INET;
        cs_raddr.sin_port = htons(controlling_host_port);
        cs_raddr.sin_addr.s_addr = ip->s_addr;
        child_socket_val = socket(AF_INET, SOCK_STREAM, 0);
        if (child_socket_val < 0)
        {
                perror("Child: socket failed:");
                exit(23);
        }
        bzero(&cs_addr, sizeof(struct sockaddr_in));
        tmp_port= CHILD_ESEND_PORT;
        cs_addr.sin_port = htons(tmp_port);
        cs_addr.sin_family = AF_INET;
        cs_addr.sin_addr.s_addr = INADDR_ANY;
        rc = -1;
        while (rc < 0)
        {
                rc = bind(child_socket_val, (struct sockaddr *)&cs_addr,
                                                sizeof(struct sockaddr_in));
                if(rc < 0)
                {
                        tmp_port++;
                        cs_addr.sin_port=htons(tmp_port);
                        continue;
                }
        }
        if (rc < 0)
        {
                perror("Child: bind failed\n");
                exit(24);
        }
        if(cdebug)
    {
          fprintf(newstdout,"Child sender bound to port %d Master port %d \n",tmp_port,HOST_LIST_PORT);
      fflush(newstdout);
    }
again:
    nanosleep(&req,&rem);
        rc = connect(child_socket_val, (struct sockaddr *)&cs_raddr,
                        sizeof(struct sockaddr_in));
        if (rc < 0)
        {
                if((ecount++ < 200) && (errno != EISCONN))
                {
            nanosleep(&req,&rem);
                        /*sleep(1);*/
                        goto again;
                }
                if(cdebug)
                {
               fprintf(newstdout,"Child: connect failed. Errno %d \n",errno);
           fflush(newstdout);
                }
                close(child_socket_val);
        nanosleep(&req,&rem);
                /*sleep(1);*/
                ecount=0;
                goto over;
        }
        ecount=0;
        if(cdebug)
    {
          fprintf(newstdout,"Child connected\n");
      fflush(newstdout);
    }

    /* NOW send */

    bzero(&outbuf, sizeof(struct master_neutral_command));
    if(cdebug>=1)
    {
        fprintf(newstdout,"Child %d sending message to %s \n",(int)chid, controlling_host_name);
        fflush(newstdout);
    }
    /* 
     * Convert internal commands to string format to neutral format for portability
     */
    strcpy(outbuf.m_host_name,send_buffer->m_host_name);
    strcpy(outbuf.m_client_name,send_buffer->m_client_name);
    sprintf(outbuf.m_client_number,"%d",send_buffer->m_client_number);
    sprintf(outbuf.m_client_error,"%d",send_buffer->m_client_error);
    sprintf(outbuf.m_child_port,"%d",send_buffer->m_child_port);
    sprintf(outbuf.m_child_async_port,"%d",send_buffer->m_child_async_port);
    sprintf(outbuf.m_command,"%d",send_buffer->m_command);
    sprintf(outbuf.m_testnum,"%d",send_buffer->m_testnum);
    sprintf(outbuf.m_version,"%d",send_buffer->m_version);
    sprintf(outbuf.m_mygen,"%d",send_buffer->m_mygen);
    sprintf(outbuf.m_throughput,"%f",send_buffer->m_throughput);
    sprintf(outbuf.m_cputime,"%f", send_buffer->m_cputime);
    sprintf(outbuf.m_walltime,"%f",send_buffer->m_walltime);
    sprintf(outbuf.m_stop_flag,"%d",send_buffer->m_stop_flag);
    sprintf(outbuf.m_actual,"%f",send_buffer->m_actual);
#ifdef NO_PRINT_LLD
    sprintf(outbuf.m_child_flag,"%ld",send_buffer->m_child_flag);
#else
    sprintf(outbuf.m_child_flag,"%lld",send_buffer->m_child_flag);
#endif
    rc=write(child_socket_val,&outbuf,sizeof(struct master_neutral_command));
        if (rc < 0) {
                perror("write failed\n");
                exit(26);
        }
    close(child_socket_val);
}

Here is the call graph for this function:

void cleanup_children ( )

Definition at line 22647 of file iozone.c.

{
    int i;
    struct client_command cc;
    bzero(&cc,sizeof(struct client_command));
    cc.c_command = R_DEATH;
    for(i=0;i<num_child;i++)
    {
        cc.c_client_number = (int)i; 
        /* Child not started yet */
        if(child_idents[i].state == C_STATE_ZERO)
            ;
        /* Child is waiting for who info */
        if(child_idents[i].state == C_STATE_WAIT_WHO)
        {
            if(mdebug)
                printf("Master sending signaled death to child !!\n");
            master_send(master_send_sockets[i],child_idents[i].child_name, &cc,sizeof(struct client_command));
        }
        /* Child is waiting at the barrier */
        if(child_idents[i].state == C_STATE_WAIT_BARRIER)
        {
            if(mdebug)
                printf("Master sending signaled death to child !!\n");
            master_send(master_send_sockets[i],child_idents[i].child_name, &cc,sizeof(struct client_command));
            if(mdebug)
                printf("Master sending signaled death to child async !!\n");
            master_send(master_send_async_sockets[i],child_idents[i].child_name, &cc,sizeof(struct client_command));
        }
            
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cleanup_comm ( )

Definition at line 22690 of file iozone.c.

{
    int i;
    for(i=0;i<num_child;i++)
    {
            close(master_send_sockets[i]);
            close(master_send_async_sockets[i]);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int close ( )
void close_xls ( )

Here is the caller graph for this function:

static double cpu_util ( ) [static]

Here is the caller graph for this function:

static double cpu_util ( double  cputime,
double  walltime 
) [static]

Definition at line 19347 of file iozone.c.

{
    double cpu;

    if (walltime <= (double)0.0)
    {
        cpu = (double)0.0;
        return cpu;
    }
    if (cputime <= (double)0.0)
        cputime = 0.0;
    if (walltime <= (double)0.0)
        cpu = (double)100.0;
    else {
        cpu = (((double)100.0 * cputime) / walltime);
        /*
        if (cpu > (double)100.0)
            cpu = (double)99.99;
        */
    }
    return cpu;
}
void create_list ( )
void create_temp ( )
int create_xls ( )

Here is the caller graph for this function:

void del_record_sizes ( )

Definition at line 20128 of file iozone.c.

{
        struct size_entry *size_listp;
        struct size_entry *save_item;

        size_listp=rec_size_list;
        if(rec_size_list)
        {
                while(size_listp!=0)
                {
                        save_item=size_listp->next;
                        free(size_listp);
                        size_listp=save_item;
                }
        }
        rec_size_list=0;
}

Here is the caller graph for this function:

void disrupt ( )

Here is the caller graph for this function:

void disrupt ( int  fd)

Definition at line 19502 of file iozone.c.

{
    char *nbuff,*free_addr;
    off64_t current;

    free_addr=nbuff=(char *)malloc((size_t)page_size+page_size);
    nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));

    /* Save current position */
    current = I_LSEEK(fd,0,SEEK_CUR);

    /* Move to beginning of file */
    I_LSEEK(fd,0,SEEK_SET);

    /* Read a little of the file */
    if(direct_flag)
        junk=read(fd,nbuff,page_size);
    else
        junk=read(fd,nbuff,1);

    /* Skip into the file */
    I_LSEEK(fd,page_size,SEEK_SET);

    /* Read a little of the file */
    if(direct_flag)
        junk=read(fd,nbuff,page_size);
    else
        junk=read(fd,nbuff,1);

    /* Restore current position in file, before disruption */
    I_LSEEK(fd,current,SEEK_SET);
    free(free_addr);
    
}

Here is the call graph for this function:

void distribute_stop ( )

Definition at line 22564 of file iozone.c.

{
    int i;
    struct client_command cc;

    /*
     * Only send one stop to the clients. Each client will
     * send stop to the master, but the master only needs
     * to distribute the first stop. Without this, the 
     * master may distribute too many stops and overflow
     * the socket buffer on the client.
     */
    if(sent_stop)
    {
        if(mdebug)
        {
          s_count++;
          printf("Master not send stop %d\n",s_count);
        }
        return;
    }
    bzero(&cc,sizeof(struct client_command));
    cc.c_command = R_STOP_FLAG;
    cc.c_stop_flag = 1;
    for(i=0;i<num_child;i++)
    {
        cc.c_client_number = (int)i; 
        if(mdebug)
            printf("Master distributing stop flag to child %d\n",i);
        master_send(master_send_async_sockets[i],child_idents[i].child_name, &cc,sizeof(struct client_command));
    }
    sent_stop=1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

float do_compute ( )

Here is the caller graph for this function:

float do_compute ( float  comp_delay)

Definition at line 19474 of file iozone.c.

{
    double starttime,tmptime;
    if(comp_delay == (float)0.0)
        return(0.0);
    starttime=time_so_far();
    while(1)
    {   
        tmptime=time_so_far()-starttime;
        if(tmptime >= (double)comp_delay)
            return(tmptime);
    }
    return(0.0);
}

Here is the call graph for this function:

void do_float ( )

Here is the caller graph for this function:

void do_label ( )

Here is the caller graph for this function:

void do_speed_check ( )

Here is the caller graph for this function:

void do_speed_check ( int  client_flag)

Definition at line 23531 of file iozone.c.

{
    int i;
    if(client_flag)
    {
        speed_main(" "," ",reclen,kilobytes64,client_flag);
    }
    else
    {
        printf("Checking %d clients\n",clients_found);
        for(i=0;i<clients_found;i++)
        {
            speed_main(child_idents[i].child_name,
                child_idents[i].execute_path,
                reclen, kilobytes64,client_flag);
        }
    }
}

Here is the call graph for this function:

void dump_cputimes ( void  )

Definition at line 11880 of file iozone.c.

{
    bif_row++;
    bif_column = 0;

    if ((!include_tflag) || (include_mask & (long long)WRITER_MASK)) {
    if(bif_flag)
        do_label(bif_fd, "Writer CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
    if(!silent) printf("\n%cWriter CPU utilization report (Zero values should be ignored)%c\n",'"','"');
    dump_times(2); 
    if(bif_flag)
        do_label(bif_fd, "Re-writer CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
    if(!silent) printf("\n%cRe-writer CPU utilization report (Zero values should be ignored)%c\n",'"','"');
    dump_times(3); 
    }

    if ((!include_tflag) || (include_mask & (long long)READER_MASK)) {
    if(bif_flag)
        do_label(bif_fd, "Reader CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
    if(!silent) printf("\n%cReader CPU utilization report (Zero values should be ignored)%c\n",'"','"');
    dump_times(4); 
    if(bif_flag)
        do_label(bif_fd, "Re-reader CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
    if(!silent) printf("\n%cRe-Reader CPU utilization report (Zero values should be ignored)%c\n",'"','"');
    dump_times(5); 
    }

    if ((!include_tflag) || (include_mask & (long long)RANDOM_RW_MASK)) {
        if(bif_flag)
            do_label(bif_fd, "Random Read CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
        if(!silent) printf("\n%cRandom read CPU utilization report (Zero values should be ignored)%c\n",'"','"');
        dump_times(6); 
        if(bif_flag)
            do_label(bif_fd, "Random Write CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
        if(!silent) printf("\n%cRandom write CPU utilization report (Zero values should be ignored)%c\n",'"','"');
        dump_times(7); 
    }

    if ((!include_tflag) || (include_mask & (long long)REVERSE_MASK)) {
        if(bif_flag)
            do_label(bif_fd, "Backward Read CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
        if(!silent) printf("\n%cBackward read CPU utilization report (Zero values should be ignored)%c\n",'"','"');
        dump_times(8); 
    }

    if ((!include_tflag) || (include_mask & (long long)REWRITE_REC_MASK)) {
        if(bif_flag)
            do_label(bif_fd, "Record Rewrite CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
        if(!silent) printf("\n%cRecord rewrite CPU utilization report (Zero values should be ignored)%c\n",'"','"');
        dump_times(9); 
    }

    if ((!include_tflag) || (include_mask & (long long)STRIDE_READ_MASK)) {
        if(bif_flag)
            do_label(bif_fd, "Stride Read CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
        if(!silent) printf("\n%cStride read CPU utilization report (Zero values should be ignored)%c\n",'"','"');
        dump_times(10); 
    }

    if ((!include_tflag) || (include_mask & (long long)FWRITER_MASK)) {
        if(bif_flag)
            do_label(bif_fd, "Fwrite CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
        if(!silent) printf("\n%cFwrite CPU utilization report (Zero values should be ignored)%c\n",'"','"');
        dump_times(11); 
        if(bif_flag)
            do_label(bif_fd, "Re-fwrite CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
        if(!silent) printf("\n%cRe-Fwrite CPU utilization report (Zero values should be ignored)%c\n",'"','"');
        dump_times(12); 
    }

    if ((!include_tflag) || (include_mask & (long long)FREADER_MASK)) {
        if(bif_flag)
            do_label(bif_fd, "Fread CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
        if(!silent) printf("\n%cFread CPU utilization report (Zero values should be ignored)%c\n",'"','"');
        dump_times(13); 
        if(bif_flag)
            do_label(bif_fd, "Re-fread CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
        if(!silent) printf("\n%cRe-Fread CPU utilization report (Zero values should be ignored)%c\n",'"','"');
        dump_times(14); 
    }

#ifdef HAVE_PREAD
    if(Eflag)
    {
        if ((!include_tflag) || (include_mask & (long long)PWRITER_MASK)) {
            if(bif_flag)
                do_label(bif_fd, "Pwrite CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
            if(!silent) printf("\n%cPwrite CPU utilization report (Zero values should be ignored)%c\n",'"','"');
            dump_times(15); 
            if(bif_flag)
                do_label(bif_fd, "Re-pwrite CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
            if(!silent) printf("\n%cRe-Pwrite CPU utilization report (Zero values should be ignored)%c\n",'"','"');
            dump_times(16); 
        }

        if ((!include_tflag) || (include_mask & (long long)PREADER_MASK)) {
            if(bif_flag)
                do_label(bif_fd, "Pread CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
            if(!silent) printf("\n%cPread CPU utilization report (Zero values should be ignored)%c\n",'"','"');
            dump_times(17); 
            if(bif_flag)
                do_label(bif_fd, "Re-pread CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
            if(!silent) printf("\n%cRe-Pread CPU utilization report (Zero values should be ignored)%c\n",'"','"');
            dump_times(18); 
        }

#ifdef HAVE_PREADV
        if ((!include_tflag) || (include_mask & (long long)PWRITEV_MASK)) {
            if(bif_flag)
                do_label(bif_fd, "Pwritev CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
            if(!silent) printf("\n%cPwritev CPU utilization report (Zero values should be ignored)%c\n",'"','"');
            dump_times(19); 
            if(bif_flag)
                do_label(bif_fd, "Re-pwritev CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
            if(!silent) printf("\n%cRe-Pwritev CPU utilization report (Zero values should be ignored)%c\n",'"','"');
            dump_times(20); 
        }

        if ((!include_tflag) || (include_mask & (long long)PREADV_MASK)) {
            if(bif_flag)
                do_label(bif_fd, "Preadv CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
            if(!silent) printf("\n%cPreadv CPU utilization report (Zero values should be ignored)%c\n",'"','"');
            dump_times(21); 
            if(bif_flag)
                do_label(bif_fd, "Re-preadv CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
            if(!silent) printf("\n%cRe-Preadv CPU utilization report (Zero values should be ignored)%c\n",'"','"');
            dump_times(22); 
        }
#endif
    }
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void dump_excel ( )

Definition at line 11653 of file iozone.c.

{
    if(bif_flag)
    {
        bif_fd=create_xls(bif_filename);
        do_label(bif_fd,command_line,bif_row++,bif_column);
        do_label(bif_fd," ",bif_row++,bif_column);
                do_label(bif_fd,"The top row is records sizes, the left column is file sizes",bif_row++,bif_column);
    }
    if(!silent) printf("Excel output is below:\n");

    if ((!include_tflag) || (include_mask & (long long)WRITER_MASK)) {
    if(bif_flag)
        do_label(bif_fd,"Writer Report",bif_row++,bif_column);
    if(!silent) printf("\n%cWriter report%c\n",'"','"');
    dump_report(2); 
    if(bif_flag)
        do_label(bif_fd,"Re-writer Report",bif_row++,bif_column);
    if(!silent) printf("\n%cRe-writer report%c\n",'"','"');
    dump_report(3); 
    }

    if ((!include_tflag) || (include_mask & (long long)READER_MASK)) {
    if(bif_flag)
        do_label(bif_fd,"Reader Report",bif_row++,bif_column);
    if(!silent) printf("\n%cReader report%c\n",'"','"');
    dump_report(4); 
    if(bif_flag)
        do_label(bif_fd,"Re-reader Report",bif_row++,bif_column);
    if(!silent) printf("\n%cRe-Reader report%c\n",'"','"');
    dump_report(5); 
    }

    if ((!include_tflag) || (include_mask & (long long)RANDOM_RW_MASK)) {
        if(bif_flag)
            do_label(bif_fd,"Random Read Report",bif_row++,bif_column);
        if(!silent) printf("\n%cRandom read report%c\n",'"','"');
        dump_report(6); 
        if(bif_flag)
            do_label(bif_fd,"Random Write Report",bif_row++,bif_column);
        if(!silent) printf("\n%cRandom write report%c\n",'"','"');
        dump_report(7); 
    }

    if ((!include_tflag) || (include_mask & (long long)REVERSE_MASK)) {
        if(bif_flag)
            do_label(bif_fd,"Backward Read Report",bif_row++,bif_column);
        if(!silent) printf("\n%cBackward read report%c\n",'"','"');
        dump_report(8); 
    }

    if ((!include_tflag) || (include_mask & (long long)REWRITE_REC_MASK)) {
        if(bif_flag)
            do_label(bif_fd,"Record Rewrite Report",bif_row++,bif_column);
        if(!silent) printf("\n%cRecord rewrite report%c\n",'"','"');
        dump_report(9); 
    }

    if ((!include_tflag) || (include_mask & (long long)STRIDE_READ_MASK)) {
        if(bif_flag)
            do_label(bif_fd,"Stride Read Report",bif_row++,bif_column);
        if(!silent) printf("\n%cStride read report%c\n",'"','"');
        dump_report(10); 
    }

    if ((!include_tflag) || (include_mask & (long long)FWRITER_MASK)) {
        if(bif_flag)
            do_label(bif_fd,"Fwrite Report",bif_row++,bif_column);
        if(!silent) printf("\n%cFwrite report%c\n",'"','"');
        dump_report(11); 
        if(bif_flag)
            do_label(bif_fd,"Re-fwrite Report",bif_row++,bif_column);
        if(!silent) printf("\n%cRe-Fwrite report%c\n",'"','"');
        dump_report(12); 
    }

    if ((!include_tflag) || (include_mask & (long long)FREADER_MASK)) {
        if(bif_flag)
            do_label(bif_fd,"Fread Report",bif_row++,bif_column);
        if(!silent) printf("\n%cFread report%c\n",'"','"');
        dump_report(13); 
        if(bif_flag)
            do_label(bif_fd,"Re-fread Report",bif_row++,bif_column);
        if(!silent) printf("\n%cRe-Fread report%c\n",'"','"');
        dump_report(14); 
    }

#ifdef HAVE_PREAD
    if(Eflag)
    {
        if ((!include_tflag) || (include_mask & (long long)PWRITER_MASK)) {
            if(bif_flag)
                do_label(bif_fd,"Pwrite Report",bif_row++,bif_column);
            if(!silent) printf("\n%cPwrite report%c\n",'"','"');
            dump_report(15); 
            if(bif_flag)
                do_label(bif_fd,"Re-pwrite Report",bif_row++,bif_column);
            if(!silent) printf("\n%cRe-Pwrite report%c\n",'"','"');
            dump_report(16); 
        }

        if ((!include_tflag) || (include_mask & (long long)PREADER_MASK)) {
            if(bif_flag)
                do_label(bif_fd,"Pread Report",bif_row++,bif_column);
            if(!silent) printf("\n%cPread report%c\n",'"','"');
            dump_report(17); 
            if(bif_flag)
                do_label(bif_fd,"Re-pread Report",bif_row++,bif_column);
            if(!silent) printf("\n%cRe-Pread report%c\n",'"','"');
            dump_report(18); 
        }

#ifdef HAVE_PREADV
        if ((!include_tflag) || (include_mask & (long long)PWRITEV_MASK)) {
            if(bif_flag)
                do_label(bif_fd,"Pwritev Report",bif_row++,bif_column);
            if(!silent) printf("\n%cPwritev report%c\n",'"','"');
            dump_report(19); 
            if(bif_flag)
                do_label(bif_fd,"Re-pwritev Report",bif_row++,bif_column);
            if(!silent) printf("\n%cRe-Pwritev report%c\n",'"','"');
            dump_report(20); 
        }

        if ((!include_tflag) || (include_mask & (long long)PREADV_MASK)) {
            if(bif_flag)
                do_label(bif_fd,"Preadv Report",bif_row++,bif_column);
            if(!silent) printf("\n%cPreadv report%c\n",'"','"');
            dump_report(21); 
            if(bif_flag)
                do_label(bif_fd,"Re-preadv Report",bif_row++,bif_column);
            if(!silent) printf("\n%cRe-Preadv report%c\n",'"','"');
            dump_report(22); 
        }
#endif
    }
#endif
    if (cpuutilflag)
        dump_cputimes();
    if(bif_flag)
        close_xls(bif_fd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void dump_hist ( )

Here is the caller graph for this function:

void dump_hist ( char *  what,
int  id 
)

Definition at line 24284 of file iozone.c.

{
   FILE *fp;

   char name[256];
 
   sprintf(name,"%s_child_%d.txt","Iozone_histogram",id);

   fp = fopen(name,"a");

#ifndef NO_PRINT_LLD
   fprintf(fp,"Child: %d Op: %s\n",id,what);
   fprintf(fp,"Band 1:   ");
   fprintf(fp," 20us:%-7.1lld ",buckets[0]);
   fprintf(fp," 40us:%-7.1lld ",buckets[1]);
   fprintf(fp," 60us:%-7.1lld ",buckets[2]);
   fprintf(fp," 80us:%-7.1lld ",buckets[3]);
   fprintf(fp,"100us:%-7.1lld \n",buckets[4]);

   fprintf(fp,"Band 2:   ");
   fprintf(fp,"200us:%-7.1lld ",buckets[5]);
   fprintf(fp,"400us:%-7.1lld ",buckets[6]);
   fprintf(fp,"600us:%-7.1lld ",buckets[7]);
   fprintf(fp,"800us:%-7.1lld ",buckets[8]);
   fprintf(fp,"  1ms:%-7.1lld \n",buckets[9]);

   fprintf(fp,"Band 3:   ");
   fprintf(fp,"  2ms:%-7.1lld ",buckets[10]);
   fprintf(fp,"  4ms:%-7.1lld ",buckets[11]);
   fprintf(fp,"  6ms:%-7.1lld ",buckets[12]);
   fprintf(fp,"  8ms:%-7.1lld ",buckets[13]);
   fprintf(fp," 10ms:%-7.1lld \n",buckets[14]);

   fprintf(fp,"Band 4:   ");
   fprintf(fp," 12ms:%-7.1lld ",buckets[15]);
   fprintf(fp," 14ms:%-7.1lld ",buckets[16]);
   fprintf(fp," 16ms:%-7.1lld ",buckets[17]);
   fprintf(fp," 18ms:%-7.1lld ",buckets[18]);
   fprintf(fp," 20ms:%-7.1lld \n",buckets[19]);

   fprintf(fp,"Band 5:   ");
   fprintf(fp," 40ms:%-7.1lld ",buckets[20]);
   fprintf(fp," 60ms:%-7.1lld ",buckets[21]);
   fprintf(fp," 80ms:%-7.1lld ",buckets[22]);
   fprintf(fp,"100ms:%-7.1lld \n",buckets[23]);

   fprintf(fp,"Band 6:   ");
   fprintf(fp,"200ms:%-7.1lld ",buckets[24]);
   fprintf(fp,"400ms:%-7.1lld ",buckets[25]);
   fprintf(fp,"600ms:%-7.1lld ",buckets[26]);
   fprintf(fp,"800ms:%-7.1lld ",buckets[27]);
   fprintf(fp,"   1s:%-7.1lld \n",buckets[28]);

   fprintf(fp,"Band 7:   ");
   fprintf(fp,"   2s:%-7.1lld ",buckets[29]);
   fprintf(fp,"   4s:%-7.1lld ",buckets[30]);
   fprintf(fp,"   6s:%-7.1lld ",buckets[31]);
   fprintf(fp,"   8s:%-7.1lld ",buckets[32]);
   fprintf(fp,"  10s:%-7.1lld \n",buckets[33]);

   fprintf(fp,"Band 8:   ");
   fprintf(fp,"  20s:%-7.1lld ",buckets[34]);
   fprintf(fp,"  40s:%-7.1lld ",buckets[35]);
   fprintf(fp,"  60s:%-7.1lld ",buckets[36]);
   fprintf(fp,"  80s:%-7.1lld ",buckets[37]);
   fprintf(fp," 120s:%-7.1lld \n",buckets[38]);

   fprintf(fp,"Band 9:   ");
   fprintf(fp,"120+s:%-7.1lld \n\n",buckets[39]);
#else
   fprintf(fp,"Child: %d Op: %s\n",id,what);
   fprintf(fp,"Band 1:   ");
   fprintf(fp," 20us:%-7.1ld ",buckets[0]);
   fprintf(fp," 40us:%-7.1ld ",buckets[1]);
   fprintf(fp," 60us:%-7.1ld ",buckets[2]);
   fprintf(fp," 80us:%-7.1ld ",buckets[3]);
   fprintf(fp,"100us:%-7.1ld \n",buckets[4]);

   fprintf(fp,"Band 2:   ");
   fprintf(fp,"200us:%-7.1ld ",buckets[5]);
   fprintf(fp,"400us:%-7.1ld ",buckets[6]);
   fprintf(fp,"600us:%-7.1ld ",buckets[7]);
   fprintf(fp,"800us:%-7.1ld ",buckets[8]);
   fprintf(fp,"  1ms:%-7.1ld \n",buckets[9]);

   fprintf(fp,"Band 3:   ");
   fprintf(fp,"  2ms:%-7.1ld ",buckets[10]);
   fprintf(fp,"  4ms:%-7.1ld ",buckets[11]);
   fprintf(fp,"  6ms:%-7.1ld ",buckets[12]);
   fprintf(fp,"  8ms:%-7.1ld ",buckets[13]);
   fprintf(fp," 10ms:%-7.1ld \n",buckets[14]);

   fprintf(fp,"Band 4:   ");
   fprintf(fp," 12ms:%-7.1ld ",buckets[15]);
   fprintf(fp," 14ms:%-7.1ld ",buckets[16]);
   fprintf(fp," 16ms:%-7.1ld ",buckets[17]);
   fprintf(fp," 18ms:%-7.1ld ",buckets[18]);
   fprintf(fp," 20ms:%-7.1ld \n",buckets[19]);

   fprintf(fp,"Band 5:   ");
   fprintf(fp," 40ms:%-7.1ld ",buckets[20]);
   fprintf(fp," 60ms:%-7.1ld ",buckets[21]);
   fprintf(fp," 80ms:%-7.1ld ",buckets[22]);
   fprintf(fp,"100ms:%-7.1ld \n",buckets[23]);

   fprintf(fp,"Band 6:   ");
   fprintf(fp,"200ms:%-7.1ld ",buckets[24]);
   fprintf(fp,"400ms:%-7.1ld ",buckets[25]);
   fprintf(fp,"600ms:%-7.1ld ",buckets[26]);
   fprintf(fp,"800ms:%-7.1ld ",buckets[27]);
   fprintf(fp,"   1s:%-7.1ld \n",buckets[28]);

   fprintf(fp,"Band 7:   ");
   fprintf(fp,"   2s:%-7.1ld ",buckets[29]);
   fprintf(fp,"   4s:%-7.1ld ",buckets[30]);
   fprintf(fp,"   6s:%-7.1ld ",buckets[31]);
   fprintf(fp,"   8s:%-7.1ld ",buckets[32]);
   fprintf(fp,"  10s:%-7.1ld \n",buckets[33]);

   fprintf(fp,"Band 8:   ");
   fprintf(fp,"  20s:%-7.1ld ",buckets[34]);
   fprintf(fp,"  40s:%-7.1ld ",buckets[35]);
   fprintf(fp,"  60s:%-7.1ld ",buckets[36]);
   fprintf(fp,"  80s:%-7.1ld ",buckets[37]);
   fprintf(fp," 120s:%-7.1ld \n",buckets[38]);

   fprintf(fp,"Band 9:   ");
   fprintf(fp,"120+s:%-7.1ld \n\n",buckets[39]);
#endif
   fclose(fp);
}
dump_report ( long long  who)

Definition at line 11567 of file iozone.c.

{
    long long i;
    off64_t current_file_size;
    off64_t rec_size;

    if(bif_flag)
        bif_column++;
    if(!silent) printf("      ");

    /* 
     * Need to reconstruct the record size list
     * as the crossover in -a changed the list.
    */
    del_record_sizes();
    init_record_sizes(orig_min_rec_size, orig_max_rec_size);

    for(rec_size=get_next_record_size(0); rec_size <= orig_max_rec_size;
        rec_size=get_next_record_size(rec_size))
    {
        if (rec_size == 0) break;
        if(bif_flag)
            do_float(bif_fd,(double)(rec_size/1024),bif_row,bif_column++);
#ifdef NO_PRINT_LLD
        if(!silent) printf("  %c%ld%c",'"',rec_size/1024,'"');
#else
        if(!silent) printf("  %c%lld%c",'"',rec_size/1024,'"');
#endif
    }
    if(!silent) printf("\n");
    if(bif_flag)
    {
        bif_column=0;
        bif_row++;
    }

    current_file_size = report_array[0][0];
    if(bif_flag)
    {
        do_float(bif_fd,(double)(current_file_size),bif_row,bif_column++);
    }
#ifdef NO_PRINT_LLD
    if(!silent) printf("%c%ld%c  ",'"',current_file_size,'"');
#else
    if(!silent) printf("%c%lld%c  ",'"',current_file_size,'"');
#endif
    for(i=0;i<=max_y;i++){
        if(report_array[0][i] != current_file_size){
            if(!silent) printf("\n");
            current_file_size = report_array[0][i];
            if(bif_flag)
            {
                bif_row++;
                bif_column=0;
                do_float(bif_fd,(double)(current_file_size),bif_row,bif_column++);
            }
#ifdef NO_PRINT_LLD
            if(!silent) printf("%c%ld%c  ",'"',current_file_size,'"');
#else
            if(!silent) printf("%c%lld%c  ",'"',current_file_size,'"');
#endif
        }
        if(bif_flag)
            do_float(bif_fd,(double)(report_array[who][i]),bif_row,bif_column++);
#ifdef NO_PRINT_LLD
        if(!silent) printf(" %ld ",report_array[who][i]);
#else
        if(!silent) printf(" %lld ",report_array[who][i]);
#endif
    }
    if(bif_flag)
    {
        bif_row++;
        bif_column=0;
    }
    if(!silent) printf("\n");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void dump_throughput ( )

Definition at line 18694 of file iozone.c.

{
    long long x,y,i,j;
    char *port;
    char *label;
    char print_str[300];
    x=max_x;
    y=max_y;

    if(use_thread)
        port="threads";
    else
        port="processes";
    if(!silent) printf("\n\"Throughput report Y-axis is type of test X-axis is number of %s\"\n",port);
    if(bif_flag)
    {
        bif_fd=create_xls(bif_filename);
        do_label(bif_fd,command_line,bif_row++,bif_column);
        sprintf(print_str,"Throughput report Y-axis is type of test X-axis is number of %s",port);
        do_label(bif_fd,print_str,bif_row++,bif_column);
    }
    if(OPS_flag)
        label="ops/sec";
    else
    if(MS_flag)
        label="microseconds/op";
    else
        label="Kbytes/sec";
#ifdef NO_PRINT_LLD
    if(!silent) printf("\"Record size = %ld Kbytes \"\n",reclen/1024);
#else
    if(!silent) printf("\"Record size = %lld Kbytes \"\n",reclen/1024);
#endif
    if(!silent) printf("\"Output is in %s\"\n\n",label);
    if(bif_flag)
    {
#ifdef NO_PRINT_LLD
        sprintf(print_str,"Record size = %ld Kbytes",reclen/1024);
#else
        sprintf(print_str,"Record size = %lld Kbytes",reclen/1024);
#endif
        do_label(bif_fd,print_str,bif_row++,bif_column);
        sprintf(print_str,"Output is in %s",label);
        do_label(bif_fd,print_str,bif_row++,bif_column);
    }
    for(i=0;i<=toutputindex;i++)
    {
           if(!silent) printf("\"%15s \"",toutput[i]);
           if(bif_flag)
           {
               sprintf(print_str,"%15s ",toutput[i]);
               do_label(bif_fd,print_str,bif_row,bif_column++);
               bif_column++;
           }
           for(j=0;j<=y;j++)
           {
               if(bif_flag)
               {
                   do_float(bif_fd,(double)report_darray[i][j],bif_row,bif_column++);
               }
               if(!silent) printf(" %10.2f ",report_darray[i][j]);
           }
           if(!silent) printf("\n\n");
           if(bif_flag)
           {
               bif_column=0;
               bif_row++;
           }
    }
    if (cpuutilflag)
        dump_throughput_cpu();
    if(bif_flag)
        close_xls(bif_fd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 18625 of file iozone.c.

{
    long long x,y,i,j;
    char *port;
    char *label;
    char print_str[300];
    x=max_x;
    y=max_y;

    port = use_thread ? "threads" : "processes";
    printf("\n\"CPU utilization report Y-axis is type of test X-axis is number of %s\"\n",port);
    if (bif_flag)
    {
        sprintf(print_str, "CPU utilization report Y-axis is type of test X-axis is number of %s", port);
        do_label(bif_fd, print_str, bif_row++, bif_column);
    }
    label = OPS_flag ?  "ops/sec" :
        MS_flag ? "microseconds/op" : "Kbytes/sec";
#ifdef NO_PRINT_LLD
    if(!silent) printf("\"Record size = %ld Kbytes \"\n", reclen/1024);
#else
    if(!silent) printf("\"Record size = %lld Kbytes \"\n", reclen/1024);
#endif
    if(!silent) printf("\"Output is in CPU%%\"\n\n");
    if (bif_flag)
    {
#ifdef NO_PRINT_LLD
        sprintf(print_str, "Record size = %ld Kbytes", reclen/1024);
#else
        sprintf(print_str, "Record size = %lld Kbytes", reclen/1024);
#endif
        do_label(bif_fd, print_str, bif_row++, bif_column);
        sprintf(print_str, "Output is in CPU%%");
        do_label(bif_fd, print_str, bif_row++, bif_column);
    }
    for (i = 0; i < x; i++)
    {
        if(!silent) printf("\"%15s \"", throughput_tests[i]);
        if (bif_flag)
        {
            sprintf(print_str, "%15s ", throughput_tests[i]);
            do_label(bif_fd, print_str, bif_row, bif_column++);
            bif_column++;
        }
        for (j = 0; j <= y; j++)
        {
            if (bif_flag)
                do_float(bif_fd, runtimes[i][j].cpuutil, bif_row, bif_column++);
            if(!silent) printf(" %10.2f ", runtimes[i][j].cpuutil);
        }
        if(!silent) printf("\n\n");
        if (bif_flag)
        {
            bif_column=0;
            bif_row++;
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

dump_times ( long long  who)

Definition at line 11804 of file iozone.c.

{
    long long i;
    off64_t current_file_size;
    off64_t rec_size;

    if (bif_flag)
        bif_column++;
    if(!silent) printf("      ");

    for (rec_size = get_next_record_size(0); rec_size <= orig_max_rec_size;
        rec_size = get_next_record_size(rec_size))
    {
        if (rec_size == 0) break;
        if (bif_flag)
            do_float(bif_fd, (double)(rec_size/1024), bif_row, bif_column++);
#ifdef NO_PRINT_LLD
        if(!silent) printf("  %c%ld%c",'"',rec_size/1024,'"');
#else
        if(!silent) printf("  %c%lld%c",'"',rec_size/1024,'"');
#endif
    }
    if(!silent) printf("\n");
    if (bif_flag)
    {
        bif_column=0;
        bif_row++;
    }

    current_file_size = report_array[0][0];
    if (bif_flag)
    {
        do_float(bif_fd, (double)(current_file_size), bif_row, bif_column++);
    }
#ifdef NO_PRINT_LLD
    if(!silent) printf("%c%ld%c  ",'"',current_file_size,'"');
#else
    if(!silent) printf("%c%lld%c  ",'"',current_file_size,'"');
#endif
    for (i = 0; i <= max_y; i++) {
        if (report_array[0][i] != current_file_size) {
            if(!silent) printf("\n");
            current_file_size = report_array[0][i];
            if (bif_flag)
            {
                bif_row++;
                bif_column=0;
                do_float(bif_fd, (double)(current_file_size), bif_row, bif_column++);
            }
#ifdef NO_PRINT_LLD
            if(!silent) printf("%c%ld%c  ",'"',current_file_size,'"');
#else
            if(!silent) printf("%c%lld%c  ",'"',current_file_size,'"');
#endif
        }
        if (bif_flag)
            do_float(bif_fd, (double)(runtimes [who][i].cpuutil), bif_row, bif_column++);
        if(!silent) printf(" %6.2f", runtimes [who][i].cpuutil);
    }
    if(!silent) printf("\n");
    if (bif_flag)
    {
        bif_row++;
        bif_column=0;
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void exit ( )
void fetchit ( )

Here is the caller graph for this function:

void fetchit ( char *  buffer,
long long  length 
)

Definition at line 6909 of file iozone.c.

{
    char *where;
    volatile long long x[4];
    long long i;
    where=(char *)buffer;
    for(i=0;i<(length/cache_line_size);i++)
    {
        x[(i & 3)]=*(where);
        where+=cache_line_size;
        
    }
}
fill_area ( long long *  src_buffer,
long long *  dest_buffer,
long long  length 
)

Definition at line 19014 of file iozone.c.

{
    /*printf("Fill area %d\n",(size_t)length);*/
    bcopy((void *)src_buffer,(void *)dest_buffer,(size_t)length);
}

Here is the caller graph for this function:

void fill_buffer ( )

Here is the caller graph for this function:

void fill_buffer ( char *  buffer,
long long  length,
long long  pattern,
char  sverify,
long long  recnum 
)

Definition at line 7115 of file iozone.c.

{
    unsigned long long *where;
    long long i,j,xx2;
    long long mpattern;
    unsigned int seed;
    unsigned long x;
    unsigned long long value,value1;
    unsigned long long a = 0x01020304;
    unsigned long long b = 0x05060708;
    unsigned long long c = 0x01010101;
    unsigned long long d = 0x01010101;

    value = (a << 32) | b;
    value1 = (c << 32) | d;

    xx2=chid;
    if(share_file)
        xx2=(long long)0;
    x=0;
    mpattern=pattern;
    /* printf("Fill: Sverify %d verify %d diag_v %d\n",sverify,verify,diag_v);*/
    if(dedup)
    {
        gen_new_buf((char *)dedup_ibuf,(char *)buffer, (long)recnum, (int)length,(int)dedup, (int) dedup_interior, dedup_compress, 1);
        return;
    }
    if(diag_v)
    {
        /*if(client_iozone)
            base_time=0;
        */
        if(no_unlink)
            base_time=0;
        seed= (unsigned int)(base_time+xx2+recnum);
            srand(seed);
        mpattern=(long long)rand();
        mpattern=(mpattern<<48) | (mpattern<<32) | (mpattern<<16) | mpattern;
        mpattern=mpattern+value;
    }
    where=(unsigned long long *)buffer;
    if(sverify == 1)
    {
        for(i=0;i<(length);i+=page_size)
        {
            *where = (long long)((pattern<<32) | pattern);
            where+=(page_size/sizeof(long long)); 
            /* printf("Filling page %lld \n",i/page_size);*/
        }   
    }
    else
    {
        for(i=0;i<(length/cache_line_size);i++)
        {
            for(j=0;j<(cache_line_size/sizeof(long long));j++)
            {
                if(diag_v)
                {
                    *where = (long long)(mpattern);
                    mpattern=mpattern+value1;
                }
                else
                    *where = (long long)((pattern<<32) | pattern);
                where++;
            }   
        }
    }
}

Here is the call graph for this function:

void find_external_mon ( char *  imon_start,
char*  imon_stop 
)

Definition at line 22729 of file iozone.c.

{
    char *start,*stop,*sync;
    imon_start[0]=(char)0;
    imon_stop[0]=(char)0;
    start=(char *)getenv("IMON_START");
    if(start)
    {
        strcpy(imon_start,start);
    }
    stop=(char *)getenv("IMON_STOP");
    if(stop)
    {
        strcpy(imon_stop,stop);
    }
    sync=(char *)getenv("IMON_SYNC");
    if(sync)
    {
        imon_sync=1;
    }

    return;
}   

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

void find_remote_shell ( char *  shell)

Definition at line 22706 of file iozone.c.

{
    char *value;
    value=(char *)getenv("RSH");
    if(value)
    {
        strcpy(shell,value);
        return;
    }
#ifdef _HPUX_SOURCE
    strcpy(shell,"remsh");
#else
    strcpy(shell,"rsh");
#endif
    return;
}   

Here is the call graph for this function:

void fread_perf_test ( )
void fread_perf_test ( off64_t  kilo64,
long long  reclen,
long long *  data1,
long long*  data2 
)

Definition at line 8083 of file iozone.c.

{
    double starttime2;
    double readtime[2];
    double walltime[2], cputime[2];
    double compute_val = (double)0;
    long long j;
    off64_t i,numrecs64;
    long long Index = 0;
    unsigned long long readrate[2];
    off64_t filebytes64;
    FILE *stream = 0;
    char *stdio_buf;
    int fd,ltest;

    if(mmapflag || async_flag)
        return;
    numrecs64 = (kilo64*1024)/reclen;
    filebytes64 = numrecs64*reclen;
    stdio_buf=(char *)malloc((size_t)reclen);

    if(noretest)
        ltest=1;
    else
        ltest=2;

    for( j=0; j<ltest; j++ )
    {
        if(cpuutilflag)
        {
            walltime[j] = time_so_far();
            cputime[j]  = cputime_so_far();
        }

        if(Uflag) /* Unmount and re-mount the mountpoint */
        {
            purge_buffer_cache();
        }
#ifdef IRIX64
        if((stream=(FILE *)fopen(filename,"r")) == 0)
        {
            printf("\nCan not fdopen temp file: %s\n", 
                filename);
            perror("fdopen");
            exit(51);
        }
#else
        if((stream=(FILE *)I_FOPEN(filename,"r")) == 0)
        {
            printf("\nCan not fdopen temp file: %s\n", 
                filename);
            perror("fdopen");
            exit(52);
        }
#endif
        fd=I_OPEN(filename,O_RDONLY,0);
        fsync(fd);
        close(fd);
        setvbuf(stream,stdio_buf,_IOFBF,reclen);
        buffer=mainbuffer;
        if(fetchon)
            fetchit(buffer,reclen);
        compute_val=(double)0;
        starttime2 = time_so_far();
        for(i=0; i<numrecs64; i++) 
        {
            if(compute_flag)
                compute_val+=do_compute(compute_time);
                        if(multi_buffer)
                        {
                                Index +=reclen;
                                if(Index > (MAXBUFFERSIZE-reclen))
                                        Index=0;
                                buffer = mbuffer + Index;
                        }
            if(purge)
                purgeit(buffer,reclen);
            if(fread(buffer, (size_t) reclen,1, stream) != 1)
            {
#ifdef _64BIT_ARCH_
#ifdef NO_PRINT_LLD
                printf("\nError freading block %lu %lx\n", i,
                    (unsigned long long)buffer);
#else
                printf("\nError freading block %llu %llx\n", i,
                    (unsigned long long)buffer);
#endif
#else
#ifdef NO_PRINT_LLD
                printf("\nError freading block %lu %lx\n", i,
                    (long)buffer);
#else
                printf("\nError freading block %llu %lx\n", i,
                    (long)buffer);
#endif
#endif
                perror("read");
                exit(54);
            }
            if(verify){
                if(verify_buffer(buffer,reclen,(off64_t)i,reclen,(long long)pattern,sverify)){
                    exit(55);
                }
            }
        }
        if(include_flush)
            fflush(stream);
        if(include_close)
        {
            fclose(stream);
        }
        readtime[j] = ((time_so_far() - starttime2)-time_res)
            -compute_val;
        if(readtime[j] < (double).000001) 
        {
            readtime[j]= time_res;
            if(rec_prob < reclen)
                rec_prob = reclen;
            res_prob=1;
        }
        if(!include_close)
        {
            fflush(stream);
            fclose(stream);
        }
        stream = NULL;
        if(cpuutilflag)
        {
            cputime[j]  = cputime_so_far() - cputime[j];
            if (cputime[j] < cputime_res)
                cputime[j] = 0.0;
            walltime[j] = time_so_far() - walltime[j];
            if (walltime[j] < cputime[j])
               walltime[j] = cputime[j];
        }
        if(restf)
            sleep((int)rest_val);
        }
    free(stdio_buf);
    if(OPS_flag || MS_flag){
       filebytes64=filebytes64/reclen;
    }
        for(j=0;j<ltest;j++)
        {
        if(MS_flag)
        {
            readrate[j]=1000000.0*(readtime[j] / (double)filebytes64);
            continue;
        }
            else
            {
                  readrate[j] = 
                  (unsigned long long) ((double) filebytes64 / readtime[j]);
            }
        if(!(OPS_flag || MS_flag))
            readrate[j] >>= 10;
    }
    data1[0]=readrate[0];
    data2[0]=1;
    if(noretest)
    {
        readrate[1]=(long long)0;
        if(cpuutilflag)
        {
            walltime[1]=0.0;
            cputime[1]=0.0;
        }
    }
    /* Must save walltime & cputime before calling store_value() for each/any cell.*/
    if(cpuutilflag)
        store_times(walltime[0], cputime[0]);
    store_value((off64_t)readrate[0]);
    if(cpuutilflag)
        store_times(walltime[1], cputime[1]);
    store_value((off64_t)readrate[1]);
#ifdef NO_PRINT_LLD
    if(!silent) printf("%8ld",readrate[0]);
    if(!silent) printf("%9ld",readrate[1]);
    if(!silent) fflush(stdout);
#else
    if(!silent) printf("%8lld",readrate[0]);
    if(!silent) printf("%9lld",readrate[1]);
    if(!silent) fflush(stdout);
#endif
}

Here is the call graph for this function:

int fsync ( )

Here is the caller graph for this function:

void fwrite_perf_test ( )
void fwrite_perf_test ( off64_t  kilo64,
long long  reclen,
long long *  data1,
long long *  data2 
)

Definition at line 7859 of file iozone.c.

{
    double starttime1;
    double writetime[2];
    double walltime[2], cputime[2];
    double compute_val = (double)0;
    long long i,j;
    off64_t numrecs64;
    long long Index = 0;
    unsigned long long writerate[2];
    off64_t filebytes64;
    FILE *stream = NULL;
    int fd;
    int wval;
    int ltest;
    char *how;
    char *stdio_buf;

    if(mmapflag || async_flag)
        return;
    numrecs64 = (kilo64*1024)/reclen;
    filebytes64 = numrecs64*reclen;
    stdio_buf=(char *)malloc((size_t)reclen);
    if(noretest)
        ltest=1;
    else
        ltest=2;

    for( j=0; j<ltest; j++)
    {
        if(cpuutilflag)
        {
            walltime[j] = time_so_far();
            cputime[j]  = cputime_so_far();
        }
        if(Uflag) /* Unmount and re-mount the mountpoint */
        {
            purge_buffer_cache();
        }
        if(j==0)
        {
            if(check_filename(filename))
                how="r+"; /* file exists, don't create and zero a new one. */
            else
                how="w+"; /* file doesn't exist. create it. */
        }
        else
            how="r+"; /* re-tests should error out if file does not exist. */
#ifdef IRIX64
        if((stream=(FILE *)fopen(filename,how)) == 0)
        {
            printf("\nCan not fdopen temp file: %s %lld\n", 
                filename,errno);
            perror("fdopen");
            exit(48);
        }
#else
        if((stream=(FILE *)I_FOPEN(filename,how)) == 0)
        {
#ifdef NO_PRINT_LLD
            printf("\nCan not fdopen temp file: %s %d\n", 
                filename,errno);
#else
            printf("\nCan not fdopen temp file: %s %d\n", 
                filename,errno);
#endif
            perror("fdopen");
            exit(49);
        }
#endif
        fd=fileno(stream);
        fsync(fd);
        setvbuf(stream,stdio_buf,_IOFBF,reclen);
        buffer=mainbuffer;
        if(fetchon)
            fetchit(buffer,reclen);
        if(verify || dedup || dedup_interior)
            fill_buffer(buffer,reclen,(long long)pattern,sverify,(long long)0);
        starttime1 = time_so_far();
        compute_val=(double)0;
        for(i=0; i<numrecs64; i++){
            if(compute_flag)
                compute_val+=do_compute(compute_time);
            if(multi_buffer)
            {
                Index +=reclen;
                if(Index > (MAXBUFFERSIZE-reclen))
                    Index=0;
                buffer = mbuffer + Index;   
            }
            if((verify & diag_v) || dedup || dedup_interior)
                fill_buffer(buffer,reclen,(long long)pattern,sverify,i);
            if(purge)
                purgeit(buffer,reclen);
            if(fwrite(buffer, (size_t) reclen, 1, stream) != 1)
            {
#ifdef NO_PRINT_LLD
                    printf("\nError fwriting block %ld, fd= %d\n", i,
                     fd);
#else
                    printf("\nError fwriting block %lld, fd= %d\n", i,
                     fd);
#endif
                perror("fwrite");
                signal_handler();
            }
        }

        if(include_flush)
        {
            fflush(stream);
            wval=fsync(fd);
            if(wval==-1){
                perror("fsync");
                signal_handler();
            }
        }
        if(include_close)
        {
            wval=fclose(stream);
            if(wval==-1){
                perror("fclose");
                signal_handler();
            }
        }
        writetime[j] = ((time_so_far() - starttime1)-time_res)
            -compute_val;
        if(writetime[j] < (double).000001) 
        {
            writetime[j]= time_res;
            if(rec_prob < reclen)
                rec_prob = reclen;
            res_prob=1;
        }
        if(!include_close)
        {
            wval=fflush(stream);
            if(wval==-1){
                perror("fflush");
                signal_handler();
            }
            wval=fsync(fd);
            if(wval==-1){
                perror("fsync");
                signal_handler();
            }
            wval=fclose(stream);
            if(wval==-1){
                perror("fclose");
                signal_handler();
            }
        }

        if(cpuutilflag)
        {
            cputime[j]  = cputime_so_far() - cputime[j];
            if (cputime[j] < cputime_res)
                cputime[j] = 0.0;
            walltime[j] = time_so_far() - walltime[j];
            if (walltime[j] < cputime[j])
               walltime[j] = cputime[j];
        }
        if(restf)
            sleep((int)(int)rest_val);
    }
    free(stdio_buf);
    if(OPS_flag || MS_flag){
       filebytes64=filebytes64/reclen;
    }
        for(j=0;j<ltest;j++)
        {
        if(MS_flag)
        {
            writerate[j]=1000000.0*(writetime[j] / (double)filebytes64);
            continue;
        }
            else
            {
                  writerate[j] = 
              (unsigned long long) ((double) filebytes64 / writetime[j]);
            }
        if(!(OPS_flag || MS_flag))
            writerate[j] >>= 10;
    }
    /* Must save walltime & cputime before calling store_value() for each/any cell.*/
    if(noretest)
    {
        writerate[1]=(long long)0;
        if(cpuutilflag)
        {
            walltime[1]=0.0;
            cputime[1]=0.0;
        }
    }
    if(cpuutilflag)
        store_times(walltime[0], cputime[0]);
    store_value((off64_t)writerate[0]);
    if(cpuutilflag)
        store_times(walltime[1], cputime[1]);
    store_value((off64_t)writerate[1]);
    data1[0]=writerate[0];
#ifdef NO_PRINT_LLD
    if(!silent) printf("%9ld",writerate[0]);
    if(!silent) printf("%9ld",writerate[1]);
    if(!silent) fflush(stdout);
#else
    if(!silent) printf("%9lld",writerate[0]);
    if(!silent) printf("%9lld",writerate[1]);
    if(!silent) fflush(stdout);
#endif
}

Here is the call graph for this function:

int gen_new_buf ( )

Here is the caller graph for this function:

int gen_new_buf ( char *  ibuf,
char *  obuf,
long  seed,
int  size,
int  percent,
int  percent_interior,
int  percent_compress,
int  all 
)

Definition at line 23731 of file iozone.c.

{
    register long *ip, *op; /* Register for speed   */
    register long iseed;    /* Register for speed   */
    register long isize;    /* Register for speed   */
    register long cseed;    /* seed for dedupable for within & ! across */
    register int x,w;   /* Register for speed   */
    register int value;     /* Register for speed   */
    register int interior_size;     /* size of interior dedup region */
    register int compress_size;     /* size of compression dedup region */
    if(ibuf == NULL)    /* no input buf     */
        return(-1);
    if(obuf == NULL)    /* no output buf    */
        return(-1);
    if((percent > 100) || (percent < 0)) /* percent check */
        return(-1);
    if(size == 0)       /* size check       */
        return(-1);
    srand(seed+1+(((int)numrecs64)*dedup_mseed)); /* set random seed */
    iseed = rand();     /* generate random value */
    isize = (size * percent)/100; /* percent that is dedupable */
    interior_size = ((isize * percent_interior)/100);/* /sizeof(long) */
    compress_size =((interior_size * percent_compress)/100);
    ip = (long *)ibuf;  /* pointer to input buf */
    op = (long *)obuf;  /* pointer to output buf */
    if(all == 0)        /* Special case for verify only */
        isize = sizeof(long);
    /* interior_size = dedup_within + dedup_across */
    for(w=0;w<interior_size;w+=sizeof(long))    
    {
        *op=0xdeadbeef+dedup_mseed;
        *ip=0xdeadbeef+dedup_mseed;
        op++;
        ip++;
    }   
    /* Prepare for dedup within but not across */
    w=interior_size - compress_size;
    op=(long *)&obuf[w];
    ip=(long *)&ibuf[w];
    srand(chid+1+dedup_mseed);            /* set randdom seed   */
    cseed = rand();     /* generate random value */
    for(w=(interior_size-compress_size);w<interior_size;w+=sizeof(long))    
    {
        *op=*ip ^ cseed; /* do the xor op */
        op++;
        ip++;
    }   
    /* isize = dedup across only */
    for(x=interior_size;x<isize;x+=sizeof(long))    /* tight loop for transformation */
    {
        *op=*ip ^ iseed; /* do the xor op */
        op++;
        ip++;
    }   
    if(all == 0)        /* Special case for verify only */
        return(0);
    /* make the rest of the buffer non-dedupable */
    if(100-percent > 0)
    {
        srand(1+seed+((chid+1)*(int)numrecs64)*dedup_mseed);
        value=rand();
/* printf("Non-dedup value %x seed %x\n",value,seed);*/
        for( ; x<size;x+=sizeof(long))
            *op++=(*ip++)^value; /* randomize the remainder */
    }
    return(0);
}

Here is the call graph for this function:

long long genrand64_int63 ( void  )

Definition at line 23960 of file iozone.c.

{
    return (long long)(genrand64_int64() >> 1);
}

Here is the call graph for this function:

unsigned long long genrand64_int64 ( void  )

Definition at line 23922 of file iozone.c.

{
    int i;
    unsigned long long x;
    static unsigned long long mag01[2]={0ULL, MATRIX_A};

    if (mti >= NN) { /* generate NN words at one time */

        /* if init_genrand64() has not been called, */
        /* a default initial seed is used     */
        if (mti == NN+1) 
            init_genrand64(5489ULL); 

        for (i=0;i<NN-MM;i++) {
            x = (mt[i]&UM)|(mt[i+1]&LM);
            mt[i] = mt[i+MM] ^ (x>>1) ^ mag01[(int)(x&1ULL)];
        }
        for (;i<NN-1;i++) {
            x = (mt[i]&UM)|(mt[i+1]&LM);
            mt[i] = mt[i+(MM-NN)] ^ (x>>1) ^ mag01[(int)(x&1ULL)];
        }
        x = (mt[NN-1]&UM)|(mt[0]&LM);
        mt[NN-1] = mt[MM-1] ^ (x>>1) ^ mag01[(int)(x&1ULL)];

        mti = 0;
    }
  
    x = mt[mti++];

    x ^= (x >> 29) & 0x5555555555555555ULL;
    x ^= (x << 17) & 0x71D67FFFEDA60000ULL;
    x ^= (x << 37) & 0xFFF7EEE000000000ULL;
    x ^= (x >> 43);

    return x;
}

Here is the call graph for this function:

Here is the caller graph for this function:

double genrand64_real1 ( void  )

Definition at line 23966 of file iozone.c.

{
    return (genrand64_int64() >> 11) * (1.0/9007199254740991.0);
}

Here is the call graph for this function:

double genrand64_real2 ( void  )

Definition at line 23972 of file iozone.c.

{
    return (genrand64_int64() >> 11) * (1.0/9007199254740992.0);
}

Here is the call graph for this function:

double genrand64_real3 ( void  )

Definition at line 23978 of file iozone.c.

{
    return ((genrand64_int64() >> 12) + 0.5) * (1.0/4503599627370496.0);
}

Here is the call graph for this function:

int get_client_info ( )

Definition at line 22417 of file iozone.c.

{
    FILE *fd;
    char *ret1;
    int count;
    char buffer[200];
    count=0;
    fd=fopen(client_filename,"r");
    if(fd == (FILE *)NULL)
    {
        printf("Unable to open client file \"%s\"\n",
            client_filename);
        exit(176);
    }
    while(1)
    {
            if (count > MAXSTREAMS) {                                                                           
                  printf("Too many lines in client file - max of %d supported\n",
            MAXSTREAMS);
                  exit(7);
            }
        ret1=fgets(buffer,200,fd);
        if(ret1== (char *)NULL)
            break;
        count+=parse_client_line(buffer,count);
    }
    fclose(fd);
    return(count);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void get_date ( )

Here is the caller graph for this function:

get_date ( char *  where)

Definition at line 23556 of file iozone.c.

{
    time_t t;
    char *value;
    t=time(0);
    value=(char *)ctime(&t);
    strcpy(where,value);
}

Here is the caller graph for this function:

Definition at line 20070 of file iozone.c.

{
    struct size_entry *size_listp;
    
    size_listp=size_list;
    
    for( ; size_listp ; size_listp=size_listp->next )
    {
        if(size_listp->size > size)
            return(size_listp->size);
    }
    return((off64_t)0);
}

Here is the caller graph for this function:

Definition at line 20193 of file iozone.c.

{
    struct size_entry *size_listp;
    
    size_listp=rec_size_list;
    
    for( ; size_listp ; size_listp=size_listp->next )
    {
        if(size_listp->size > size)
            return(size_listp->size);
    }
    return((off64_t)0);
}
get_pattern ( void  )

Definition at line 23584 of file iozone.c.

{
        int i,x,y;
        char cp[100],*ptr;
        int pat;
    unsigned char inp_pat;
    unsigned int temp;

        y=0;
        ptr=&cp[0];
        strcpy(cp,THISVERSION);
        x=strlen(THISVERSION);
        for(i=0;i<x;i++)
                y+=*ptr++;
        srand(y);
        pat=(rand()& 0xff);
    /* For compatibility with old 0xa5 data sets. */
    if(Z_flag)
        pat=0xa5;
    /* Lock pattern to 0xBB, for filesystem short circuit debug */
    if(X_flag)
        pat=PATTERN1;
    /* Set global pattern */
    inp_pat = pat;
    temp =((inp_pat << 24) | (inp_pat << 16) | (inp_pat << 8) | inp_pat);
        return(pat);
}

Here is the call graph for this function:

void get_resolution ( )

Definition at line 19131 of file iozone.c.

{
        double starttime, finishtime, besttime = 0;
        long  j,delay;
    int k;

        finishtime=time_so_far1(); /* Warm up the instruction cache */
        starttime=time_so_far1();  /* Warm up the instruction cache */
        delay=j=0;                 /* Warm up the data cache */
    for(k=0;k<10;k++)
    {
            while(1)
            {
                    starttime=time_so_far1();
                    for(j=0;j< delay;j++)
                        ;
                    finishtime=time_so_far1();
                    if(starttime==finishtime)
                            delay++;
                    else
            {
                if(k==0)
                    besttime=(finishtime-starttime);
                if((finishtime-starttime) < besttime)
                    besttime=(finishtime-starttime);
                            break;
            }
        }
        }
    time_res=besttime/1000000.0;    
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 19174 of file iozone.c.

{
    double starttime, finishtime;
    long  j;

    finishtime=cputime_so_far(); /* Warm up the instruction cache */
    starttime=cputime_so_far();  /* Warm up the instruction cache */
    delay=j=0;         /* Warm up the data cache */
    while(1)
    {
        starttime=cputime_so_far();
        for(j=0;j< delay;j++)
            ;
        finishtime=cputime_so_far();
        if(starttime==finishtime)
            
            delay++;
        else
            break;
    }
    cputime_res = (finishtime-starttime);    /* in seconds */
}

Here is the caller graph for this function:

long long get_traj ( )

Here is the caller graph for this function:

long long get_traj ( FILE *  traj_fd,
long long *  traj_size,
float *  delay,
long  which 
)

Definition at line 19596 of file iozone.c.

{
    long long traj_offset = 0;
    long long tmp2 = 0;
    int tmp = 0;
    int tokens;
    int ret=0;
    char *ret1,*where;
    char buf[200];
    char sbuf[200];
    int got_line;
    
    got_line=0;

    while(got_line==0)
    {
        tokens=0;
        ret1=fgets(buf,200,traj_fd);
        if(ret1==(char *)0)
        {
            printf("\n\n\tEarly end of telemetry file. Results not accurate.\n");
            signal_handler();
        }
        where=(char *)&buf[0];
        strcpy(sbuf,buf);
        if((*where=='#') || (*where=='\n'))
            continue;
        tokens++;
        strtok(where," ");
        while( (char *)(strtok( (char *)0," ")) != (char *)0)
        {
            tokens++;
        }
        got_line=1;
    }
    if(tokens == 3)
    {
#ifdef NO_PRINT_LLD
        ret=sscanf(sbuf,"%ld %ld %d\n",&traj_offset,&tmp2,&tmp);
#else
        ret=sscanf(sbuf,"%lld %lld %d\n",&traj_offset,&tmp2,&tmp);
#endif
    /*printf("\nReading %s trajectory with %d items\n",which?"write":"read",tokens);*/
        *traj_size=tmp2;
        *delay= ((float)tmp/1000);
    }
    if(tokens == 2)
    { 
#ifdef NO_PRINT_LLD
        ret=sscanf(sbuf,"%ld %ld\n",&traj_offset,traj_size);
#else
        ret=sscanf(sbuf,"%lld %lld\n",&traj_offset,traj_size);
#endif
        *delay=compute_time;
    /*printf("\nReading %s trajectory with %d items\n",which?"write":"read",tokens);*/
    }
    if((tokens != 2) && (tokens !=3))
    {
        printf("\n\tInvalid entry in telemetry file. > %s <\n",sbuf);
        exit(178);
    }
    if(ret==EOF)
    {
        printf("\n\n\tEarly end of telemetry file. Results not accurate.\n");
        signal_handler();
    }
#ifdef DEBUG
#ifdef NO_PRINT_LLD
    if(!silent) printf("\nOffset %lld  Size %ld Compute delay %f\n",traj_offset, *traj_size,*delay);
#else
    if(!silent) printf("\nOffset %lld  Size %lld Compute delay %f\n",traj_offset, *traj_size,*delay);
#endif
#endif
    return(traj_offset);
}

Here is the call graph for this function:

char* getenv ( )

Here is the caller graph for this function:

void hist_insert ( )

Here is the caller graph for this function:

void hist_insert ( double  my_value)

Definition at line 24255 of file iozone.c.

{
    int k;
    long long value;
    
    /* Convert to micro-seconds */
    value = (long long)(my_value * 1000000);
    for(k=0;k<BUCKETS;k++)
    {
       if(k < (BUCKETS-1)) 
       {
         if(value <= bucket_val[k])
         {
        buckets[k]++;
        break;
         }
       }
       else
       {
         if(value > bucket_val[k])
         {
        buckets[k]++;
        break;
         }
       }
    }
}
char* inet_ntoa ( )

Here is the caller graph for this function:

void init_by_array64 ( unsigned long long *  ,
unsigned long  long 
)

Here is the caller graph for this function:

void init_by_array64 ( unsigned long long  init_key[],
unsigned long long  key_length 
)

Definition at line 23897 of file iozone.c.

{
    unsigned long long i, j, k;
    init_genrand64(19650218ULL);
    i=1; j=0;
    k = (NN>key_length ? NN : key_length);
    for (; k; k--) {
        mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 62)) * 3935559000370003845ULL))
          + init_key[j] + j; /* non linear */
        i++; j++;
        if (i>=NN) { mt[0] = mt[NN-1]; i=1; }
        if (j>=key_length) j=0;
    }
    for (k=NN-1; k; k--) {
        mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 62)) * 2862933555777941757ULL))
          - i; /* non linear */
        i++;
        if (i>=NN) { mt[0] = mt[NN-1]; i=1; }
    }

    mt[0] = 1ULL << 63; /* MSB is 1; assuring non-zero initial array */ 
}

Here is the call graph for this function:

void init_file_sizes ( )

Here is the caller graph for this function:

void init_file_sizes ( off64_t  min_f_size,
off64_t  max_f_size 
)

Definition at line 20000 of file iozone.c.

{
        off64_t kilosi;
    int x;
    if(s_count > 1)
    {
            for(x=0; x < s_count; x++)
        {
            kilosi=s_range[x];
            add_file_size((off64_t)kilosi);
        }
    }
    else
    {
            for(kilosi=min_f_size;kilosi<=max_f_size;kilosi*=multiplier)
        {
            add_file_size((off64_t)kilosi);
        }
    }
}

Here is the call graph for this function:

void init_genrand64 ( unsigned long long  seed)

Definition at line 23887 of file iozone.c.

{
    mt[0] = seed;
    for (mti=1; mti<NN; mti++) 
        mt[mti] =  (6364136223846793005ULL * (mt[mti-1] ^ (mt[mti-1] >> 62)) + mti);
}

Here is the caller graph for this function:

Here is the caller graph for this function:

void init_record_sizes ( off64_t  min_r_size,
off64_t  max_r_size 
)

Definition at line 20099 of file iozone.c.

{
    int x;
        off64_t size;
    if(r_count > 1)
    {
            for(x=0; x < r_count; x++)
        {
            size=r_range[x];
            add_record_size((off64_t)size);
        }
    }
    else
    {
            for(size=min_r_size;size<=max_r_size;size*=multiplier)
        {
            add_record_size((off64_t)size);
        }
    }
}

Here is the call graph for this function:

char* initfile ( )

Here is the caller graph for this function:

char* initfile ( int  fd,
off64_t  filebytes,
int  flag,
int  prot 
)

Definition at line 18810 of file iozone.c.

{
     char *pa;
     int mflags=0;
     long long x;
     char *tmp,*stmp;
     int file_flags;
     long long recs;
     long long i;
     int dflag = 0;

     if(flag)
     {

#ifdef _HPUX_SOURCE
        /* 
         * Save time, just have the operating system prealloc 
         * the file 
         */
        prealloc(fd,filebytes);
#else
        /* 
          * Allocate a temporary buffer to meet any alignment 
          * contraints of any method.
          */
         tmp=(char *)malloc((size_t)reclen * 2);
         stmp=tmp;
         /* 
          * Align to a reclen boundary.
          */
         tmp = (char *)((((long)tmp + (long)reclen))& ~(((long)reclen-1)));
        /* 
         * Special case.. Open O_DIRECT, and going to be mmap() 
         * Under Linux, one can not create a sparse file using 
         * a file that is opened with O_DIRECT 
         */
        file_flags=fcntl(fd,F_GETFL);

#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
        dflag = O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        dflag = O_DIRECTIO;
#endif
#endif
        if((file_flags & dflag) !=0)
        {
            recs=filebytes/reclen;
            for (i =0; i<recs ;i++)
            {
                x=write(fd,tmp,(size_t)reclen);
                if(x < 1)
                {
                    printf("Unable to write file\n");
                    exit(182);
                }
            }
        }
        else
        {
            /* Save time, just seek out and touch at the end */
            I_LSEEK(fd,(filebytes-reclen),SEEK_SET);
            x=write(fd,tmp,(size_t)reclen);
            if(x < 1)
            {
                printf("Unable to write file\n");
                exit(181);
            }
        }
        free(stmp);
        I_LSEEK(fd,0,SEEK_SET);
#endif
     }

#ifdef IRIX64
    if((prot & PROT_WRITE)==PROT_WRITE)
        mflags=MAP_SHARED;
    else
        mflags=MAP_PRIVATE;
#else
#ifdef IRIX
    if((prot & PROT_WRITE)==PROT_WRITE)
        mflags=MAP_SHARED;
    else
        mflags=MAP_PRIVATE;
#else
    if((prot & PROT_WRITE)==PROT_WRITE)
        mflags=MAP_FILE|MAP_SHARED;
    else
        mflags=MAP_FILE|MAP_PRIVATE;
#endif
#endif

#if defined(bsd4_2) && !defined(macosx)
     pa = (char *)mmap( 0,&filebytes, (int)prot, 
            (int)mflags, (int)fd, 0);
#else
     pa = (char *)I_MMAP( ((char *)0),filebytes, prot, 
            mflags, fd, 0);
#endif
#ifdef __convex_spp
    if(pa == (char *)-1)
    {
        printf("\nMmap failed, errno %d Flags %x\n",errno,(int)mflags);
        exit(165);
    }
#else
#ifdef linux
    if(pa == (char *)-1)
    {
        printf("Mapping failed, errno %d\n",errno);
        exit(166);
    }
#else
#ifdef bsd4_2
    if(pa == (char *)-1)
    {
        printf("Mapping failed, errno %d\n",errno);
        exit(167);
    }
#else
    if(pa == (char *)MAP_FAILED)
    {
        printf("\nMapping failed, errno %d Flags = %x\n",errno,mflags);
        exit(168);
    }
#endif
#endif
#endif
#ifndef NO_MADVISE
    if(advise_flag)
    {
        switch(advise_op){
        case 0:
            madvise( (char *)pa, (size_t) filebytes, MADV_NORMAL);
            break;
        case 1: 
            madvise( (char *)pa, (size_t) filebytes, MADV_RANDOM);
            break;
        case 2: 
            madvise( (char *)pa, (size_t) filebytes, MADV_SEQUENTIAL);
            break;
        case 3: 
            madvise( (char *)pa, (size_t) filebytes, MADV_DONTNEED);
            break;
        case 4: 
            madvise( (char *)pa, (size_t) filebytes, MADV_WILLNEED);
            break;
        default: 
            break;
        };
    }
    
#endif
    return(pa);

}

Here is the call graph for this function:

void Kill ( )

Here is the caller graph for this function:

void Kill ( long long  pid,
long long  sig 
)

Definition at line 12195 of file iozone.c.

{
    if(!xflag)
    {
        /*printf("Killing %d\n",pid);*/
        kill((pid_t)pid,(int)sig);
    }
}

Here is the call graph for this function:

long long l_max ( )

Here is the caller graph for this function:

long long l_max ( long long  one,
long long  two 
)

Definition at line 12179 of file iozone.c.

{
    if(one > two)
        return(one);
    else
        return(two);
}
long long l_min ( )

Here is the caller graph for this function:

long long l_min ( long long  num1,
long long  num2 
)

Definition at line 12212 of file iozone.c.

{
    if(num1 >= num2)
        return num2;
    else
        return num1;
}
long lrand48 ( )

Here is the caller graph for this function:

int main ( )

Definition at line 3 of file burn.c.

{
    do_stuff(  );
    exit( 0 );
}

Here is the call graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 1608 of file iozone.c.

{

    long long fileindx,i,tval;
    long long ind;
    int ret;
    FILE *pi;
    char reply[IBUFSIZE];
    unsigned char inp_pat;
    time_t time_run;
    char *port,*m,*subarg;
    int num_child1;
    int cret;
    int anwser,bind_cpu;
    char *evalue;


    anwser=bind_cpu=0;
    /* Used to make fread/fwrite do something better than their defaults */
    setvbuf( stdout, NULL, _IONBF, (size_t) NULL );
    setvbuf( stderr, NULL, _IONBF, (size_t) NULL );
    
    /* Save the master's name */
    gethostname(controlling_host_name,100);

    /* Let user activate mdebug or cdebug via environmental variables */
    evalue = (char *)NULL;
    evalue=(char *)getenv("CDEBUG");
    if(evalue)
        cdebug=atoi(evalue);
    evalue = (char *)NULL;
    evalue=(char *)getenv("MDEBUG");
    if(evalue)
        mdebug=atoi(evalue);

    srand(time(0));
    mygen=rand(); /* Pick a random generation number */

    /* Try to find the actual VM page size, if possible */
#if defined (solaris) || defined (_HPUX_SOURCE) || defined (linux) || defined(IRIX) || defined (IRIX64)
#ifndef __convex_spp
    page_size=getpagesize();
#endif
#endif
    /* Try to find the actual number of ticks per second */
#ifdef unix
    sc_clk_tck = clk_tck();
#endif
    for(ind=0;ind<MAXSTREAMS;ind++)
        filearray[ind]=(char *)tfile;

    /* base_time=(long)time_so_far(); */
    myid=(long long)getpid();   /* save the master's PID */
    /* get_resolution();         Get clock resolution */
    time_run = time(0);     /* Start a timer */
    (void)find_external_mon(imon_start, imon_stop);

    /*
     * Save the splash screen for later display. When in distributed network
     * mode this output does not get displayed on the clients.
     */
    sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n");
        sprintf(splash[splash_line++],"\t%s\n\t%s\n", THISVERSION,MODE);
        sprintf(splash[splash_line++],"\t\tBuild: %s \n\n",build_name);
        sprintf(splash[splash_line++],"\tContributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins\n");
    sprintf(splash[splash_line++],"\t             Al Slater, Scott Rhine, Mike Wisner, Ken Goss\n");
        sprintf(splash[splash_line++],"\t             Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,\n");
        sprintf(splash[splash_line++],"\t             Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,\n");
        sprintf(splash[splash_line++],"\t             Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,\n");
        sprintf(splash[splash_line++],"\t             Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,\n");
        sprintf(splash[splash_line++],"\t             Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer.\n");
        sprintf(splash[splash_line++],"\t             Ben England.\n\n");
    sprintf(splash[splash_line++],"\tRun began: %s\n",ctime(&time_run));
    argcsave=argc;
    argvsave=argv;

        signal(SIGINT, signal_handler);     /* handle user interrupt */
        signal(SIGTERM, signal_handler);    /* handle kill from shell */

        /********************************************************/
        /* Allocate and align buffer with beginning of the  */
        /* on chip data cache.                  */
        /********************************************************/

        buffer = (char *) alloc_mem((long long)(MAXBUFFERSIZE + (2 * cache_size)),(int)0);
    if(buffer == 0) {
            perror("Memory allocation failed:");
            exit(1);
        }

#ifdef _64BIT_ARCH_
        buffer = (char *) ((long long )(buffer + cache_size ) & 
        ~(cache_size-1));
#else
        buffer = (char *) ((long)(buffer + cache_size ) & 
        ~((long)cache_size-1));
#endif
    mainbuffer = buffer;

    /* de-dup input buf */
        buffer1 = (char *) alloc_mem((long long)(MAXBUFFERSIZE + (2 * cache_size)),(int)0);
    if(buffer1 == 0) {
            perror("Memory allocation failed:");
            exit(1);
        }

#ifdef _64BIT_ARCH_
        buffer1 = (char *) ((long long )(buffer1 + cache_size ) & 
        ~(cache_size-1));
#else
        buffer1 = (char *) ((long)(buffer1 + cache_size ) & 
        ~((long)cache_size-1));
#endif
    dedup_ibuf = buffer1;
    touch_dedup(buffer1, MAXBUFFERSIZE);

#ifdef FOOB
    /* de-dup temp buf */
        buffer1 = (char *) alloc_mem((long long)(MAXBUFFERSIZE + (2 * cache_size)),(int)0);
    if(buffer1 == 0) {
            perror("Memory allocation failed:");
            exit(1);
        }

#ifdef _64BIT_ARCH_
        buffer1 = (char *) ((long long )(buffer1 + cache_size ) & 
        ~(cache_size-1));
#else
        buffer1 = (char *) ((long)(buffer1 + cache_size ) & 
        ~((long)cache_size-1));
#endif
#endif
    dedup_temp = mainbuffer;

    fetchon++;  /* By default, prefetch the CPU cache lines associated with the buffer */
    strcpy(filename,default_filename);  /* Init default filename */
    sprintf(dummyfile[0],"%s.DUMMY",default_filename);
    if(argc <=1){
        printf(USAGE);
        exit(255);
    }
    auto_mode = 0;      /* Default is to disable auto mode */
    inp_pat = PATTERN;  /* Init default pattern for verification */
    /* Fill the entire pattern variable with the same character */
    pattern = ((inp_pat << 24) | (inp_pat << 16) | (inp_pat << 8) | inp_pat);

    /*
     * Parse all of the options that the user specified.
     */
    while((cret = getopt(argc,argv,"ZQNIBDGCTOMREWovAxamwphcezKJ:j:k:V:r:t:s:f:F:d:l:u:U:S:L:H:+:P:i:b:X:Y:g:n:y:q: ")) != EOF){
        switch(cret){
        case 'k':   /* Async I/O with no bcopys */
            depth = (long long)(atoi(optarg));
            if(depth <0)
                depth=0;
            /*
            if(depth > 60)
                depth=60;
            */
#ifdef NO_PRINT_LLD
            sprintf(splash[splash_line++],"\tPOSIX Async I/O (no bcopy). Depth %ld \n",depth);
#else
            sprintf(splash[splash_line++],"\tPOSIX Async I/O (no bcopy). Depth %lld \n",depth);
#endif
            no_copy_flag=1;
            async_flag++;
            k_flag++;
            break;
        case 'T':   /* Switch to POSIX thread based */
#ifndef NO_THREADS
            use_thread++;
#else
            printf("\tThreads not supported in this version\n");
            exit(2);
#endif
            break;
        case 'H':   /* Use POSIX async_io */
            h_flag++;
            depth = (long long)(atoi(optarg));
            if(depth <0)
                depth=0;
            /*
             * Hmmm. many systems fail is strange ways when the maximum
             * number of async I/Os per user or proc is exceeded.
             */
            /*
            if(depth > 60)
                depth=60;
            */
#ifdef NO_PRINT_LLD
            sprintf(splash[splash_line++],"\tPOSIX async I/O (with bcopy). Depth %ld\n",depth);
#else
            sprintf(splash[splash_line++],"\tPOSIX async I/O (with bcopy). Depth %lld\n",depth);
#endif
            async_flag++;
            break;
        case 'I':   /* Use VXFS direct advisory or O_DIRECT from Linux or AIX , or O_DIRECTIO for TRU64  or Solaris directio */
#ifdef VXFS
            direct_flag++;
            sprintf(splash[splash_line++],"\tVxFS advanced feature SET_CACHE, VX_DIRECT enabled\n");
            break;
#endif
#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined(__FreeBSD__) || defined(solaris)
            direct_flag++;
            sprintf(splash[splash_line++],"\tO_DIRECT feature enabled\n");
            break;
#endif
#if defined(TRU64)
            direct_flag++;
            sprintf(splash[splash_line++],"\tO_DIRECTIO feature enabled\n");
            break;
#endif
#else
            break;
#endif
#if defined(Windows)
            sprintf(splash[splash_line++],"\tO_DIRECTIO feature not available in Windows version.\n");
            break;
#endif
        case 'B':   /* Use mmap file for test file */
            sprintf(splash[splash_line++],"\tUsing mmap files\n");
            mmapflag++;
            mmapnsflag++;
            break;
        case 'D':   /* Use async msync mmap file */
            sprintf(splash[splash_line++],"\tUsing msync(MS_ASYNC) on mmap files\n");
            mmapflag++;
            mmapasflag++;
            mmapnsflag=0;
            break;
        case 'G':   /* Use msync sync for mmap file */
            sprintf(splash[splash_line++],"\tUsing msync(MS_SYNC) on mmap files\n");
            mmapssflag++;
            mmapnsflag=0;
            break;
        case 'C':   /* show children xfer counts */
            Cflag++;
            break;
        case 'Q':   /* Enable output offset/latency files */
                sprintf(splash[splash_line++],"\tOffset/latency files enabled.\n");
            Q_flag++;
            break;
        case 'x':   /* Disable stone_wall */
                sprintf(splash[splash_line++],"\tStonewall disabled\n");
            xflag++;
            break;

        case 'a':   /* auto mode */
            fetchon=1;
            purge=0;
            multi_buffer=0;
                auto_mode = 1;
            aflag++;
                sprintf(splash[splash_line++],"\tAuto Mode\n");
            break;
        case 'c':   /* Include close in timing */
            include_close++;
                sprintf(splash[splash_line++],"\tInclude close in write timing\n");
            break;
        case 'e':   /* Include fsync in timing */
            include_flush++;
                sprintf(splash[splash_line++],"\tInclude fsync in write timing\n");
            break;
        case 'A':   /* auto2 mode. Soon to go away. Please use -az */
            fetchon=1;
            purge=0;
            multi_buffer=0;
                auto_mode = 1;
            aflag++;
                sprintf(splash[splash_line++],"\tAuto Mode 2. This option is obsolete. Use -az -i0 -i1 \n");
            RWONLYflag++;
            NOCROSSflag++;
            include_tflag++;    /* automatically set WRITER_TEST and READER_TEST */
            include_test[WRITER_TEST]++;
            include_test[READER_TEST]++;
            break;
        case 's':   /* Set file size */
#ifdef NO_PRINT_LLD
            sscanf(optarg,"%ld",&kilobytes64);
#else
            sscanf(optarg,"%lld",&kilobytes64);
#endif
            if(optarg[strlen(optarg)-1]=='k' ||
                optarg[strlen(optarg)-1]=='K'){
                ;
            }
            if(optarg[strlen(optarg)-1]=='m' ||
                optarg[strlen(optarg)-1]=='M'){
                kilobytes64 = kilobytes64 * 1024;
            }
            if(optarg[strlen(optarg)-1]=='g' ||
                optarg[strlen(optarg)-1]=='G'){
                kilobytes64 = kilobytes64 *1024 * 1024;
            }
            if(kilobytes64 <= 0)
                kilobytes64=512;

            s_range[s_count++]=kilobytes64;
            max_file_size = (off64_t)s_range[s_count-1];   /* Make visable globally */
            min_file_size = (off64_t)s_range[0];   /* Make visable globally */

#ifdef NO_PRINT_LLD
                sprintf(splash[splash_line++],"\tFile size set to %ld KB\n",kilobytes64);
#else
                sprintf(splash[splash_line++],"\tFile size set to %lld KB\n",kilobytes64);
#endif
            sflag++;
            break;
        case 'l':   /* Set lower thread/proc limit  */
            mint = (long long)(atoi(optarg));
            if(mint <= 0)
            {
                mint=1;
                num_child=1;
            }else
                num_child=mint;
            if(mint > (unsigned long long)MAXSTREAMS){
              printf("Invalid options: maximum streams for ");
              printf("throughput is MAXSTREAMS\n");
              exit(4);
            }
            lflag++;
            trflag++;
            if(Uflag)
            {
                printf("Can not run throughput tests with unmount & remounts.\n");
                exit(5);
            }
            break;
        case 'u':   /* Set upper thread/proc limit  */
            maxt = (long long)(atoi(optarg));
            if(maxt <= 0)
                maxt=1;
            if(maxt > MAXSTREAMS){
              printf("Invalid options: maximum streams for ");
              printf("throughput is MAXSTREAMS\n");
              exit(6);
            }
            uflag++;
            trflag++;
            if(Uflag)
            {
                printf("Can not run throughput tests with unmount & remounts.\n");
                exit(7);
            }
            break;
        case 'm':   /* Use multiple buffers */
            fetchon=0;
            multi_buffer=1;
            mflag++;
                mbuffer = (char *) alloc_mem((long long)MAXBUFFERSIZE,(int)0);
            if(mbuffer == 0) {
                            perror("Memory allocation failed:");
                            exit(8);
            }
                sprintf(splash[splash_line++],"\tMulti_buffer. Work area %d bytes\n",
                MAXBUFFERSIZE);
            break;
                case 'M':       /* Report machine name and OS */
            bzero(reply,sizeof(reply));
                        pi=popen("uname -a", "r");
            if(pi == (FILE *)0)
            {
                sprintf(splash[splash_line++],"\n\tError using popen() on uname\n");
                sprintf(splash[splash_line++],"\t-M option suppressed.\n");
            }
            else
            {
                            junk=fread(reply,IBUFSIZE-1,1,pi);
                            pclose(pi);
                m=reply;
                            while(*m) /* Strip new line */
                {
                    if(*m=='\n')
                                        *m=0;
                    else    
                                        m++;
                }
                            sprintf(splash[splash_line++],"\n\tMachine = %s\n",reply);
            }
                        break;

        case 'P':   /* Set beginning processor for binding. */
#ifndef NO_THREADS
#if defined(_HPUX_SOURCE) || defined(linux)
#if defined(_HPUX_SOURCE)
            num_processors= pthread_num_processors_np();
#else
      num_processors = sysconf(_SC_NPROCESSORS_ONLN);
#endif      
            begin_proc = atoi(optarg);
            if(begin_proc < 0)
                begin_proc=0;
            if(begin_proc > num_processors)
                begin_proc=0;
                        sprintf(splash[splash_line++],"\tBinding of processors beginning with %d \n",begin_proc);
            ioz_processor_bind++;
#else
            sprintf(splash[splash_line++],"\tProcessor binding not available in this version\n");
#endif
#endif
                        break;
        case 'p':   /* purge the processor cache */
                sprintf(splash[splash_line++],"\tPurge Mode On\n");
            fetchon=0;
            pflag++;
            purge=1;
            break;
        case 'h':   /* show help */
            hflag++;
                show_help();
            exit(0);
            break;
        case 'E':   /* Extended testing for pread/pwrite... */
            Eflag++;
            break;
        case 'R':   /* Generate Excel compatible Report */
            Rflag++;
                sprintf(splash[splash_line++],"\tExcel chart generation enabled\n");
            break;
        case 'o':   /* Open OSYNC */
                sprintf(splash[splash_line++],"\tSYNC Mode. \n");
            oflag++;
            break;
        case 'O':   /* Report in Ops/sec instead of KB/sec */
                sprintf(splash[splash_line++],"\tOPS Mode. Output is in operations per second.\n");
            OPS_flag++;
            break;
        case 'N':   /* Report in usec/op  */
                sprintf(splash[splash_line++],"\tMicroseconds/op Mode. Output is in microseconds per operation.\n");
            MS_flag++;
            break;
        case 'V':   /* Turn on Verify every byte */
            sverify=0;
            inp_pat = (char)(atoi(optarg));
            if(inp_pat == 0)
                inp_pat = PATTERN;
            pattern = ((inp_pat << 24) | (inp_pat << 16) | (inp_pat << 8) 
                | inp_pat);
            verify=1;
                sprintf(splash[splash_line++],"\tVerify Mode. Pattern %x\n",pattern);
                sprintf(splash[splash_line++],"\tPerformance measurements are invalid in this mode.\n");
            break;
        case 'S':   /* Set the processor cache size */
            cache_size = (long)(atoi(optarg)*1024);
            if(cache_size == 0)
                cache_size = CACHE_SIZE;
            break;
        case 'L':   /* Set processor cache line size */
            cache_line_size = (long)(atoi(optarg));
            if(cache_line_size == 0)
                cache_line_size = CACHE_LINE_SIZE;
            break;
        case 'f':   /* Specify the file name */
            if(mfflag) {
              printf("invalid options: -f and -F are mutually exclusive\n");
              exit(10);
            }
            fflag++;
            strcpy(filename,optarg);
            sprintf(dummyfile[0],"%s.DUMMY",optarg);
            break;
        case 'b':   /* Specify the biff file name */
            Rflag++;
            bif_flag++;
            strcpy(bif_filename,optarg);
            break;
        case 'F':   /* Specify multiple file names for -t */
            mfflag++;
            if(fflag) {
              printf("invalid options: -f and -F are mutually exclusive\n");
              exit(11);
            }
            if(!trflag) {
              printf("invalid options: must specify -t N before -F\n");
              exit(12);
            }
            optind--;
            for(fileindx=0;fileindx<maxt;fileindx++) {
              filearray[fileindx]=argv[optind++];
              if(optind > argc) {
#ifdef NO_PRINT_LLD
                printf("invalid options: not enough filenames for %ld streams\n",num_child);
#else
                printf("invalid options: not enough filenames for %lld streams\n",num_child);
#endif
                exit(13);
              }
            }
            break;
        case 'r':   /* Specify the record size to use */
            rflag++;
            reclen = ((long long)(atoi(optarg))*1024);
            if(optarg[strlen(optarg)-1]=='k' ||
                optarg[strlen(optarg)-1]=='K'){
                reclen = (long long)(1024 * atoi(optarg));
            }
            if(optarg[strlen(optarg)-1]=='m' ||
                optarg[strlen(optarg)-1]=='M'){
                reclen = (long long)(1024 * 1024 * atoi(optarg));
            }
            if(optarg[strlen(optarg)-1]=='g' ||
                optarg[strlen(optarg)-1]=='G'){
                reclen = (long long)(1024 * 1024 * 1024 *(long long)atoi(optarg));
            }
            if(reclen <= 0)
                reclen=(long long)4096;

            r_range[r_count++]=reclen;
            max_rec_size = (off64_t)r_range[r_count-1];   /* Make visable globally */
            min_rec_size = (off64_t)r_range[0];   /* Make visable globally */
#ifdef NO_PRINT_LLD
                sprintf(splash[splash_line++],"\tRecord Size %ld KB\n",reclen/1024);
#else
                sprintf(splash[splash_line++],"\tRecord Size %lld KB\n",reclen/1024);
#endif
            if(max_rec_size > MAXBUFFERSIZE) {
#ifdef NO_PRINT_LLD
                printf("Error: maximum record size %ld KB is greater than maximum buffer size %ld KB\n ",
                    max_rec_size/1024, MAXBUFFERSIZE/1024);
#else
                printf("Error: maximum record size %lld KB is greater than maximum buffer size %lld KB\n ",
                    (long long)(max_rec_size/1024LL), (long long)MAXBUFFERSIZE/1024LL);
#endif
                exit(23);
            }
            break;
        case 'J':   /* Specify the compute time in millisecs */
            compute_time = (float)(atoi(optarg));
            compute_time=compute_time/1000; 
            if(compute_time < (float)0)
                compute_time=(float)0;
            else
                compute_flag=1;
            jflag++;
            break;
        case 'j':   /* Specify the stride in records */
            stride = (long long)(atoi(optarg));
            if(stride < 0)
                stride=0;
            stride_flag=1;
            break;
        case 't':   /* Specify the number of children to run */
            num_child1=(atoi(optarg));
            num_child = (long long)num_child1;
            if(num_child > (long long)MAXSTREAMS) {
              printf("invalid options: maximum streams for throughput is MAXSTREAMS\n");
#ifdef NO_PRINT_LLD
              printf("Numchild %ld %s\n",num_child,optarg);
#else
              printf("Numchild %lld %s\n",num_child,optarg);
#endif
              exit(14);
            }
            if(num_child <= 0)
                num_child = 8;
            if(num_child == 0)
                num_child=1;
                        t_range[t_count++]=num_child;
                        maxt = (maxt>num_child?maxt:num_child);
            trflag++;
            if(Uflag)
            {
                printf("Can not run throughput tests with unmount & remounts.\n");
                exit(15);
            }
            break;
        case 'd':   /* Specify the delay of children to run */
            delay_start = (long long)(atoi(optarg));
            if(delay_start < 0)
                delay_start=0;
            break;
        case 'i':   /* Specify specific tests */
            tval=(long long)(atoi(optarg));
            if(tval < 0) tval=0;
#ifndef HAVE_PREAD
            if(tval > RANDOM_MIX_TEST)
            {
                printf("\tPread tests not available on this operating system.\n");
                exit(183);
            }
#endif
            if(tval > sizeof(func)/sizeof(char *)) 
            {
                tval=0;
                sprintf(splash[splash_line++],"\tSelected test not available on the version.\n");
            }
            include_test[tval]++;
            include_tflag++;
            break;
        case 'v':   /* Show version information */
                for(ind=0; strlen(head1[ind]); ind++)
                {
                printf("%s\n", head1[ind]);
                }
            exit(0);
            break;
        case 'U':   /* Specify the dev name for umount/mount*/
            Uflag++;
            strcpy(mountname,optarg);
            if(trflag)
            {
                printf("Can not run throughput tests with unmount & remounts.\n");
                exit(16);
            }
            break;
        case 'w':   /* Do not unlink files */
            sprintf(splash[splash_line++],"\tSetting no_unlink\n");
            no_unlink = 1;
            break;
        case 'Z':   /* Turn on the mmap and file I/O mixing */
            sprintf(splash[splash_line++],"\tEnable mmap & file I/O mixing.\n");
            mmap_mix = 1;
            break;
        case 'W':   /* Read/Write with file locked */
            file_lock=1;
            sprintf(splash[splash_line++],"\tLock file when reading/writing.\n");
            break;
        case 'K':   /* Cause disrupted read pattern */
            disrupt_flag=1;
            sprintf(splash[splash_line++],"\tDisrupted read patterns selected.\n");
            break;
        case 'X':   /* Open write telemetry file */
            compute_flag=1;
            sverify=2;  /* touch lightly */
            w_traj_flag=1;
            strcpy(write_traj_filename,optarg);
            traj_vers();
            w_traj_size();
            sprintf(splash[splash_line++],"\tUsing write telemetry file \"%s\"\n",
                write_traj_filename);
            w_traj_fd=open_w_traj();
            if(w_traj_fd == (FILE *)0)
                exit(200);
            break;
        case 'Y':   /* Open Read telemetry file */
            compute_flag=1;
            sverify=2;  /* touch lightly */
            r_traj_flag=1;
            strcpy(read_traj_filename,optarg);
            sprintf(splash[splash_line++],"\tUsing read telemetry file \"%s\"\n",
                read_traj_filename);
            traj_vers();
            r_traj_size();
            r_traj_fd=open_r_traj();
            if(r_traj_fd == (FILE*) 0)
                exit(200);
            break;
        case 'n':   /* Set min file size for auto mode */
            nflag=1;
            minimum_file_size = (off64_t)atoi(optarg);
            if(optarg[strlen(optarg)-1]=='k' ||
                optarg[strlen(optarg)-1]=='K'){
                ;
            }
            if(optarg[strlen(optarg)-1]=='m' ||
                optarg[strlen(optarg)-1]=='M'){
                minimum_file_size = (long long)(1024 * atoi(optarg));
            }
            if(optarg[strlen(optarg)-1]=='g' ||
                optarg[strlen(optarg)-1]=='G'){
                minimum_file_size = (long long)(1024 * 1024 * (long long)atoi(optarg));
            }
            if(minimum_file_size < RECLEN_START/1024)
                minimum_file_size=(off64_t)(RECLEN_START/1024);
            if(minimum_file_size < page_size/1024)
                minimum_file_size=(off64_t)(page_size/1024);
#ifdef NO_PRINT_LLD
            sprintf(splash[splash_line++],"\tUsing minimum file size of %ld kilobytes.\n",minimum_file_size);
#else
            sprintf(splash[splash_line++],"\tUsing minimum file size of %lld kilobytes.\n",minimum_file_size);
#endif
            break;
        case 'g':   /* Set maximum file size for auto mode */
            gflag=1;
            maximum_file_size = (off64_t)atoi(optarg);
            if(optarg[strlen(optarg)-1]=='k' ||
                optarg[strlen(optarg)-1]=='K'){
                ;
            }
            if(optarg[strlen(optarg)-1]=='m' ||
                optarg[strlen(optarg)-1]=='M'){
                maximum_file_size = (long long)(1024 * atoi(optarg));
            }
            if(optarg[strlen(optarg)-1]=='g' ||
                optarg[strlen(optarg)-1]=='G'){
                maximum_file_size = (long long)(1024 * 1024 * (long long)atoi(optarg));
            }
            if(maximum_file_size < RECLEN_START/1024)
                maximum_file_size=(off64_t)(RECLEN_START/1024);
#ifdef NO_PRINT_LLD
            sprintf(splash[splash_line++],"\tUsing maximum file size of %ld kilobytes.\n",maximum_file_size);
#else
            sprintf(splash[splash_line++],"\tUsing maximum file size of %lld kilobytes.\n",maximum_file_size);
#endif
            break;
        case 'z':   /* Set no cross over */
            sprintf(splash[splash_line++],"\tCross over of record size disabled.\n");
            NOCROSSflag=1;
            break;
        case 'y':       /* Set min record size for auto mode */
            yflag=1;
            min_rec_size = ((long long)(atoi(optarg))*1024);
            if(optarg[strlen(optarg)-1]=='k' ||
                optarg[strlen(optarg)-1]=='K'){
                min_rec_size = (long long)(1024 * atoi(optarg));
            }
            if(optarg[strlen(optarg)-1]=='m' ||
                optarg[strlen(optarg)-1]=='M'){
                min_rec_size = (long long)(1024 * 1024 * atoi(optarg));
            }
            if(optarg[strlen(optarg)-1]=='g' ||
                optarg[strlen(optarg)-1]=='G'){
                min_rec_size = (long long)(1024 * 1024 * 1024 *(long long)atoi(optarg));
            }
            if(min_rec_size <= 0)
                min_rec_size=(long long)RECLEN_START;
#ifdef NO_PRINT_LLD
                sprintf(splash[splash_line++],"\tUsing Minimum Record Size %ld KB\n", min_rec_size/1024);
#else
                sprintf(splash[splash_line++],"\tUsing Minimum Record Size %lld KB\n", min_rec_size/1024);
#endif
            break;
        case 'q':       /* Set max record size for auto mode */
            qflag=1;
            max_rec_size = ((long long)(atoi(optarg))*1024);
            if(optarg[strlen(optarg)-1]=='k' ||
                optarg[strlen(optarg)-1]=='K'){
                max_rec_size = (long long)(1024 * atoi(optarg));
            }
            if(optarg[strlen(optarg)-1]=='m' ||
                optarg[strlen(optarg)-1]=='M'){
                max_rec_size = (long long)(1024 * 1024 * atoi(optarg));
            }
            if(optarg[strlen(optarg)-1]=='g' ||
                optarg[strlen(optarg)-1]=='G'){
                max_rec_size = (long long)(1024 * 1024 * 1024 *(long long)atoi(optarg));
            }
            if(max_rec_size <= 0)
                min_rec_size=(long long)RECLEN_END;
            if(max_rec_size > MAXBUFFERSIZE) {
#ifdef NO_PRINT_LLD
                printf("Error: maximum record size %ld KB is greater than maximum buffer size %ld KB\n ",
                    max_rec_size/1024, MAXBUFFERSIZE/1024);
#else
                printf("Error: maximum record size %lld KB is greater than maximum buffer size %lld KB\n ",
                    (long long)(max_rec_size/1024LL), (long long)MAXBUFFERSIZE/1024LL);
#endif
                exit(23);
            }
#ifdef NO_PRINT_LLD
            sprintf(splash[splash_line++],"\tUsing Maximum Record Size %ld KB\n", max_rec_size/1024);
#else
            sprintf(splash[splash_line++],"\tUsing Maximum Record Size %lld KB\n", max_rec_size/1024);
#endif
            break;

        /* 
         * The + operator is for the new extended options mechanism 
         * Syntax is -+ followed by option leter, and if the optino
         * takes an operand  then it is implemented below. An example
         * -+a arg    is shown below. This is a sub option with an argument.
         * -+b  is shown below. This is a sub option with no argument.
         */
        case '+':
            /* printf("Plus option = >%s<\n",optarg);*/
            switch (*((char *)optarg))
            {
                case 'a':  /* Example: Has argument */
                    subarg=argv[optind++];
                    /* if(subarg!=(char *)0)   Error checking. */
                    /* printf("Plus option argument = >%s<\n",subarg);*/
                    break;
                case 'b':  /* Example: Does not have an argument */
                    break;
                case 'c':  /* Argument is the controlling host name */
                    /* I am a client for distributed Iozone */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+c takes an operand !!\n");
                         exit(200);
                    }
                    strcpy(controlling_host_name,subarg);
                    distributed=1;
                    client_iozone=1;
                    master_iozone=0;
                    break;
                                case 'h':  /* Argument is the controlling host name */
                                        subarg=argv[optind++];
                                        if(subarg==(char *)0)
                                        {
                                             printf("-+h takes an operand !!\n");
                                             exit(200);
                                        }
                                        strcpy(controlling_host_name,subarg);
                                        sprintf(splash[splash_line++],"\tHostname = %s\n",controlling_host_name);
                                        break;
                case 'm':  /* I am the controlling process for distributed Iozone */
                       /* Does not have an argument */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+m takes an operand. ( filename )\n");
                         exit(201);
                    }
                    strcpy(client_filename,subarg);
                    ret=get_client_info();
                    if(ret <= 0)
                    {
                        printf("Error reading client file\n");
                        exit(178);
                    }
                    clients_found=ret;
                    distributed=1;
                    master_iozone=1;
                    client_iozone=0;
                    sprintf(splash[splash_line++],"\tNetwork distribution mode enabled.\n");
                    break;
                case 'N':  /* turn off truncating the file before write test */
                    notruncate = 1;
                    break;
                case 'u':   /* Set CPU utilization output flag */
                    cpuutilflag = 1;    /* only used if R(eport) flag is also set */
                    get_rusage_resolution();
                        sprintf(splash[splash_line++],"\tCPU utilization Resolution = %5.3f seconds.\n",cputime_res);
                        sprintf(splash[splash_line++],"\tCPU utilization Excel chart enabled\n");
                    break;
                case 's':  /* Clients operate in silent mode. */
                       /* Does not have an argument */
                    silent=1;
                    break;
                case 'd':  /* Diagnostics mode */
                    sprintf(splash[splash_line++],"\t>>> I/O Diagnostic mode enabled. <<<\n");
                        sprintf(splash[splash_line++],"\tPerformance measurements are invalid in this mode.\n");
                    diag_v=1;
                    sverify=0;
                    break;
                case 'x':  /* Argument is the multiplier for rec size and file size */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+c takes an operand !!\n");
                         exit(200);
                    }
                    multiplier = atoi(subarg);
                    if(multiplier <=1)
                        multiplier = 2;
                    break;
                case 'i':  /* Argument is the host port */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+i takes an operand !!\n");
                         exit(200);
                    }
                    controlling_host_port = atoi(subarg);
                    break;
                case 'p':  /* Argument is the percentage read */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+p takes an operand !!\n");
                         exit(200);
                    }
                    pct_read = atoi(subarg);
                    if(pct_read < 1)
                        pct_read = 1;
                    if(pct_read >=100)
                        pct_read = 100;
                        sprintf(splash[splash_line++],"\tPercent read in mix test is %d\n",pct_read);
                    break;
                case 't':  /* Speed code activated */
                    speed_code=1;
                    break;
#if defined(_HPUX_SOURCE) || defined(linux) || defined(solaris)
                case 'r':  /* Read sync too */
                    read_sync=1;
                        sprintf(splash[splash_line++],"\tRead & Write sync mode active.\n");
                    break;
#endif
#ifndef NO_MADVISE
                case 'A':  /* Argument is madvise selector */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                       printf("-+A take an operand !!\n");
                       exit(200);
                    }
                    advise_flag=1;
                    advise_op=atoi(subarg);
                    sprintf(splash[splash_line++],"\tMadvise enabled: %d\n",advise_op);
                    break;
#endif
                case 'n':   /* Set no-retest */
                    noretest = 1;   
                        sprintf(splash[splash_line++],"\tNo retest option selected\n");
                    break;
                case 'k':   /* Constant aggregate data set size */
                    aggflag=1;
                    break;
                case 'q':  /* Argument is the rest time between tests in seconds */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+q takes an operand !!\n");
                         exit(200);
                    }
                    rest_val = (long long)atoi(subarg);
                    if(rest_val <=0)
                        rest_val = 0;
                    restf=1;
                    sprintf(splash[splash_line++],"\tDelay %d seconds between tests enabled.\n",atoi(subarg));
                    break;
#if defined(O_DSYNC)
                case 'D':  /* O_DSYNC mode */
                    sprintf(splash[splash_line++],"\t>>> O_DSYNC mode enabled. <<<\n");
                    odsync=1;
                    break;
#endif
                case 'l':  /* Record locking mode */
                    sprintf(splash[splash_line++],"\t>>> Record locking mode enabled. <<<\n");
                    rlocking=1;
                    break;
                case 'L':  /* Record locking mode shared files*/
                    sprintf(splash[splash_line++],"\t>>> Record locking, shared file mode enabled. <<<\n");
                    share_file=1;
                    rlocking=1;
                    break;
                case 'V':  /* No Record locking shared files*/
                    sprintf(splash[splash_line++],"\t>>> Shared file mode enabled. <<<\n");
                    share_file=1;
                    break;
                case 'B':  /* Sequential mix */
                    sprintf(splash[splash_line++],"\t>>> Sequential Mixed workload. <<<\n");
                    seq_mix=1;
                    break;
                        /* Use an existing user file, that does
                     not contain Iozone's pattern. Use file
                                     for testing, but read only, and no 
                                         delete at the end of the test. Also, 
                                         no pattern verification, but do touch
                                         the pages. */
                case 'E':  
                    sprintf(splash[splash_line++],"\t>>> No Verify mode. <<<\n");
                    sverify=2;
                    no_unlink=1;
                    no_write=1;
                    break;
                case 'T':  /* Time stamps on */
                    L_flag=1;
                    break;
                case 'X': /* Short circuit test mode */
                    X_flag = 1;
                    sverify=1;
                    verify=1;
                    inp_pat = 0xBB;
                    pattern = ((inp_pat << 24) | 
                      (inp_pat << 16) | (inp_pat << 8) |
                       inp_pat);
                        sprintf(splash[splash_line++],"\tShort circuit mode. For\n");
                        sprintf(splash[splash_line++],"\t filesystem development testing ONLY !\n");
                    break;
                case 'Z': /* Compatibility mode for 0xA5 */ 
                    Z_flag = 1;
                    sverify=1;
                    verify=1;
                    inp_pat = 0xA5;
                    pattern = ((inp_pat << 24) | 
                      (inp_pat << 16) | (inp_pat << 8) |
                       inp_pat);
                        sprintf(splash[splash_line++],"\tUsing old data sets.\n");
                        sprintf(splash[splash_line++],"\t Performance measurements may be invalid in this\n");
                        sprintf(splash[splash_line++],"\t mode due to published hack.\n");
                    break;
#if defined(Windows)
                case 'U':  /* Windows only Unbufferd I/O */
                    unbuffered=1;
                    sprintf(splash[splash_line++],"\tUnbuffered Windows API usage. >>> Very Experimental <<<\n");
                    break;
#endif
                case 'K':  /* Sony special for manual control of test 8 */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+K takes an operand !!\n");
                         exit(204);
                    }
                    Kplus_readers = (int)atoi(subarg);
                    if(Kplus_readers <=0)
                        Kplus_readers = 1;
                    Kplus_flag=1;
                    sprintf(splash[splash_line++],"\tManual control of test 8. >>> Very Experimental. Sony special <<<\n");
                    break;
                case 'w':  /* Argument is the percent of dedup */
                       /* Sets size of dedup region across files */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+w takes an operand !!\n");
                         exit(200);
                    }
                    dedup = atoi(subarg);
                    if(dedup <=0)
                        dedup = 0;
                    if(dedup >100)
                        dedup = 100;
                    sprintf(splash[splash_line++],"\tDedup activated %d percent.\n",dedup);
                    break;
                case 'y':  /* Argument is the percent of interior dedup */
                       /* Sets size of dedup region within and across files */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+y takes an operand !!\n");
                         exit(200);
                    }
                    dedup_interior = atoi(subarg);
                    if(dedup_interior <0)
                        dedup_interior = 0;
                    if(dedup_interior >100)
                        dedup_interior = 100;
                    sprintf(splash[splash_line++],"\tDedupe within & across %d percent.\n",dedup_interior);
                    break;
                case 'C':  /* Argument is the percent of dedupe within & !across */
                       /* Sets size of dedup region within and !across files */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+C takes an operand !!\n");
                         exit(200);
                    }
                    dedup_compress = atoi(subarg);
                    if(dedup_compress <0)
                        dedup_compress = 0;
                    if(dedup_compress >100)
                        dedup_compress = 100;
                    sprintf(splash[splash_line++],"\tDedupe within %d percent.\n",dedup_compress);
                    break;
                case 'S':  /* Argument is the seed for dedup */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+S takes an operand !!\n");
                         exit(200);
                    }
                    dedup_mseed = atoi(subarg);
                    if(dedup_mseed ==0)
                        dedup_mseed = 1;
                    sprintf(splash[splash_line++],"\tDedup manual seed %d .\n",dedup_mseed);
                    break;
                case 'H':  /* Argument is hostname of the PIT */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+H takes operand !!\n");
                         exit(200);
                    }
                    strcpy(pit_hostname,subarg);
                    sprintf(splash[splash_line++],"\tPIT_host %s\n",pit_hostname);
                    
                    break;
                case 'P':  /* Argument is port of the PIT */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+P takes operand !!\n");
                         exit(200);
                    }
                    strcpy(pit_service,subarg);
                    sprintf(splash[splash_line++],"\tPIT_port %s\n",pit_service);
                    break;
                case 'z':  /* Enable hist summary*/
                    hist_summary=1;
                    sprintf(splash[splash_line++],"\tHistogram summary enabled.\n");
                    break;
                case 'O':  /* Argument is the Op rate */
                    subarg=argv[optind++];
                    if(subarg==(char *)0)
                    {
                         printf("-+O takes an operand !!\n");
                         exit(200);
                    }
                    op_rate = atoi(subarg);
                    if(op_rate <= 0)
                        op_rate = 1;
                    op_rate_flag = 1;
                    sprintf(splash[splash_line++],"\tRate control active %d Ops/sec .\n",op_rate);
                    break;
                default:
                    printf("Unsupported Plus option -> %s <-\n",optarg);
                    exit(255);
                    break;
            }   
            break;
        default:
            printf("Unsupported option -> %s <-\n",optarg);
            exit(255);
        }
    }
    base_time=(long)time_so_far();
    get_resolution();       /* Get clock resolution */
    if(speed_code)
    {
        do_speed_check(client_iozone);
        exit(0);
    }
    if(r_count > 1)
    {
        aflag=1;
        rflag=0;
        NOCROSSflag=1;
    }
    if(s_count > 1)
    {
        aflag=1;
        sflag=0;
        NOCROSSflag=1;
    }
    /*
         * If not in silent mode then display the splash screen.
     */
    for(i=0;i<splash_line;i++)
        if(!silent) printf("%s",splash[i]);
    /*
     * Save the command line for later 
     */
    record_command_line(argcsave, argvsave);

    if(pflag) /* Allocate after cache_size is set */
    {
        alloc_pbuf();
    }
    if(distributed && master_iozone)
    {
        if(maxt > clients_found)
        {
            printf("You can not specify more threads/processes than you have in the client file list\n");
            exit(202);
        }
    }
    
    if(!OPS_flag && !MS_flag)
    {
        if(!silent) printf("\tOutput is in Kbytes/sec\n");
    }
    if (min_rec_size > max_rec_size) {
#ifdef NO_PRINT_LLD
        printf("Error: minimum record size %ld KB is greater than maximum record size %ld KB\n ",
            min_rec_size/1024, max_rec_size/1024);
#else
        printf("Error: minimum record size %lld KB is greater than maximum record size %lld KB\n ",
            min_rec_size/1024, max_rec_size/1024);
#endif
        exit(23);
        }
    orig_min_rec_size=min_rec_size;
    orig_max_rec_size=max_rec_size;
    /*
     * No telemetry files... just option selected 
     */
    if(compute_flag && jflag  && !(r_traj_flag || w_traj_flag))
        if(!silent) printf("\tCompute time %f seconds for reads and writes.\n",compute_time);
    /*
     * Read telemetry file and option selected
     */
    if(compute_flag && r_traj_flag && !w_traj_flag)
    {
        if(r_traj_items==3)
        {
            if(!silent) printf("\tCompute time from telemetry files for reads.\n");
        }
        else
        {
            if(jflag)
                if(!silent) printf("\tCompute time %f seconds for reads.\n",compute_time);
        }
        if(jflag)
            if(!silent) printf("\tCompute time %f seconds for writes.\n",compute_time);
    }
    /*
     * Write telemetry file and option selected
     */
    if(compute_flag && !r_traj_flag && w_traj_flag)
    {
        if(w_traj_items==3)
        {
            if(!silent) printf("\tCompute time from telemetry files for writes.\n");
        }
        else
        {
            if(jflag)
                if(!silent) printf("\tCompute time %f seconds for writes.\n",compute_time);
        }
        if(jflag)
            if(!silent) printf("\tCompute time %f seconds for reads.\n",compute_time);
    }
    if(compute_flag && r_traj_flag && w_traj_flag && jflag)
    {
        if(r_traj_items==3)
        {
            if(!silent) printf("\tCompute time from telemetry files for reads.\n");
        }
        else
        {
            if(!silent) printf("\tCompute time %f seconds for reads.\n",compute_time);
        }
        if(w_traj_items==3) 
        {
            if(!silent) printf("\tCompute time from telemetry files for writes.\n");
        }
        else
        {
            if(!silent) printf("\tCompute time %f seconds for writes.\n",compute_time);
        }
    }
    if(compute_flag && r_traj_flag && w_traj_flag && !jflag)
    {
        if(r_traj_items==3)
        {
            if(!silent) printf("\tCompute time from telemetry files for reads.\n");
        }
        else
        {
            if(!silent) printf("\tNo compute time for reads.\n");
        }

        if(w_traj_items==3) 
        {
            if(!silent) printf("\tCompute time from telemetry files for writes.\n");
        }
        else
        {
            if(!silent) printf("\tNo compute time for writes.\n");
        }
    }

        /* Enforce only write,rewrite,read,reread */
        if(w_traj_flag || r_traj_flag)
        {
                for(i=2;i<sizeof(func)/sizeof(char *);i++)
                {
                        if(seq_mix && (i==8))
                                ;
                        else
                                include_test[i] = 0;
                }
        }

    if(r_traj_flag)
    {
        if(include_test[READER_TEST] == 0) 
        {
            include_test[WRITER_TEST]=1;
            include_test[READER_TEST]=1;
            include_tflag=1;
        }
    }
    if(w_traj_flag)
    {
        if(include_test[WRITER_TEST] == 0) 
        {
            include_test[WRITER_TEST]=1;
            include_tflag=1;
        }
    }
    if(w_traj_flag && w_traj_fsize != 0)
        kilobytes64=w_traj_fsize/1024;
    if(r_traj_flag && r_traj_fsize != 0)
        kilobytes64=r_traj_fsize/1024;

    if( sverify==0 && (w_traj_flag || r_traj_flag))
    {
        printf("\n\tFull verification not supported in telemetry mode.\n\n");
        exit(17);
    }
    ;
    if(disrupt_flag &&(w_traj_flag || r_traj_flag) )
    {
        printf("\n\tDisrupt not supported in telemetry mode.\n\n");
        exit(17);
    }
    if(aflag &&(w_traj_flag || r_traj_flag) )
    {
        printf("\n\tAuto mode not supported in telemetry mode.\n");
        printf("\tTry:   -i 0 -i 1 \n\n");
        exit(17);
    }
    if(sflag && w_traj_flag )
    {
        printf("\n\tSize of file is determined by telemetry file.\n\n");
        exit(17);
    }
    if(rflag && w_traj_flag )
    {
        printf("\n\tRecord size of file is determined by telemetry file.\n\n");
        exit(17);
    }
    if(stride_flag && (w_traj_flag || r_traj_flag))
    {
        printf("\n\tStride size is determined by telemetry file.\n\n");
        exit(17);
    }
    if(trflag && MS_flag)
    {
        printf("\n\tMicrosecond mode not supported in throughput mode.\n\n");
        exit(17);
    }
    if (trflag  /* throughput mode, don't allow auto-mode options: */
        && (auto_mode || aflag || yflag || qflag || nflag || gflag))
    {
        printf("\n\tCan not mix throughput mode and auto-mode flags.\n\n");
        exit(17);
    }
    if(fflag && trflag)
    {
        printf("\n\tYou must use -F when using multiple threads or processes.\n\n");
        exit(17);
    }
    if(aflag && mfflag)
    {
        printf("\n\tYou must use -f when using auto mode.\n\n");
        exit(17);
    }
    if(async_flag && mmapflag)
    {
        printf("\n\tSorry ... Only mmap or async but not both\n\n");
        exit(18);
    }
#ifndef ASYNC_IO
    if(async_flag)
    {
        printf("\n\tSorry ... This version does not support async I/O\n\n");
        exit(19);
    }
#endif
    if(no_write)
    {
       if(!include_tflag)
       {
         printf("You must specify which tests ( -i # ) when using -+E\n");
         exit(19);
       }
    }
    if(include_tflag)
    {
        for(i=0;i<sizeof(func)/sizeof(char *);i++)
            if(include_test[i])
                include_mask|=(long long)(1<<i);
        /* printf(">> %llx",include_mask);  HERE */
    }
    if(no_write) /* Disable if any writer would disturbe existing file */
    {
       if(include_test[0] || include_test[4] ||
          include_test[6] || include_test[8] || include_test[9] ||
              include_test[11])
       {
          printf("You must disable any test that writes when using -+E\n");
          exit(20);
       }
    }
    if(no_write) /* User must specify the existing file name */
    {
       if(!(fflag | mfflag))
       {
          printf("You must use -f or -F when using -+E\n");
          exit(20);
       }
    }
    if(h_flag && k_flag)
    {
        printf("\n\tCan not do both -H and -k\n");
        exit(20);
    }
    if((dedup | dedup_interior) && diag_v)
    {
        printf("\n\tCan not do both -+d and -+w\n");
        exit(20);
    }
        
    if(!aflag && !rflag)
        max_rec_size=min_rec_size;

    init_record_sizes(min_rec_size,max_rec_size);
        if(!silent) printf("\tTime Resolution = %1.6f seconds.\n",time_res);
#ifdef NO_PRINT_LLD
        if(!silent) printf("\tProcessor cache size set to %ld Kbytes.\n",cache_size/1024);
        if(!silent) printf("\tProcessor cache line size set to %ld bytes.\n",cache_line_size);
    if(!silent) printf("\tFile stride size set to %ld * record size.\n",stride);
#else
        if(!silent) printf("\tProcessor cache size set to %ld Kbytes.\n",cache_size/1024);
        if(!silent) printf("\tProcessor cache line size set to %ld bytes.\n",cache_line_size);
    if(!silent) printf("\tFile stride size set to %lld * record size.\n",stride);
#endif
    if(!rflag)
        reclen=(long long)4096;

    if(uflag && !lflag)
        num_child=mint = 1;
    if(lflag && !uflag)
        maxt = mint;
    if(use_thread)
        port="thread";
    else
        port="process";
    if(lflag || uflag){
#ifdef NO_PRINT_LLD
        if(!silent) printf("\tMin %s = %ld \n",port,mint);
        if(!silent) printf("\tMax %s = %ld \n",port,maxt);
#else
        if(!silent) printf("\tMin %s = %lld \n",port,mint);
        if(!silent) printf("\tMax %s = %lld \n",port,maxt);
#endif
    }
    if(trflag)
    {
        if(num_child > 1)
        {
            if(use_thread)
            {
                port="threads";
            }
            else
            {
                port="processes";
            }
        }

#ifdef NO_PRINT_LLD
        if(!silent) printf("\tThroughput test with %ld %s\n", num_child,port);
#else
        if(!silent) printf("\tThroughput test with %lld %s\n", num_child,port);
#endif
    }
        numrecs64 = (long long)(kilobytes64*1024)/reclen;
        if (reclen >  (long long)MAXBUFFERSIZE) {
#ifdef NO_PRINT_LLD
                printf("Error: Maximum record length is %ld bytes\n",
                                MAXBUFFERSIZE);
#else
                printf("Error: Maximum record length is %lld bytes\n",
                                (long long)MAXBUFFERSIZE);
#endif
                exit(21);
        }
        if (reclen < (long long)MINBUFFERSIZE) {
#ifdef NO_PRINT_LLD
                printf("Error: Minimum record length is %ld bytes\n",
                                MINBUFFERSIZE);
#else
                printf("Error: Minimum record length is %lld bytes\n",
                                (long long)MINBUFFERSIZE);
#endif
                exit(22);
        }
    /* Only bzero or fill that which you will use. The buffer is very large */
    if(verify ) 
    {
        fill_buffer((char *)buffer,l_min(reclen,(long long)cache_size),(long long)pattern,(char)sverify,(long long)0);
        if(pflag)
            fill_buffer((char *)pbuffer,l_min(reclen,(long long)cache_size),(long long)pattern,(char)sverify,(long long)0);
        if(mflag)
            fill_buffer((char *)mbuffer,l_min(reclen,(long long)cache_size),(long long)pattern,(char)sverify,(long long)0);
    }
    else
    {
        bzero(buffer,(size_t)l_min(reclen,(long long)cache_size));
    }

#ifndef NO_THREADS
#if defined( _HPUX_SOURCE ) || defined ( linux )
    if(ioz_processor_bind)
    {
         bind_cpu=begin_proc;
#if defined( _HPUX_SOURCE )
         pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
                         (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
#else
     cpu_set_t cpuset;
     CPU_ZERO(&cpuset);
     CPU_SET(bind_cpu, &cpuset);

     pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
#endif
        my_nap(40); /* Switch to new cpu */
    }
#endif
#endif
    orig_size=kilobytes64;
    if(trflag){
        (void)multi_throughput_test(mint,maxt);
        goto out;
    }
    if(trflag && (mint == maxt)){
        auto_mode=0;
        throughput_test();
            goto out;
    }
        if (aflag) {
        print_header();
        auto_test();
        goto out;
    } 
    print_header();
    (void) begin(kilobytes64,reclen);
out:
    if(r_traj_flag)
        fclose(r_traj_fd);
    if(w_traj_flag)
        fclose(w_traj_fd);
    if (!no_unlink)
    {
        if(check_filename(dummyfile[0]))
               unlink(dummyfile[0]);    /* delete the file */
    }
    if(!silent) printf("\niozone test complete.\n");
    if(res_prob)
    {
        printf("Timer resolution is poor. Some small transfers may have \n");
        printf("reported inaccurate results. Sizes %ld Kbytes and below.\n",
            (long)(rec_prob/(long long)1024));
    }

    if(Rflag && !trflag){
        dump_excel();
    }
    return(0);  
}

Here is the call graph for this function:

void master_listen ( )

Here is the caller graph for this function:

void master_listen ( int  sock,
int  size_of_message 
)

Definition at line 20350 of file iozone.c.

{
        int tsize;
        int s;
        struct sockaddr_in *addr;
        unsigned int me;
        int ns,ret;
    struct master_neutral_command *mnc;

    mnc=(struct master_neutral_command *)&master_rcv_buf[0];
        tsize = size_of_message;
    addr=&listener_sync_sock;
        s = sock;
    me=sizeof(struct sockaddr_in);

        if(mdebug)
          printf("Master in listening mode on socket %d\n",s);
again:
        ret=listen(s,MAXSTREAMS);
        if(ret != 0)
        {
                perror("Master: listen returned error\n");
        }
        if(mdebug)
          printf("Master in accepting connection\n");
        ns=accept(s,(void *)addr,&me);
        if(ns < 0)
        {
                printf("Master socket %d\n",s);
                perror("Master: ***** accept returned error *****\n");
        sleep(1);
        goto again;
        }
        if(mdebug)
          printf("Master in reading from connection\n");

        ret=read(ns,mnc,tsize);
    if(ret < tsize)
    {
            printf("Master read failed. Ret %d Errno %d\n",ret,errno);
    }

        close(ns);
}

Here is the call graph for this function:

void master_send ( )

Here is the caller graph for this function:

void master_send ( int  child_socket_val,
char *  host_name,
struct client_command send_buffer,
int  send_size 
)

Definition at line 20555 of file iozone.c.

{
    int rc;
    struct client_neutral_command outbuf;

    bzero(&outbuf,sizeof(struct client_neutral_command));
    if(mdebug)
    {
        printf("Master_neutral_command size = %lu\n",(unsigned long)sizeof(struct master_neutral_command));
        printf("Client_neutral_command size = %lu\n",(unsigned long)sizeof(struct client_neutral_command));
    }
    /* 
     * Convert internal commands to string format for neutral format/portability
     */
    strcpy(outbuf.c_host_name,send_buffer->c_host_name);
    strcpy(outbuf.c_pit_hostname,send_buffer->c_pit_hostname);
    strcpy(outbuf.c_pit_service,send_buffer->c_pit_service);
    strcpy(outbuf.c_client_name,send_buffer->c_client_name);
    strcpy(outbuf.c_working_dir,send_buffer->c_working_dir);
    strcpy(outbuf.c_file_name,send_buffer->c_file_name);
    strcpy(outbuf.c_path_dir,send_buffer->c_path_dir);
    strcpy(outbuf.c_execute_name,send_buffer->c_execute_name);
    strcpy(outbuf.c_write_traj_filename,send_buffer->c_write_traj_filename);
    strcpy(outbuf.c_read_traj_filename,send_buffer->c_read_traj_filename);
    sprintf(outbuf.c_oflag,"%d",send_buffer->c_oflag);
    sprintf(outbuf.c_mfflag,"%d",send_buffer->c_mfflag);
    sprintf(outbuf.c_unbuffered,"%d",send_buffer->c_unbuffered);
    sprintf(outbuf.c_noretest,"%d",send_buffer->c_noretest);
    sprintf(outbuf.c_notruncate,"%d",send_buffer->c_notruncate);
    sprintf(outbuf.c_read_sync,"%d",send_buffer->c_read_sync);
    sprintf(outbuf.c_jflag,"%d",send_buffer->c_jflag);
    sprintf(outbuf.c_async_flag,"%d",send_buffer->c_async_flag);
    sprintf(outbuf.c_mmapflag,"%d",send_buffer->c_mmapflag);
    sprintf(outbuf.c_k_flag,"%d",send_buffer->c_k_flag);
    sprintf(outbuf.c_h_flag,"%d",send_buffer->c_h_flag);
    sprintf(outbuf.c_mflag,"%d",send_buffer->c_mflag);
    sprintf(outbuf.c_pflag,"%d",send_buffer->c_pflag);
    sprintf(outbuf.c_stride_flag,"%d",send_buffer->c_stride_flag);
    sprintf(outbuf.c_verify,"%d",send_buffer->c_verify);
    sprintf(outbuf.c_sverify,"%d",send_buffer->c_sverify);
    sprintf(outbuf.c_odsync,"%d",send_buffer->c_odsync);
    sprintf(outbuf.c_diag_v,"%d",send_buffer->c_diag_v);
    sprintf(outbuf.c_dedup,"%d",send_buffer->c_dedup);
    sprintf(outbuf.c_dedup_interior,"%d",send_buffer->c_dedup_interior);
    sprintf(outbuf.c_dedup_compress,"%d",send_buffer->c_dedup_compress);
    sprintf(outbuf.c_dedup_mseed,"%d",send_buffer->c_dedup_mseed);
    sprintf(outbuf.c_hist_summary,"%d",send_buffer->c_hist_summary);
    sprintf(outbuf.c_op_rate,"%d",send_buffer->c_op_rate);
    sprintf(outbuf.c_op_rate_flag,"%d",send_buffer->c_op_rate_flag);
    sprintf(outbuf.c_Q_flag,"%d",send_buffer->c_Q_flag);
    sprintf(outbuf.c_L_flag,"%d",send_buffer->c_L_flag);
    sprintf(outbuf.c_include_flush,"%d",send_buffer->c_include_flush);
    sprintf(outbuf.c_OPS_flag,"%d",send_buffer->c_OPS_flag);
    sprintf(outbuf.c_mmapnsflag,"%d",send_buffer->c_mmapnsflag);
    sprintf(outbuf.c_mmapssflag,"%d",send_buffer->c_mmapssflag);
    sprintf(outbuf.c_mmapasflag,"%d",send_buffer->c_mmapasflag);
    sprintf(outbuf.c_no_copy_flag,"%d",send_buffer->c_no_copy_flag);
    sprintf(outbuf.c_include_close,"%d",send_buffer->c_include_close);
    sprintf(outbuf.c_disrupt_flag,"%d",send_buffer->c_disrupt_flag);
    sprintf(outbuf.c_compute_flag,"%d",send_buffer->c_compute_flag);
    sprintf(outbuf.c_xflag,"%d",send_buffer->c_xflag);
    sprintf(outbuf.c_MS_flag,"%d",send_buffer->c_MS_flag);
    sprintf(outbuf.c_mmap_mix,"%d",send_buffer->c_mmap_mix);
    sprintf(outbuf.c_Kplus_flag,"%d",send_buffer->c_Kplus_flag);
    sprintf(outbuf.c_w_traj_flag,"%d",send_buffer->c_w_traj_flag);
    sprintf(outbuf.c_r_traj_flag,"%d",send_buffer->c_r_traj_flag);
    sprintf(outbuf.c_direct_flag,"%d",send_buffer->c_direct_flag);
    sprintf(outbuf.c_cpuutilflag,"%d",send_buffer->c_cpuutilflag);
    sprintf(outbuf.c_seq_mix,"%d",send_buffer->c_seq_mix);
    sprintf(outbuf.c_client_number,"%d",send_buffer->c_client_number);
    sprintf(outbuf.c_command,"%d",send_buffer->c_command);
    sprintf(outbuf.c_testnum,"%d",send_buffer->c_testnum);
    sprintf(outbuf.c_no_unlink,"%d",send_buffer->c_no_unlink);
    sprintf(outbuf.c_no_write,"%d",send_buffer->c_no_write);
    sprintf(outbuf.c_file_lock,"%d",send_buffer->c_file_lock);
    sprintf(outbuf.c_rec_lock,"%d",send_buffer->c_rec_lock);
    sprintf(outbuf.c_Kplus_readers,"%d",send_buffer->c_Kplus_readers);
    sprintf(outbuf.c_multiplier,"%d",send_buffer->c_multiplier);
    sprintf(outbuf.c_share_file,"%d",send_buffer->c_share_file);
    sprintf(outbuf.c_pattern,"%d",send_buffer->c_pattern);
    sprintf(outbuf.c_version,"%d",send_buffer->c_version);
    sprintf(outbuf.c_base_time,"%d",send_buffer->c_base_time);
    sprintf(outbuf.c_num_child,"%d",send_buffer->c_num_child);
    sprintf(outbuf.c_pct_read,"%d",send_buffer->c_pct_read);
    sprintf(outbuf.c_advise_op,"%d",send_buffer->c_advise_op);
    sprintf(outbuf.c_advise_flag,"%d",send_buffer->c_advise_flag);
    sprintf(outbuf.c_restf,"%d",send_buffer->c_restf);
    sprintf(outbuf.c_mygen,"%d",send_buffer->c_mygen);
#ifdef NO_PRINT_LLD
    sprintf(outbuf.c_stride,"%ld",send_buffer->c_stride);
    sprintf(outbuf.c_rest_val,"%ld",send_buffer->c_rest_val);
    sprintf(outbuf.c_delay,"%ld",send_buffer->c_delay);
    sprintf(outbuf.c_purge,"%ld",send_buffer->c_purge);
    sprintf(outbuf.c_fetchon,"%ld",send_buffer->c_fetchon);
    sprintf(outbuf.c_numrecs64,"%ld",send_buffer->c_numrecs64);
    sprintf(outbuf.c_reclen,"%ld",send_buffer->c_reclen);
    sprintf(outbuf.c_child_flag,"%ld",send_buffer->c_child_flag);
    sprintf(outbuf.c_delay_start,"%ld",send_buffer->c_delay_start);
    sprintf(outbuf.c_depth,"%ld",send_buffer->c_depth);
#else
    sprintf(outbuf.c_delay,"%lld",send_buffer->c_delay);
    sprintf(outbuf.c_stride,"%lld",send_buffer->c_stride);
    sprintf(outbuf.c_rest_val,"%lld",send_buffer->c_rest_val);
    sprintf(outbuf.c_purge,"%lld",send_buffer->c_purge);
    sprintf(outbuf.c_fetchon,"%lld",send_buffer->c_fetchon);
    sprintf(outbuf.c_numrecs64,"%lld",send_buffer->c_numrecs64);
    sprintf(outbuf.c_reclen,"%lld",send_buffer->c_reclen);
    sprintf(outbuf.c_child_flag,"%lld",send_buffer->c_child_flag);
    sprintf(outbuf.c_delay_start,"%lld",send_buffer->c_delay_start);
    sprintf(outbuf.c_depth,"%lld",send_buffer->c_depth);
#endif
    sprintf(outbuf.c_stop_flag,"%d",send_buffer->c_stop_flag);
    sprintf(outbuf.c_compute_time,"%f",send_buffer->c_compute_time);

    if(mdebug >= 1)
        printf("Master sending message to %s \n",host_name);
        /*rc = send(child_socket_val, (char *)&outbuf, sizeof(struct client_neutral_command), 0);*/
        rc = write(child_socket_val, (char *)&outbuf, sizeof(struct client_neutral_command));
        if (rc < 0)
        {
                perror("write failed\n");
                exit(26);
        }
}

Here is the call graph for this function:

void mix_perf_test ( )
void mix_perf_test ( off64_t  kilo64,
long long  reclen,
long long *  data1,
long long*  data2 
)

Definition at line 22764 of file iozone.c.

{
    return;
/*
    printf("\nMix mode test only valid in throughput mode.\n");
    signal_handler();
    exit(180);
*/
}
void mmap_end ( )

Here is the caller graph for this function:

void mmap_end ( char *  buffer,
long long  size 
)

Definition at line 18983 of file iozone.c.

{
    if(munmap(buffer,(size_t)size)<0)
#ifdef NO_PRINT_LLD
        printf("munmap buffer %lx, size %ld failed.\n",(long)buffer,size);
#else
        printf("munmap buffer %lx, size %lld failed.\n",(long)buffer,size);
#endif
    
}

Here is the caller graph for this function:

void multi_throughput_test ( long long  mint,
long long  maxt 
)

Definition at line 12230 of file iozone.c.

{
        int *t_rangeptr, *t_rangecurs;
        int *saveptr = (int *)0;
        int tofree = 0;
    long long i;
        if(t_count == 0){
            t_count = (int) maxt - mint + 1;
            t_rangeptr = (int *) malloc((size_t)sizeof(int)*t_count);
        saveptr = t_rangeptr;
            tofree = 1;
            t_rangecurs = t_rangeptr;
            for(i=mint; i<= maxt; i++) {
                *(t_rangecurs++) = i;
            }
        }
        else {
            t_rangeptr = &t_range[0];
        }
    for(i=0; i < t_count; i++){
        num_child = *(t_rangeptr++);
        current_client_number=0; /* Need to start with 1 */
        throughput_test();
        current_x=0;
        current_y++;
    }
    if(Rflag)
        dump_throughput();
        if(tofree)
            free(saveptr);

}

Here is the call graph for this function:

void my_nap ( )

Here is the caller graph for this function:

void my_nap ( int  ntime)

Definition at line 19071 of file iozone.c.

{
    struct timeval nap_time;
    int seconds, microsecs;
    seconds = ntime/1000; /* Now in seconds */
    microsecs = (ntime*1000)%1000000;  /* Remaining microsecs */
    nap_time.tv_sec=seconds;
        nap_time.tv_usec=microsecs;
        select(0,0,0,0,&nap_time);
}

Here is the call graph for this function:

void my_unap ( )

Here is the caller graph for this function:

void my_unap ( unsigned long long  microsecs)

Definition at line 19093 of file iozone.c.

{
    struct timeval nap_time;
    int seconds;
    double timein, timeout;

    seconds = (int)(microsecs/1000000.0); /* Now in seconds */
    nap_time.tv_sec=seconds;
        nap_time.tv_usec=(int)microsecs;

    timein=time_so_far1();
    while(1)
    {
        timeout=time_so_far1();
        /*printf("Sleep for %lld Curtime %g\n",microsecs,timeout-timein);*/
        if(timeout-timein > microsecs)
           break;
    }

/*
        select(0,0,0,0,&nap_time);
*/


}

Here is the call graph for this function:

int mylockf ( )

Here is the caller graph for this function:

int mylockf ( int  fd,
int  op,
int  rdwr 
)

Definition at line 19388 of file iozone.c.

{
    struct flock myflock;
    int ret;
    if(op==0) /* Generic unlock the whole file */
    {
        myflock.l_type=F_UNLCK;
        myflock.l_whence=SEEK_SET;
        myflock.l_start=0;
        myflock.l_len=0; /* The whole file */
        myflock.l_pid=getpid();
        ret=fcntl(fd,F_SETLKW, &myflock);
    }
    else
          /* Generic lock the whole file */
    {
        if(rdwr==0)
            myflock.l_type=F_WRLCK; /* Apply write lock */
        else
            myflock.l_type=F_RDLCK; /* Apply read lock */
        myflock.l_whence=SEEK_SET;
        myflock.l_start=0;
        myflock.l_len=0; /* The whole file */
        myflock.l_pid=getpid();
        ret=fcntl(fd,F_SETLKW, &myflock);
    }
    return(ret);
}
int mylockr ( )

Here is the caller graph for this function:

int mylockr ( int  fd,
int  op,
int  rdwr,
off64_t  offset,
off64_t  size 
)

Definition at line 19424 of file iozone.c.

{
    struct flock myflock;
    int ret;
    if(op==0) /* Generic unlock the whole file */
    {
        /*printf("Child: %lld Unlock offset %lld size %lld\n",chid,offset,size);*/
        myflock.l_type=F_UNLCK;
        myflock.l_whence=SEEK_SET;
        myflock.l_start=offset;
        myflock.l_len=size; /* The whole file */
        myflock.l_pid=getpid();
        ret=fcntl(fd,F_SETLKW, &myflock);
    }
    else
          /* Generic lock the range  */
    {
        if(rdwr==0)
        {
            myflock.l_type=F_WRLCK; /* Apply write lock */
            /* printf("Write ");*/
        }
        else
        {
            myflock.l_type=F_RDLCK; /* Apply read lock */
            /* printf("Read ");*/
        }
        /*printf("Child: %lld Lock offset %lld size %lld\n",chid, offset,size);*/
        myflock.l_whence=SEEK_SET;
        myflock.l_start=offset;
        myflock.l_len=size; /* The whole file */
        myflock.l_pid=getpid();
        ret=fcntl(fd,F_SETLKW, &myflock);
    }
    return(ret);
}
long long mythread_create ( )

Here is the caller graph for this function:

long long mythread_create ( void *(*)(void *)  func,
void *  x 
)

Definition at line 18462 of file iozone.c.

{
    pthread_t ts;
    pthread_attr_t attr;
    int xx;
    int *yy;
#ifdef _64BIT_ARCH_
    long long meme;
    meme = (long long)x;
#else
    long meme;
    meme = (long)x;
#endif
    yy=(int *)x;


#ifdef OSFV3
    
    xx=(int )pthread_create(&ts, pthread_attr_default,
        func, (void *)yy);

#else
    pthread_attr_init(&attr);
    xx=(int )pthread_create((pthread_t *)&ts, (pthread_attr_t *) &attr,
        func, (void *)yy);
#endif
    bcopy(&ts,&p_childids[meme],sizeof(pthread_t));
    if(xx < (int)0)
        printf("Thread create failed. Returned %d Errno = %d\n",xx,errno);
    if(debug1 )
    {
        printf("\nthread created has an id of %lx\n",ts);
        printf("meme %ld\n",meme);
    }
    return((long long)meme);
}

Definition at line 18555 of file iozone.c.

{
    pthread_t xx;
    xx = pthread_self();
    return(xx);
}
void O_stop_child_send ( int  child_socket_val)

Definition at line 20708 of file iozone.c.

{
    close(child_socket_val);
}

Here is the call graph for this function:

FILE * open_r_traj ( )

Definition at line 19685 of file iozone.c.

{
    FILE *fd;
    fd=fopen(read_traj_filename,"r");
    if(fd == (FILE *)0)
    {
        printf("Unable to open read telemetry file \"%s\"\n",
            read_traj_filename);
        exit(174);
    }
    return(fd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

FILE * open_w_traj ( )

Definition at line 19707 of file iozone.c.

{
    FILE *fd;
    fd=fopen(write_traj_filename,"r");
    if(fd == (FILE *)0)
    {
        printf("Unable to open write telemetry file \"%s\"\n",
            write_traj_filename);
        exit(175);
    }
    return(fd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int openSckt ( const char *  host,
const char *  service,
unsigned int  scopeId 
) [static]

Definition at line 24099 of file iozone.c.

{
   struct addrinfo *ai;
   int              aiErr;
   struct addrinfo *aiHead;
   struct addrinfo  hints;
   sockaddr_in6_t  *pSadrIn6;
   int              sckt;
   /*
    * Initialize the 'hints' structure for getaddrinfo(3).
   */
   memset( &hints, 0, sizeof( hints ) );
   hints.ai_family   = PF_UNSPEC;     /* IPv4 or IPv6 records */
   hints.ai_socktype = SOCK_STREAM;    /* Connection oriented communication.*/
   hints.ai_protocol = IPPROTO_TCP;   /* TCP transport layer protocol only. */
   /*
   ** Look up the host/service information.
   */
   if ( ( aiErr = getaddrinfo( host,
                               service,
                               &hints,
                               &aiHead ) ) != 0 )
   {
      fprintf( stderr, "(line %d): ERROR - %s.\n", __LINE__, 
     gai_strerror( aiErr ) );
      return INVALID_DESC;
   }
   /*
   ** Go through the list and try to open a connection.  Continue until either
   ** a connection is established or the entire list is exhausted.
   */
   for ( ai = aiHead,   sckt = INVALID_DESC;
         ( ai != NULL ) && ( sckt == INVALID_DESC );
         ai = ai->ai_next )
   {
      /*
      ** IPv6 kluge.  Make sure the scope ID is set.
      */
      if ( ai->ai_family == PF_INET6 )
      {
         pSadrIn6 = (sockaddr_in6_t*) ai->ai_addr;
         if ( pSadrIn6->sin6_scope_id == 0 )
         {
            pSadrIn6->sin6_scope_id = scopeId;
         }  /* End IF the scope ID wasn't set. */
      }  /* End IPv6 kluge. */
      /*
      ** Create a socket.
      */
      sckt = socket( ai->ai_family, ai->ai_socktype, ai->ai_protocol );
      if(sckt == -1)
      {
         sckt = INVALID_DESC;
         continue;   /* Try the next address record in the list. */
      }
      /*
      ** Set the target destination for the remote host on this socket.  That
      ** is, this socket only communicates with the specified host.
      */
      if (connect( sckt, ai->ai_addr, ai->ai_addrlen ) )
      {
         (void) close( sckt );   /* Could use system call again here, 
                    but why? */
         sckt = INVALID_DESC;
         continue;   /* Try the next address record in the list. */
      }
   }  /* End FOR each address record returned by getaddrinfo(3). */
   /*
   ** Clean up & return.
   */
   freeaddrinfo( aiHead );
   return sckt;
}  /* End openSckt() */

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

int parse_client_line ( char *  buffer,
int  line_num 
)

Definition at line 22464 of file iozone.c.

{
    int num;
    /* Format is clientname, workdir, execute_path */
    /* If column #1 contains a # symbol then skip this line */

    if(buffer[0]=='#')
        return(0);
    num=sscanf(buffer,"%s %s %s %s\n",
        child_idents[line_num].child_name,
        child_idents[line_num].workdir,
        child_idents[line_num].execute_path,
        child_idents[line_num].file_name);
    if((num > 0) && (num !=3) && (num !=4))
    {
        printf("Bad Client Identity at entry %d\n",line_num);
        printf("Client: -> %s  Workdir: -> %s  Execute_path: -> %s \n",
        child_idents[line_num].child_name,
        child_idents[line_num].workdir,
        child_idents[line_num].execute_path);
        exit(203);
    }
    if(num == 4)
        mfflag++;

    return(1);
}

Here is the call graph for this function:

int pick_client ( )

Here is the caller graph for this function:

int pick_client ( int  testnum,
long long  numrecs64,
long long  reclen 
)

Definition at line 21319 of file iozone.c.

{
    int x;
    int c_command,child_index;
    struct client_command cc;
    struct master_command mc;
    struct master_neutral_command *mnc;
    char command[512];
    struct in_addr my_s_addr;
    char my_port_num[10];


    bzero(&cc,sizeof(struct client_command));
    for(x=0;x<512;x++)
        command[x]=0;

    current_client_number++; /* Need to start with 1 */
    x=current_client_number;

    child_idents[x-1].state = C_STATE_ZERO;
    /* Step 1. Now start client going on remote node.   */

    find_remote_shell(remote_shell);
    sprintf(command,"%s ",remote_shell);
    strcat(command,child_idents[x-1].child_name);
    strcat(command," -n '");
    strcat(command,child_idents[x-1].execute_path);
    strcat(command," -+s -t 1 -r 4 -s 4 -+c ");
    strcat(command,controlling_host_name);
        if (master_listen_port != HOST_LIST_PORT)
        {
          sprintf(my_port_num," -+i %d",master_listen_port);
          strcat(command,my_port_num);
        }
    strcat(command," '");
    junk=system(command);
/*
    system("remsh rsnperf '/home/capps/niozone/iozone -+s -t 1 -r 4 -s 8 -+c rsnperf'");

*/
    if(mdebug)
        printf("%s",command);
    /* Format example:                  */
    /*                          */
    /* system("remsh rsnperf '/home/capps/niozone/iozone    */
    /*       -+s -t 1 -r 4 -s 8 -+c rsnperf'");     */
    /*                          */

    /* Step 2. Wait for join from new client.       */

    child_idents[x-1].state = C_STATE_WAIT_WHO;

    if(mdebug>=1)
        printf("\nMaster listening for child to send join message.\n");
    master_listen(master_listen_socket,sizeof(struct master_neutral_command));
    mnc = (struct master_neutral_command *)&master_rcv_buf[0];

    /* 
     * Convert from string format back to internal representation
     */
    sscanf(mnc->m_child_port,"%d",&mc.m_child_port);    
    sscanf(mnc->m_child_async_port,"%d",&mc.m_child_async_port);    
    sscanf(mnc->m_command,"%d",&mc.m_command);  
    sscanf(mnc->m_version,"%d",&mc.m_version);  
    if(mc.m_version != proto_version)
    {
        printf("Client > %s < is not running the same version of Iozone !! C%d M%d\n", child_idents[x-1].child_name, mc.m_version, proto_version);
    }

    c_port = mc.m_child_port; 
    a_port = mc.m_child_async_port; 
    c_command = mc.m_command;
    if(mdebug>=1)
    {
        printf("Master back from listen child Joined.\n");
        printf("Master: Command %d\n",c_command);
    }
    /* Step 3. Then start_master_send() for this client.    */
    
    if(mdebug>=1)
        printf("Starting master send channel\n");
        master_send_sockets[x-1]= start_master_send(child_idents[x-1].child_name,c_port,
        &my_s_addr); 
    if(mdebug>=1)
        printf("Starting master send async channel\n");
        master_send_async_sockets[x-1]= start_master_send_async(child_idents[x-1].child_name,a_port,
        my_s_addr); 

    child_idents[x-1].master_socket_num = master_send_sockets[x-1];
    child_idents[x-1].master_async_socket_num = master_send_async_sockets[x-1];
    child_idents[x-1].child_number = x-1;
    child_idents[x-1].child_port = c_port;
    child_idents[x-1].child_async_port = a_port;

    /*                              */
    /* Step 4. Send message to client telling him his name, number, */
    /*             rsize, fsize, and test to run.           */
    strcpy(cc.c_host_name ,controlling_host_name);
    strcpy(cc.c_pit_hostname ,pit_hostname);
    strcpy(cc.c_pit_service ,pit_service);
    strcpy(cc.c_client_name ,child_idents[x-1].child_name);
    strcpy(cc.c_working_dir ,child_idents[x-1].workdir);
    strcpy(cc.c_file_name ,child_idents[x-1].file_name);
    strcpy(cc.c_write_traj_filename ,write_traj_filename);
    strcpy(cc.c_read_traj_filename ,read_traj_filename);
    cc.c_command = R_JOIN_ACK;
    cc.c_client_number = x-1;
    cc.c_testnum = testnum;
    cc.c_numrecs64 = numrecs64;
    cc.c_reclen = reclen;
    cc.c_oflag = oflag;
    cc.c_mfflag = mfflag;
    cc.c_unbuffered = unbuffered;
    cc.c_noretest = noretest;
    cc.c_notruncate = notruncate;
    cc.c_read_sync = read_sync;
    cc.c_jflag = jflag;
    cc.c_direct_flag = direct_flag;
    cc.c_cpuutilflag = cpuutilflag;
    cc.c_seq_mix = seq_mix;
    cc.c_async_flag = async_flag;
    cc.c_k_flag = k_flag;
    cc.c_h_flag = h_flag;
    cc.c_mflag = mflag;
    cc.c_pflag = pflag;
    cc.c_stride_flag = stride_flag;
    cc.c_fetchon = fetchon;
    cc.c_verify = verify;
    cc.c_sverify = sverify;
    cc.c_odsync = odsync;
    cc.c_diag_v = diag_v;
    cc.c_dedup = dedup;
    cc.c_dedup_interior = dedup_interior;
    cc.c_dedup_compress = dedup_compress;
    cc.c_dedup_mseed = dedup_mseed;
    cc.c_hist_summary = hist_summary;
    cc.c_op_rate = op_rate;
    cc.c_op_rate_flag = op_rate_flag;
    cc.c_file_lock = file_lock;
    cc.c_rec_lock = rlocking;
    cc.c_Kplus_readers = Kplus_readers;
    cc.c_multiplier = multiplier;
    cc.c_share_file = share_file;
    cc.c_pattern = pattern;
    cc.c_version = proto_version;
    cc.c_base_time = base_time;
    cc.c_num_child = (int)num_child;
    cc.c_pct_read = pct_read;
    cc.c_advise_op = advise_op;
    cc.c_advise_flag = advise_flag;
    cc.c_restf = restf;
    cc.c_mygen = mygen;
    cc.c_Q_flag = Q_flag;
    cc.c_L_flag = L_flag;
    cc.c_xflag = xflag;
    cc.c_w_traj_flag = w_traj_flag;
    cc.c_r_traj_flag = r_traj_flag;
    cc.c_include_flush = include_flush;
    cc.c_OPS_flag = OPS_flag;
    cc.c_purge = purge;
    cc.c_mmapflag = mmapflag;
    cc.c_mmapasflag = mmapasflag;
    cc.c_mmapnsflag = mmapnsflag;
    cc.c_mmapssflag = mmapssflag;
    cc.c_no_copy_flag = no_copy_flag;
    cc.c_no_unlink = no_unlink;
    cc.c_no_write = no_write;
    cc.c_include_close = include_close;
    cc.c_disrupt_flag = disrupt_flag;
    cc.c_compute_flag = compute_flag;
    cc.c_delay = delay;
    cc.c_stride = stride;
    cc.c_rest_val = rest_val;
    cc.c_delay_start = delay_start;
    cc.c_compute_time = compute_time;
    cc.c_depth = depth;
    cc.c_MS_flag = MS_flag;
    cc.c_mmap_mix = mmap_mix;
    cc.c_Kplus_flag = Kplus_flag;


    if(mdebug)
        printf("Master sending client who he is\n");
    master_send(master_send_sockets[x-1],cc.c_client_name, &cc,sizeof(struct client_command));

    child_idents[x-1].state = C_STATE_WAIT_BARRIER;
    
    /*                              */
    /* Step 5. Wait until you receive message that the chile is at  */
    /*             the barrier.                     */
    if(mdebug>=1)
       printf("Master listening for child to send at barrier message.\n");
    master_listen(master_listen_socket,sizeof(struct master_neutral_command));
    mnc = (struct master_neutral_command *)&master_rcv_buf[0];
    /*
     * Convert from string back to arch specific 
     */
    sscanf(mnc->m_client_number,"%d",&mc.m_client_number);  
#ifdef NO_PRINT_LLD
    sscanf(mnc->m_child_flag,"%ld",&mc.m_child_flag);   
#else
    sscanf(mnc->m_child_flag,"%lld",&mc.m_child_flag);  
#endif

    child_index = mc.m_client_number;
    child_stat = (struct child_stats *)&shmaddr[child_index];   
    child_stat->flag = (long long)(mc.m_child_flag);
    if(mdebug>=1)
       printf("Master sees child %d at barrier message.\n",child_index);

    return(x); /* Tell code above that it is the parent returning */
}

Here is the call graph for this function:

static void pit ( int  sckt,
struct timeval tp 
) [static]

Definition at line 24180 of file iozone.c.

{
   char bfr[ MAXBFRSIZE+1 ];
   int  inBytes;
   long long value;
   /*
   ** Send a datagram to the server to wake it up.  The content isn't
   ** important, but something must be sent to let it know we want the TOD.
   */
   junk=write( sckt, "Are you there?", 14 );
   /*
   ** Read the PIT from the remote host.
   */
   inBytes = read( sckt, bfr, MAXBFRSIZE );
   bfr[ inBytes ] = '\0';   /* Null-terminate the received string. */
   /* 
    * Convert result to timeval structure format 
    */
   sscanf(bfr,"%llu\n",&value);
   tp->tv_sec = (long)(value / 1000000);
   tp->tv_usec = (long)(value % 1000000);
}  

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

int pit_gettimeofday ( struct timeval tp,
struct timezone *  foo,
char *  pit_hostname,
char *  pit_service 
)

Definition at line 24065 of file iozone.c.

{
    int             sckt;          /* socket descriptor */
    unsigned scopeId = 0;

    /* See if the interdimensional rift is active */
    
    if(pit_hostname[0] == 0)
    {
        return gettimeofday(tp,foo);
    }

    if ( ( sckt = openSckt( pit_hostname,
                           pit_service,
                           scopeId ) ) == INVALID_DESC )
    {
            fprintf( stderr,
                  "Sorry... a connectionless socket could "
                  "not be set up.\n");
                return -1;
    }
    /*
    ** Get the remote PIT.
    */
    pit( sckt ,tp );
    close(sckt);
        return 0;
}

Here is the call graph for this function:

void Poll ( )

Here is the caller graph for this function:

void Poll ( long long  time1)

Definition at line 12163 of file iozone.c.

{
    struct timeval howlong;
    howlong.tv_sec=(int)(time1/100000);
    howlong.tv_usec=(int)(time1%100000); /* Get into u.s. */
    select(0, 0, 0, 0, &howlong);
}

Here is the call graph for this function:

void prepage ( )

Here is the caller graph for this function:

void prepage ( char *  buffer,
long long  reclen 
)

Definition at line 7236 of file iozone.c.

{
    char *where;
    long long i;
    where=(char *)buffer;
    for(i=0;i<(reclen/cache_line_size);i++)
    {
        *(where)=PATTERN;
        where+=cache_line_size;
    }
}
void print_header ( )

Definition at line 11351 of file iozone.c.

{
    if(Eflag)
    {
           if(!silent) printf(CONTROL_STRING2,
        " ", 
        " ",
        " ",
        " ",
        " ",
        " ",
        "random",           /*kcollins:2-5-96*/
        "random",           /*kcollins:2-5-96*/
        "bkwd",
        "record",
        "stride",
        " ",
        " ",
        " ",
        " "
#ifdef HAVE_PREAD
        ," ",
        " ",
        " ",
        " "
#ifdef HAVE_PREADV
        ," ",
        " ",
        " ",
        " "
#endif
#endif
        );
        if(!silent) printf(CONTROL_STRING2,
        "KB", 
        "reclen",
        "write",
        "rewrite",
        "read",
        "reread",
        "read",             /*kcollins:2-5-96*/
        "write",            /*kcollins:2-5-96*/
        "read",
        "rewrite",
        "read",
        "fwrite",
        "frewrite",
        "fread",
        "freread"
#ifdef HAVE_PREAD
        ,"pwrite",
        "repwrite",
        "pread",
        "repread"
#ifdef HAVE_PREADV
        ,"pwritev",
        "repwritev",
        "preadv",
        "repreadv"
#endif
#endif
        );
    }else 
    if(RWONLYflag){             /*kcollins 8-21-96*/
           if(!silent) printf(CONTROL_STRING4,      /*kcollins 8-21-96*/
        " ",                /*kcollins 8-21-96*/
        " ",                /*kcollins 8-21-96*/
        " ",                /*kcollins 8-21-96*/
        " ",                /*kcollins 8-21-96*/
        " ",                /*kcollins 8-21-96*/
        " "             /*kcollins 8-21-96*/
        );              /*kcollins 8-21-96*/
        if(!silent) printf(CONTROL_STRING4,         /*kcollins 8-21-96*/
        "KB",               /*kcollins 8-21-96*/
        "reclen",           /*kcollins 8-21-96*/
        "write",            /*kcollins 8-21-96*/
        "rewrite",          /*kcollins 8-21-96*/
        "read",             /*kcollins 8-21-96*/
        "reread"            /*kcollins 8-21-96*/
        );              /*kcollins 8-21-96*/
    }else{
       if(!(mmapflag || async_flag))
       {
            if(!silent) printf(CONTROL_STRING3,
            " ", 
            " ",
            " ",
            " ",
            " ",
            " ",
            "random",           /*kcollins:2-5-96*/
            "random",           /*kcollins:2-5-96*/
            "bkwd",
            "record",
            "stride",
            "",
            "",
            "",
            ""
            );
            if(!silent) printf(CONTROL_STRING3,
            "KB", 
            "reclen",
            "write",
            "rewrite",
            "read",
            "reread",
            "read",             /*kcollins:2-5-96*/
            "write",            /*kcollins:2-5-96*/
            "read",
            "rewrite",
            "read",
            "fwrite",
            "frewrite",
            "fread",
            "freread" 
            );
        }else
        {
                if(!silent) printf(CONTROL_STRING3,
                " ", 
                " ",
                " ",
                " ",
                " ",
                " ",
                "random",           /*kcollins:2-5-96*/
                "random",           /*kcollins:2-5-96*/
                "bkwd",
                "record",
                "stride",
                "",
                "",
                "",
                ""
                );
                if(!silent) printf(CONTROL_STRING3,
                "KB", 
                "reclen",
                "write",
                "rewrite",
                "read",
                "reread",
                "read",             /*kcollins:2-5-96*/
                "write",            /*kcollins:2-5-96*/
                "read",
                "rewrite",
                "read",
                "",
                "",
                "",
                "" 
                );
        }
    }
}

Here is the caller graph for this function:

Definition at line 12274 of file iozone.c.

{
    char command[1024];
    int ret,i;
    strcpy(command,"umount ");
    strcat(command, mountname);
        /*
           umount might fail if the device is still busy, so
           retry unmounting several times with increasing delays
        */
        for (i = 1; i < 200; ++i) {
               ret = system(command);
               if (ret == 0)
                       break;
               sleep(i); /* seconds */
        }
    strcpy(command,"mount ");
    strcat(command, mountname);
    /*
         mount might fail if the device is still busy, so
         retry mounting several times with increasing delays
        */
        for (i = 1; i < 10; ++i) {
              ret = system(command);
              if (ret == 0)
                   break;
                   sleep(i); /* seconds */
         }
}

Here is the call graph for this function:

void purgeit ( )

Here is the caller graph for this function:

void purgeit ( char *  buffer,
long long  reclen 
)

Definition at line 7203 of file iozone.c.

{
    char *where;
    long rsize;
    long tsize;
    VOLATILE long long x[200];
    long i,cache_lines_per_rec;
    long cache_lines_per_cache;
    tsize = 200;
    cache_lines_per_rec = (long)(reclen/cache_line_size);
    cache_lines_per_cache = (long)(cache_size/cache_line_size);
    rsize = (long)l_min((long long)cache_lines_per_rec,(long long)cache_lines_per_cache);
#ifdef _64BIT_ARCH_
    where=(char *)pbuffer + ((unsigned long long)buffer & (cache_size-1));
#else
    where=(char *)pbuffer + ((long)buffer & ((long)cache_size-1));
#endif
    for(i=0;i<(rsize);i++)
    {
        x[i%tsize]=*(where);
        where+=cache_line_size;

    }
}

Here is the call graph for this function:

void r_traj_size ( )

Definition at line 19732 of file iozone.c.

{
    FILE *fd;
    int ret;
    long long traj_offset = 0;
    long long traj_size = 0;
    long long max_offset = 0;
    int tokens;
    int dummy;
    int lines;
    char buf[200];
    char sbuf[200];
    char *ret1,*where;

    lines=0;
    fd=fopen(read_traj_filename,"r");
    if(fd == (FILE *)0)
    {
        printf("Unable to open read telemetry file \"%s\"\n",
            read_traj_filename);
        exit(174);
    }
    while(1)
    {
        tokens=0;
        ret1=fgets(buf,200,fd);
        if(ret1==(char *)0)
            break;
        where=(char *)&buf[0];
        strcpy(sbuf,buf);
        lines++;
        if((*where=='#') || (*where=='\n'))
            continue;
        tokens++;
        strtok(where," ");
        while( (char *)(strtok( (char *)0," ")) != (char *)0)
        {
            tokens++;
        }
        if(tokens==1)
        {
            printf("\n\tInvalid read telemetry file entry. Line %d",
                lines);
            signal_handler();
        }
#ifdef DEBUG
    printf("Tokens = %d\n",tokens);
#endif
        if(tokens==3)
        {
#ifdef NO_PRINT_LLD
            ret=sscanf(sbuf,"%ld %ld %d\n",&traj_offset,&traj_size,&dummy);
#else
            ret=sscanf(sbuf,"%lld %lld %d\n",&traj_offset,&traj_size,&dummy);
#endif
        }
        if(tokens==2)
        {
#ifdef NO_PRINT_LLD
            ret=sscanf(sbuf,"%ld %ld\n",&traj_offset,&traj_size);
#else
            ret=sscanf(sbuf,"%lld %lld\n",&traj_offset,&traj_size);
#endif
        }
        if((tokens != 2) && (tokens !=3))
        {
            printf("\n\tInvalid read telemetry file. Line %d\n",lines);
            exit(178);
        }
        if(traj_offset + traj_size > max_offset)
            max_offset=traj_offset + traj_size;
        
        r_traj_ops++;
    }   
    r_traj_fsize=max_offset;
#ifdef DEBUG
    printf("File size of read %lld Item count %lld\n",r_traj_fsize,r_traj_ops);
#endif
    fclose(fd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int rand ( )

Here is the caller graph for this function:

void random_perf_test ( )
void random_perf_test ( off64_t  kilo64,
long long  reclen,
long long *  data1,
long long *  data2 
)

Definition at line 8791 of file iozone.c.

{
    double randreadtime[2];
    double starttime2;
    double walltime[2], cputime[2];
    double compute_val = (double)0;
#if defined (bsd4_2) || defined(Windows)
    long long rand1,rand2,rand3;
#endif
    unsigned long long big_rand;
    long long j;
    off64_t i,numrecs64;
    long long Index=0;
    int flags;
    unsigned long long randreadrate[2];
    off64_t filebytes64;
    off64_t lock_offset=0;
    volatile char *buffer1;
    char *wmaddr,*nbuff;
    char *maddr,*free_addr;
    int fd,wval;
    long long *recnum= 0;
#if defined(VXFS) || defined(solaris)
    int test_foo=0;
#endif
#ifdef ASYNC_IO
    struct cache *gc=0;
#else
    long long *gc=0;
#endif
#ifdef MERSENNE
    unsigned long long init[4]={0x12345ULL, 0x23456ULL, 0x34567ULL, 0x45678ULL};
    unsigned long long length=4;
#endif

    maddr=free_addr=0;
    numrecs64 = (kilo64*1024)/reclen;
#ifdef MERSENNE
       init_by_array64(init, length);
#else
#ifdef bsd4_2
        srand(0);
#else
#ifdef Windows
        srand(0);
#else
        srand48(0);
#endif
#endif
#endif
        recnum = (long long *)malloc(sizeof(*recnum)*numrecs64);
        if (recnum){
             /* pre-compute random sequence based on 
        Fischer-Yates (Knuth) card shuffle */
            for(i = 0; i < numrecs64; i++){
                recnum[i] = i;
            }
            for(i = 0; i < numrecs64; i++) {
                long long tmp;
#ifdef MERSENNE
               big_rand=genrand64_int64();
#else
#ifdef bsd4_2
               rand1=(long long)rand();
               rand2=(long long)rand();
               rand3=(long long)rand();
               big_rand=(rand1<<32)|(rand2<<16)|(rand3);
#else
#ifdef Windows
               rand1=(long long)rand();
               rand2=(long long)rand();
               rand3=(long long)rand();
               big_rand=(rand1<<32)|(rand2<<16)|(rand3);
#else
               big_rand = lrand48();
#endif
#endif
#endif
               big_rand = big_rand%numrecs64;
               tmp = recnum[i];
               recnum[i] = recnum[big_rand];
               recnum[big_rand] = tmp;
            }
        }
    else
    {
        fprintf(stderr,"Random uniqueness fallback.\n");
    }
    flags = O_RDWR;
#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        flags |=O_DIRECTIO;
#endif
#endif
    fd=0;
    if(oflag)
        flags |= O_SYNC;
#if defined(O_DSYNC)
    if(odsync)
        flags |= O_DSYNC;
#endif
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        flags |=O_RSYNC|O_SYNC;
#endif
    filebytes64 = numrecs64*reclen;
    for( j=0; j<2; j++ )
    {
        if(j==0)
            flags |=O_CREAT;
        if (no_write && (j == 1))
            continue;
        if(cpuutilflag)
        {
             walltime[j] = time_so_far();
             cputime[j]  = cputime_so_far();
         }
         if(Uflag) /* Unmount and re-mount the mountpoint */
         {
            purge_buffer_cache();
         }
         if((fd = I_OPEN(filename, ((int)flags),0640))<0){
            printf("\nCan not open temporary file for read/write\n");
            perror("open");
            exit(66);
         }
#ifdef ASYNC_IO
        if(async_flag)
            async_init(&gc,fd,direct_flag);
#endif

#ifdef VXFS
        if(direct_flag)
        {
            ioctl(fd,VX_SETCACHE,VX_DIRECT);
            ioctl(fd,VX_GETCACHE,&test_foo);
            if(test_foo == 0)
            {
                if(!client_iozone)
                  printf("\nVxFS advanced setcache feature not available.\n");
                exit(3);
            }
        }
#endif
#if defined(solaris)
               if(direct_flag)
               {
                       test_foo = directio(fd, DIRECTIO_ON);
                       if(test_foo != 0)
                       {
                               if(!client_iozone)
                                 printf("\ndirectio not available.\n");
                               exit(3);
                       }
               }
#endif
         if(mmapflag)
         {
            maddr=(char *)initfile(fd,filebytes64,0,PROT_READ|PROT_WRITE);
         }
         nbuff=mainbuffer;
         if(fetchon)
           fetchit(nbuff,reclen);
#ifdef MERSENNE
            init_by_array64(init, length);
#else
#ifdef bsd4_2
         srand(0);
#else
#ifdef Windows
             srand(0);
#else
             srand48(0);
#endif
#endif
#endif
         compute_val=(double)0;
         starttime2 = time_so_far();
         if ( j==0 ){
        for(i=0; i<numrecs64; i++) {
            if(compute_flag)
                compute_val+=do_compute(compute_time);
                        if(multi_buffer)
                        {
                                Index +=reclen;
                                if(Index > (MAXBUFFERSIZE-reclen))
                                        Index=0;
                                nbuff = mbuffer + Index;
                        }
            if(purge)
                purgeit(nbuff,reclen);
                        if (recnum) {
                offset64 = reclen * (long long)recnum[i];
                        }
            else
            {

#ifdef MERSENNE
                   big_rand =genrand64_int64();
               offset64 = reclen * (big_rand%numrecs64);
#else
#ifdef bsd4_2
               rand1=(long long)rand();
               rand2=(long long)rand();
               rand3=(long long)rand();
               big_rand=(rand1<<32)|(rand2<<16)|(rand3);
                           offset64 = reclen * (big_rand%numrecs64);
#else
#ifdef Windows
               rand1=(long long)rand();
               rand2=(long long)rand();
               rand3=(long long)rand();
               big_rand=(rand1<<32)|(rand2<<16)|(rand3);
                           offset64 = reclen * (big_rand%numrecs64);
#else
               offset64 = reclen * (lrand48()%numrecs64);
#endif
#endif
#endif
            }

            if( !(h_flag || k_flag || mmapflag))
            {
               if(I_LSEEK( fd, offset64, SEEK_SET )<0)
               {
                perror("lseek");
                exit(68);
               };
            }
            if(rlocking)
            {
                lock_offset=I_LSEEK(fd,0,SEEK_CUR);
                mylockr((int) fd, (int) 1, (int)1,
                  lock_offset, reclen);
            }
            if(mmapflag)
            {
                wmaddr=&maddr[offset64];
                fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
            }
            else
            {
              if(async_flag)
              {
                 if(no_copy_flag)
                    async_read_no_copy(gc, (long long)fd, &buffer1, offset64,reclen,
                      0LL,(numrecs64*reclen),depth);
                 else
                 async_read(gc, (long long)fd, nbuff, (offset64),reclen,
                            0LL,(numrecs64*reclen),0LL);
              }
              else
              {
                 if(read(fd, (void *)nbuff, (size_t)reclen) != reclen)
                 {
#ifdef NO_PRINT_LLD
                 printf("\nError reading block at %ld\n",
                     offset64); 
#else
                 printf("\nError reading block at %lld\n",
                     offset64); 
#endif
                 perror("read");
                 exit(70);
                 }
              }
            }
            if(verify){
              if(async_flag && no_copy_flag)
              {
                if(verify_buffer(buffer1,reclen,(off64_t)offset64/reclen,reclen,(long long)pattern,sverify)){
                    exit(71);
                }
              }
              else
              {
                if(verify_buffer(nbuff,reclen,(off64_t)offset64/reclen,reclen,(long long)pattern,sverify)){
                    exit(72);
                }
              }
            }
            if(async_flag && no_copy_flag)
                async_release(gc);
            if(rlocking)
            {
                lock_offset=I_LSEEK(fd,0,SEEK_CUR);
                mylockr((int) fd, (int) 1, (int)1,
                  lock_offset, reclen);
            }
        }
         }
         else
         {
            if(verify || dedup || dedup_interior)
                fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
            for(i=0; i<numrecs64; i++) 
            {
                if(compute_flag)
                    compute_val+=do_compute(compute_time);
                            if(multi_buffer)
                            {
                                    Index +=reclen;
                                    if(Index > (MAXBUFFERSIZE-reclen))
                                         Index=0;
                                    nbuff = mbuffer + Index;
                            }
                                if (recnum) {
                  offset64 = reclen * (long long)recnum[i];
                                }
                    else
                    {
#ifdef bsd4_2
                  rand1=(long long)rand();
                  rand2=(long long)rand();
                  rand3=(long long)rand();
                  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
                  offset64 = reclen * (big_rand%numrecs64);
#else
#ifdef Windows
                  rand1=(long long)rand();
                  rand2=(long long)rand();
                  rand3=(long long)rand();
                  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
                  offset64 = reclen * (big_rand%numrecs64);
#else
                  offset64 = reclen * (lrand48()%numrecs64);
#endif
#endif
                }
                if(async_flag && no_copy_flag)
                {
                    free_addr=nbuff=(char *)malloc((size_t)reclen+page_size);
                    nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
                    if(verify || dedup || dedup_interior)
                        fill_buffer(nbuff,reclen,(long long)pattern,sverify,offset64/reclen);
                }
                if(purge)
                    purgeit(nbuff,reclen);

                if((verify & diag_v) || dedup || dedup_interior)
                    fill_buffer(nbuff,reclen,(long long)pattern,sverify,offset64/reclen);

                if (!(h_flag || k_flag || mmapflag))
                {
                  I_LSEEK( fd, offset64, SEEK_SET );
                }
                if(rlocking)
                {
                    lock_offset=I_LSEEK(fd,0,SEEK_CUR);
                    mylockr((int) fd, (int) 1, (int)0,
                      lock_offset, reclen);
                }
                if(mmapflag)
                {
                    wmaddr=&maddr[offset64];
                    fill_area((long long*)nbuff,(long long*)wmaddr,(long long)reclen);
                    if(!mmapnsflag)
                    {
                        if(mmapasflag)
                                msync(wmaddr,(size_t)reclen,MS_ASYNC);
                        if(mmapssflag)
                                msync(wmaddr,(size_t)reclen,MS_SYNC);
                    }
                }
                else
                {
                    if(async_flag)
                    {
                           if(no_copy_flag)
                              async_write_no_copy(gc, (long long)fd, nbuff, reclen, offset64, 
                        depth,free_addr);
                       else
                            async_write(gc, (long long)fd, nbuff, reclen, offset64, depth);
                    }
                    else
                    {
                      wval=write(fd, nbuff,(size_t)reclen);
                      if(wval != reclen)
                      {
#ifdef NO_PRINT_LLD
                        printf("\nError writing block at %ld\n",
                            offset64); 
#else
                        printf("\nError writing block at %lld\n",
                            offset64); 
#endif
                        if(wval==-1)
                            perror("write");
                        signal_handler();
                      }
                    }
                }
                if(rlocking)
                {
                    mylockr((int) fd, (int) 0, (int)0,
                      lock_offset, reclen);
                }
            }
         }  /* end of modifications *kcollins:2-5-96 */
#ifdef ASYNC_IO
         if(async_flag)
         {
        end_async(gc);
            gc=0;
             }  
#endif
         if(include_flush)
         {
        if(mmapflag)
            msync(maddr,(size_t)filebytes64,MS_SYNC);/* Clean up before read starts running */
        else
        {
                wval=fsync(fd);
            if(wval==-1){
                perror("fsync");
                signal_handler();
            }
        }
         }
         if(include_close)
         {
        if(mmapflag)
        {
            mmap_end(maddr,(unsigned long long)filebytes64);
        }
        wval=close(fd);
        if(wval==-1){
            perror("close");
            signal_handler();
        }
         }
         randreadtime[j] = ((time_so_far() - starttime2)-time_res)-
            compute_val;
         if(randreadtime[j] < (double).000001) 
         {
            randreadtime[j]=time_res;
            if(rec_prob < reclen)
                rec_prob = reclen;
            res_prob=1;
         }
        if(!include_close)
        {
        if(mmapflag)
        {
            msync(maddr,(size_t)filebytes64,MS_SYNC);/* Clean up before read starts running */
        }
        else
        {
                wval=fsync(fd);
            if(wval==-1){
                perror("fsync");
                signal_handler();
            }
        }
        if(mmapflag)
            mmap_end(maddr,(unsigned long long)filebytes64);
        wval=close(fd);
        if(wval==-1){
            perror("close");
            signal_handler();
        }
        }
            if(cpuutilflag)
        {
            cputime[j]  = cputime_so_far() - cputime[j];
            if (cputime[j] < cputime_res)
            cputime[j] = 0.0;
            walltime[j] = time_so_far() - walltime[j];
        if (walltime[j] < cputime[j])
           walltime[j] = cputime[j];
        }
        if(restf)
        sleep((int)rest_val);
        }
    if(OPS_flag || MS_flag){
       filebytes64=filebytes64/reclen;
    }
        for(j=0;j<2;j++)
        {
        if(no_write && (j==1))
        {
            randreadrate[1] = 0.0;
        continue;
        }
        if(MS_flag)
        {
        randreadrate[j]=1000000.0*(randreadtime[j] / (double)filebytes64);
        continue;
        }
            else
            {
                  randreadrate[j] = 
              (unsigned long long) ((double) filebytes64 / randreadtime[j]);
            }
        if(!(OPS_flag || MS_flag))
        randreadrate[j] >>= 10;
    }
    /* Must save walltime & cputime before calling store_value() for each/any cell.*/
        if(cpuutilflag)
        store_times(walltime[0], cputime[0]);
    store_value((off64_t)randreadrate[0]);
        if(cpuutilflag)
        store_times(walltime[1], cputime[1]);
    store_value((off64_t)randreadrate[1]);
#ifdef NO_PRINT_LLD
    if(!silent) printf("%8ld",randreadrate[0]);
    if(!silent) printf("%8ld",randreadrate[1]);
    if(!silent) fflush(stdout);
#else
    if(!silent) printf("%8lld",randreadrate[0]);
    if(!silent) printf("%8lld",randreadrate[1]);
    if(!silent) fflush(stdout);
#endif
    if(recnum)
        free(recnum);
}

Here is the call graph for this function:

void read_perf_test ( )
void read_perf_test ( off64_t  kilo64,
long long  reclen,
long long *  data1,
long long*  data2 
)

Definition at line 8282 of file iozone.c.

{
    double starttime2;
    double compute_val = (double)0;
    double readtime[2];
    double walltime[2], cputime[2];
#ifdef unix
    double qtime_u_start,qtime_u_stop;
    double qtime_s_start,qtime_s_stop;
#endif
    long long j;
    long long traj_size;
    off64_t i,numrecs64,traj_offset;
    off64_t lock_offset=0;
    long long Index = 0;
    unsigned long long readrate[2];
    off64_t filebytes64;
    volatile char *buffer1;
    char *nbuff;
    char *maddr;
    char *wmaddr;
    int fd,open_flags;
    int test_foo,ltest;
    long wval;
    double qtime_start,qtime_stop;
    double hist_time;
#ifdef ASYNC_IO
    struct cache *gc=0;

#else
    long long *gc=0;
#endif
#ifdef unix
    qtime_u_start=qtime_u_stop=0;
    qtime_s_start=qtime_s_stop=0;
#endif
    hist_time=qtime_start=qtime_stop=0;
    maddr=0;
    traj_offset=0;
    test_foo=0;
    numrecs64 = (kilo64*1024)/reclen;

    open_flags = O_RDONLY;
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        open_flags |=O_RSYNC|O_SYNC;
#endif
#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        open_flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        open_flags |=O_DIRECTIO;
#endif
#endif
    if(r_traj_flag)
    {
        numrecs64=r_traj_ops;
        filebytes64 = r_traj_fsize;
    } else
        filebytes64 = numrecs64*reclen;
    fd = 0;
    if(Q_flag && (!rol_opened))
    {
        rol_opened++;
        rqfd=fopen("rol.dat","a");
        if(rqfd==0)
        {
            printf("Unable to open rol.dat\n");
            exit(56);
        }
        fprintf(rqfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
        rrqfd=fopen("rrol.dat","a");
        if(rrqfd==0)
        {
            printf("Unable to open rrol.dat\n");
            exit(57);
        }
        fprintf(rrqfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
    }
    /* 
     * begin real testing
     */
    if(noretest)
        ltest=1;
    else
        ltest=2;

    for( j=0; j<ltest; j++ )
    {

        if(cpuutilflag)
        {
            walltime[j] = time_so_far();
            cputime[j]  = cputime_so_far();
        }

        if(Uflag) /* Unmount and re-mount the mountpoint */
        {
            purge_buffer_cache();
        }
#if defined(Windows)
            if(unbuffered)
            {
                hand=CreateFile(filename,
              GENERIC_READ|GENERIC_WRITE,
                  FILE_SHARE_WRITE|FILE_SHARE_READ,
              NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
              FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
              NULL);
                }
            else
            {
#endif
        if((fd = I_OPEN(filename, open_flags,0))<0)
        {
            printf("\nCan not open temporary file %s for read\n",filename);
            perror("open");
            exit(58);
        }
#if defined(Windows)
        }
#endif
#ifdef ASYNC_IO
        if(async_flag)
            async_init(&gc,fd,direct_flag);
#endif

#ifdef VXFS
        if(direct_flag)
        {
            ioctl(fd,VX_SETCACHE,VX_DIRECT);
            ioctl(fd,VX_GETCACHE,&test_foo);
            if(test_foo == 0)
            {
                if(!client_iozone)
                  printf("\nVxFS advanced setcache feature not available.\n");
                exit(3);
            }
        }
#endif
#if defined(solaris)
               if(direct_flag)
               {
                       test_foo = directio(fd, DIRECTIO_ON);
                       if(test_foo != 0)
                       {
                               if(!client_iozone)
                                 printf("\ndirectio not available.\n");
                               exit(3);
                       }
               }
#endif
        if(file_lock)
            if(mylockf((int) fd, (int) 1, (int)1) != 0)
                printf("File lock for read failed. %d\n",errno);
        if(mmapflag)
        {
            maddr=(char *)initfile(fd,filebytes64,0,PROT_READ);
        }
#if defined(Windows)
        if(!unbuffered)
#endif
          fsync(fd);
        /* 
         *  Need to prime the instruction cache & TLB
         */
        nbuff=mainbuffer;
        if(fetchon)
            fetchit(nbuff,reclen);
#if defined(Windows)
        if(!unbuffered)
        {
#endif
        if(read(fd, (void *)nbuff, (size_t) reclen) != reclen)
        {
#ifdef _64BIT_ARCH_
            printf("\nError reading block %d %llx\n", 0,
                (unsigned long long)nbuff);
#else
            printf("\nError reading block %d %lx\n", 0,
                (long)nbuff);
#endif
            perror("read");
            exit(60);
        }
        I_LSEEK(fd,0,SEEK_SET);
#if defined(Windows)
        }
        if(unbuffered)
            SetFilePointer(hand,(LONG)0,0,FILE_BEGIN);
#endif
        nbuff=mainbuffer;

        if(fetchon)
            fetchit(nbuff,reclen);
        starttime2 = time_so_far();
#ifdef unix
        if(Q_flag || hist_summary)
        {
            qtime_u_start=utime_so_far();
            qtime_s_start=stime_so_far();
        }
#endif
        if(r_traj_flag)
        {
            rewind(r_traj_fd);
        }
        compute_val=(double)0;
        r_traj_ops_completed=0;
        r_traj_bytes_completed=0;
        for(i=0; i<numrecs64; i++) 
        {
            if(disrupt_flag && ((i%DISRUPT)==0))
            {
#if defined(Windows)
    
                if(unbuffered)
                   disruptw(hand);
                else
                   disrupt(fd);
#else
                disrupt(fd);
#endif
            }
            if(r_traj_flag)
            {
                traj_offset=get_traj(r_traj_fd, (long long *)&traj_size,(float *)&compute_time, (long)0);
                reclen=traj_size;
#if defined(Windows)
            if(unbuffered)
              SetFilePointer(hand,(LONG)traj_offset,0,FILE_BEGIN);
            else
#endif
                I_LSEEK(fd,traj_offset,SEEK_SET);
            }
            if(Q_flag)
            {
#if defined(Windows)
            if(unbuffered)
              traj_offset=SetFilePointer(hand,(LONG)0,0,FILE_CURRENT);
            else
#endif
                traj_offset=I_LSEEK(fd,0,SEEK_CUR);
            }
            if(rlocking)
            {
                lock_offset=I_LSEEK(fd,0,SEEK_CUR);
                mylockr((int) fd, (int) 1, (int)1,
                  lock_offset, reclen);
            }
            if(compute_flag)
                compute_val+=do_compute(compute_time);
                        if(multi_buffer)
                        {
                                Index +=reclen;
                                if(Index > (MAXBUFFERSIZE-reclen))
                                        Index=0;
                                nbuff = mbuffer + Index;
                        }
            if(purge)
                purgeit(nbuff,reclen);
            if(Q_flag || hist_summary)
                qtime_start=time_so_far();
            if(mmapflag)
            {
                wmaddr=&maddr[i*reclen];
                fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
            }
            else
            {
              if(async_flag)
              {
                if(no_copy_flag)
                  async_read_no_copy(gc, (long long)fd, &buffer1, (i*reclen), reclen,
                    1LL,(numrecs64*reclen),depth);
                else
                  async_read(gc, (long long)fd, nbuff, (i*reclen),reclen,
                    1LL,(numrecs64*reclen),depth);
              }
              else
              {
#if defined(Windows)
                    if(unbuffered)
                    {
                ReadFile(hand, nbuff, reclen,(LPDWORD)&wval,
                    0);
                }
                else
#endif
                  wval=read((int)fd, (void*)nbuff, (size_t) reclen);
                if(wval != reclen)
                {
#ifdef _64BIT_ARCH_
#ifdef NO_PRINT_LLD
                printf("\nError reading block %ld %lx\n", i,
                    (unsigned long long)nbuff);
#else
                printf("\nError reading block %lld %llx\n", i,
                    (unsigned long long)nbuff);
#endif
#else
#ifdef NO_PRINT_LLD
                printf("\nError reading block %ld %x\n", i,
                    (long)nbuff);
#else
                printf("\nError reading block %lld %lx\n", i,
                    (long)nbuff);
#endif
#endif
                perror("read");
                exit(61);
                }
              }
            }
            if(verify) {
              if(async_flag && no_copy_flag)
              {
                if(verify_buffer(buffer1,reclen,(off64_t)i,reclen,(long long)pattern,sverify)){
                    exit(62);
                }
              }
              else
              {
                if(verify_buffer(nbuff,reclen,(off64_t)i,reclen,(long long)pattern,sverify)){
                    exit(63);
                }
              }
            }
            if(async_flag && no_copy_flag)
                async_release(gc);
            buffer1=0;
            if(hist_summary)
            {
                qtime_stop=time_so_far();
                hist_time =(qtime_stop-qtime_start-time_res);
                hist_insert(hist_time);
            }
            if(Q_flag)
            {
                qtime_stop=time_so_far();
                if(j==0)
#ifdef NO_PRINT_LLD
                fprintf(rqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,(qtime_stop-qtime_start-time_res)*1000000,reclen);
                else
                fprintf(rrqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,(qtime_stop-qtime_start-time_res)*1000000,reclen);
#else
                fprintf(rqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,(qtime_stop-qtime_start-time_res)*1000000,reclen);
                else
                fprintf(rrqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,(qtime_stop-qtime_start-time_res)*1000000,reclen);
#endif
            }
            r_traj_ops_completed++;
            r_traj_bytes_completed+=reclen;
        }
        if(rlocking)
        {
            mylockr((int) fd, (int) 0, (int)1,
              lock_offset, reclen);
        }
        if(file_lock)
            if(mylockf((int) fd, (int) 0, (int)1))
                printf("Read unlock failed. %d\n",errno);
#ifdef unix
        if(Q_flag)
        {
           qtime_u_stop=utime_so_far();
           qtime_s_stop=stime_so_far();
           if(j==0)
             fprintf(rqfd,"\nSystem time %10.3f User time %10.3f Real %10.3f  (seconds)\n",
                (qtime_s_stop-qtime_s_start)/sc_clk_tck,
                (qtime_u_stop-qtime_u_start)/sc_clk_tck,
                time_so_far()-starttime2);
           else
            fprintf(rrqfd,"\nSystem time %10.3f User time %10.3f Real %10.3f  (seconds)\n",
                (qtime_s_stop-qtime_s_start)/sc_clk_tck,
                (qtime_u_stop-qtime_u_start)/sc_clk_tck,
                time_so_far()-starttime2);
        }
#endif
#ifdef ASYNC_IO
        if(async_flag)
        {
            end_async(gc);
            gc=0;
        }
#endif
        if(include_flush)
        {
            if(mmapflag)
                msync(maddr,(size_t)filebytes64,MS_SYNC);
            else
                fsync(fd);
        }
        if(include_close)
        {
            if(mmapflag)
            {
                mmap_end(maddr,(unsigned long long)filebytes64);
            }
#if defined(Windows)
            if(unbuffered)
                CloseHandle(hand);
            else
#endif
            close(fd);
        }
        readtime[j] = ((time_so_far() - starttime2)-time_res)-compute_val;
        if(readtime[j] < (double).000001) 
        {
            readtime[j]= time_res;
            if(rec_prob < reclen)
                rec_prob = reclen;
            res_prob=1;
        }
        if(!include_close)
        {
            if(mmapflag)
                msync(maddr,(size_t)filebytes64,MS_SYNC);
            else
                fsync(fd);
            if(mmapflag)
            {
                mmap_end(maddr,(unsigned long long)filebytes64);
            }
#if defined(Windows)
            if(unbuffered)
                CloseHandle(hand);
            else
#endif
            close(fd);
        }
        if(cpuutilflag)
        {
            cputime[j]  = cputime_so_far() - cputime[j];
            if (cputime[j] < cputime_res)
                cputime[j] = 0.0;
            walltime[j] = time_so_far() - walltime[j];
            if (walltime[j] < cputime[j])
               walltime[j] = cputime[j];
        }
        if(restf)
            sleep((int)rest_val);
        }
    if(OPS_flag || MS_flag){
       filebytes64=r_traj_ops_completed;
       /*filebytes64=filebytes64/reclen;*/
    } else
       filebytes64=r_traj_bytes_completed;

        for(j=0;j<ltest;j++)
        {
        if(MS_flag)
        {
            readrate[j]=1000000.0*(readtime[j] / (double)filebytes64);
            continue;
        }
            else
            {
                  readrate[j] = 
                  (unsigned long long) ((double) filebytes64 / readtime[j]);
            }
        if(!(OPS_flag || MS_flag))
            readrate[j] >>= 10;
            
    }
    data1[0]=readrate[0];
    data2[0]=1;
    if(noretest)
    {
        readrate[1]=(long long)0;
        if(cpuutilflag)
        {
            walltime[1]=0.0;
            cputime[1]=0.0;
        }
    }
    /* Must save walltime & cputime before calling store_value() for each/any cell.*/
    if(cpuutilflag)
        store_times(walltime[0], cputime[0]);
    store_value((off64_t)readrate[0]);
    if(cpuutilflag)
        store_times(walltime[1], cputime[1]);
    store_value((off64_t)readrate[1]);
#ifdef NO_PRINT_LLD
    if(!silent) printf("%9ld",readrate[0]);
    if(!silent) printf("%9ld",readrate[1]);
    if(!silent) fflush(stdout);
#else
    if(!silent) printf("%9lld",readrate[0]);
    if(!silent) printf("%9lld",readrate[1]);
    if(!silent) fflush(stdout);
#endif
}

Here is the call graph for this function:

void read_stride_perf_test ( off64_t  kilos64,
long long  reclen,
long long *  data1,
long long *  data2 
)

Definition at line 9933 of file iozone.c.

{
    double strideintime;
    double starttime1;
    double compute_val = (double)0;
    double walltime, cputime;
    off64_t numrecs64,current_position;
    long long Index = 0;
    off64_t i,savepos64 = 0;
    unsigned long long strideinrate;
    off64_t filebytes64;
    off64_t lock_offset=0;
    long long uu;
    off64_t stripewrap=0;
    int fd,open_flags;
    volatile char *buffer1;
    char *nbuff;
    char *maddr;
    char *wmaddr;
#if defined(VXFS) || defined(solaris)
    int test_foo=0;
#endif
#ifdef ASYNC_IO
    struct cache *gc=0;
#else
    long long *gc=0;
#endif

    walltime=cputime=0;
    nbuff=maddr=wmaddr=0;
    open_flags=O_RDONLY;
#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        open_flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        open_flags |=O_DIRECTIO;
#endif
#endif
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        open_flags |=O_RSYNC|O_SYNC;
#endif
    next64 = (off64_t)0;
    numrecs64 = (kilos64*1024)/reclen;
    filebytes64 = numrecs64*reclen;
    if(Uflag) /* Unmount and re-mount the mountpoint */
    {
        purge_buffer_cache();
    }
        if((fd = I_OPEN(filename, (int)open_flags, 0640))<0)
        {
                    printf("\nCan not open temporary file for read\n");
            perror("open");
                    exit(86);
        }
#ifdef ASYNC_IO
    if(async_flag)
        async_init(&gc,fd,direct_flag);
#endif

#ifdef VXFS
    if(direct_flag)
    {
        ioctl(fd,VX_SETCACHE,VX_DIRECT);
        ioctl(fd,VX_GETCACHE,&test_foo);
        if(test_foo == 0)
        {
            if(!client_iozone)
              printf("\nVxFS advanced setcache feature not available.\n");
            exit(3);
        }
    }
#endif
#if defined(solaris)
               if(direct_flag)
               {
                       test_foo = directio(fd, DIRECTIO_ON);
                       if(test_foo != 0)
                       {
                               if(!client_iozone)
                                 printf("\ndirectio not available.\n");
                               exit(3);
                       }
               }
#endif
    if(mmapflag)
    {
        maddr=(char *)initfile(fd,filebytes64,0,PROT_READ);
    }
    fsync(fd);
    current_position=0;
    nbuff=mainbuffer;
    mbuffer=mainbuffer;
    if(fetchon)
        fetchit(nbuff,reclen);
    starttime1 = time_so_far();
    if(cpuutilflag)
    {
        walltime = time_so_far();
        cputime  = cputime_so_far();
    }
    for(i=0; i<numrecs64; i++){
        if(rlocking)
        {
            lock_offset=I_LSEEK(fd,0,SEEK_CUR);
            mylockr((int) fd, (int) 1, (int)1,
              lock_offset, reclen);
        }
        if(compute_flag)
            compute_val+=do_compute(compute_time);
            if(multi_buffer)
                {
                       Index +=reclen;
                       if(Index > (MAXBUFFERSIZE-reclen))
                                Index=0;
                       nbuff = mbuffer + Index;
                }
        if(purge)
            purgeit(nbuff,reclen);
        if(verify)
        {
            savepos64=current_position/reclen;
        }
        if(mmapflag)
        {
            wmaddr = &maddr[current_position];
            fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
        }
        else
        {
            if(async_flag)
            {
                if(no_copy_flag)
                  async_read_no_copy(gc, (long long)fd, &buffer1, current_position,
                    reclen, stride,(numrecs64*reclen),depth);
                else
                   async_read(gc, (long long)fd, nbuff, current_position, reclen,
                     stride,(numrecs64*reclen),depth);
            }
            else
            {
              if((uu=read((int)fd, (void*)nbuff, (size_t) reclen)) != reclen)
              {
#ifdef NO_PRINT_LLD
                    printf("\nError reading block %ld, fd= %d Filename %s Read returned %ld\n", i, fd,filename,uu);
                    printf("\nSeeked to %ld Reclen = %ld\n", savepos64,reclen);
#else
                    printf("\nError reading block %lld, fd= %d Filename %s Read returned %lld\n", i, fd,filename,uu);
                    printf("\nSeeked to %lld Reclen = %lld\n", savepos64,reclen);
#endif
                perror("read");
                    exit(88);
              }
            }
        }
        if(rlocking)
        {
            mylockr((int) fd, (int) 0, (int)1,
              lock_offset, reclen);
        }
        current_position+=reclen;
        if(verify){
            if(async_flag && no_copy_flag)
            {
               if(verify_buffer(buffer1,reclen, (off64_t)savepos64 ,reclen,(long long)pattern,sverify)){
                exit(89);
               }
            }
            else
            {
               if(verify_buffer(nbuff,reclen, (off64_t)savepos64 ,reclen,(long long)pattern,sverify)){
                exit(90);
               }
            }
        }
        if(async_flag && no_copy_flag)
            async_release(gc);
            
        /* This is a bit tricky.  The goal is to read with a stride through
           the file. The problem is that you need to touch all of the file
           blocks. So.. the first pass through you read with a constant stride.
           When you hit eof then add 1 to the beginning offset of the next
           time through the file. The rub here is that eventually adding
           1 will cause the initial start location plus the STRIDE to be
           beyond eof. So... when this happens the initial offset for the
           next pass needs to be set back to 0.
        */
        if(current_position + (stride * reclen) >= (numrecs64 * reclen)-reclen) 
        {
            current_position=0;

            stripewrap++;
              
            if(numrecs64 <= stride)
            {
                current_position=0;
            }
            else
            {
                current_position = (off64_t)((stripewrap)%numrecs64)*reclen;
            }

            if (!(h_flag || k_flag || mmapflag))
            {
              if(I_LSEEK(fd,current_position,SEEK_SET)<0)
              {
                perror("lseek");
                exit(91);
              }
            }
        }
        else            
        {
            current_position+=(stride*reclen)-reclen;
            if (!(h_flag || k_flag || mmapflag))
            {
              if(I_LSEEK(fd,current_position,SEEK_SET)<0)
              {
                perror("lseek");
                exit(93);
              };
            }
        }
    }
    if(cpuutilflag)
    {
        cputime  = cputime_so_far() - cputime;
        if (cputime < cputime_res)
            cputime = 0.0;
        walltime = time_so_far() - walltime;
        if (walltime < cputime)
           walltime = cputime;
    }

#ifdef ASYNC_IO
    if(async_flag)
    {
        end_async(gc);
        gc=0;
    }
#endif
    if(include_flush)
    {
        if(mmapflag)
            msync(maddr,(size_t)filebytes64,MS_SYNC);
        else
            fsync(fd);
    }
    if(include_close)
    {
        if(mmapflag)
        {
            mmap_end(maddr,(unsigned long long)filebytes64);
        }
        close(fd);
    }
    strideintime = ((time_so_far() - starttime1)-time_res)
        -compute_val;
    if(strideintime < (double).000001) 
    {
        strideintime= time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }

    if(!include_close)
    {
        if(mmapflag)
            msync(maddr,(size_t)filebytes64,MS_SYNC);
        else
            fsync(fd);
        if(mmapflag)
        {
            mmap_end(maddr,(unsigned long long)filebytes64);
        }
        close(fd);
    }

    if(OPS_flag || MS_flag){
       filebytes64=filebytes64/reclen;
    }
    if(MS_flag)
    {
        strideinrate=1000000.0*(strideintime / (double)filebytes64);
    }
      else
      {
            strideinrate = (unsigned long long) ((double) filebytes64 / strideintime);
      }
    if(!(OPS_flag || MS_flag))
        strideinrate >>= 10;
    /* Must save walltime & cputime before calling store_value() for each/any cell.*/
    if(cpuutilflag)
        store_times(walltime, cputime);
    store_value((off64_t)strideinrate);
#ifdef NO_PRINT_LLD
    if(!silent) printf(" %8ld",strideinrate);
#else
    if(!silent) printf(" %8lld",strideinrate);
#endif
    if(!silent) fflush(stdout);
    if(restf)
        sleep((int)rest_val);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void record_command_line ( int  argc,
char **  argv 
)

Definition at line 3145 of file iozone.c.

{
    int ix, len = 0;

    /* print and save the entire command line */
    if(!silent) printf("\tCommand line used:");
    for (ix=0; ix < argc; ix++) {
        if(!silent) printf(" %s", argv[ix]);
        if ((len + strlen(argv[ix])) < sizeof(command_line)) {
            strcat (command_line, argv[ix]);
            strcat (command_line, " ");
            len += strlen(argv[ix]) + 1;
        }
        else {
            printf ("Command line too long to save completely.\n");
            break;
        }
    }
    if(!silent) printf("\n");
}
void reverse_perf_test ( off64_t  kilo64,
long long  reclen,
long long *  data1,
long long*  data2 
)

Definition at line 9324 of file iozone.c.

{
    double revreadtime[2];
    double starttime2;
    double walltime[2], cputime[2];
    double compute_val = (double)0;
    long long j;
    off64_t i,numrecs64;
    long long Index = 0;
    unsigned long long revreadrate[2];
    off64_t filebytes64;
    off64_t lock_offset=0;
    int fd,open_flags;
    char *maddr,*wmaddr;
    volatile char *buffer1;
    int ltest;
    char *nbuff;
#if defined(VXFS) || defined(solaris)
    int test_foo=0;
#endif
#ifdef ASYNC_IO
    struct cache *gc=0;
#else
    long long *gc=0;
#endif

    maddr=wmaddr=0;
    open_flags=O_RDONLY;
#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        open_flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        open_flags |=O_DIRECTIO;
#endif
#endif
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        open_flags |=O_RSYNC|O_SYNC;
#endif
    numrecs64 = (kilo64*1024)/reclen;
    filebytes64 = numrecs64*reclen;
    fd = 0;
    if(noretest)
        ltest=1;
    else
        ltest=2;
    for( j=0; j<ltest; j++ )
    {
        if(cpuutilflag)
        {
            walltime[j] = time_so_far();
            cputime[j]  = cputime_so_far();
        }
        if(Uflag) /* Unmount and re-mount the mountpoint */
        {
            purge_buffer_cache();
        }
        if((fd = I_OPEN(filename, open_flags,0))<0){
            printf("\nCan not open temporary file for read\n");
            perror("open");
            exit(75);
        }
#ifdef ASYNC_IO
        if(async_flag)
            async_init(&gc,fd,direct_flag);
#endif

#ifdef VXFS
        if(direct_flag)
        {
            ioctl(fd,VX_SETCACHE,VX_DIRECT);
            ioctl(fd,VX_GETCACHE,&test_foo);
            if(test_foo == 0)
            {
                if(!client_iozone)
                  printf("\nVxFS advanced setcache feature not available.\n");
                exit(3);
            }
        }
#endif
#if defined(solaris)
               if(direct_flag)
               {
                       test_foo = directio(fd, DIRECTIO_ON);
                       if(test_foo != 0)
                       {
                               if(!client_iozone)
                                 printf("\ndirectio not available.\n");
                               exit(3);
                       }
               }
#endif
        if(mmapflag)
        {
            maddr=(char *)initfile(fd,filebytes64,0,PROT_READ);
        }
        fsync(fd);
        nbuff=mainbuffer;
        mbuffer=mainbuffer;
        if(fetchon)
            fetchit(nbuff,reclen);
        starttime2 = time_so_far();
        if (!(h_flag || k_flag || mmapflag))
        {
          if(check_filename(filename))
          {
            if(I_LSEEK( fd, -reclen, SEEK_END )<0)
            {
                perror("lseek");
                exit(77);
            };
          }
          else
          {
            if(I_LSEEK( fd, filebytes64-reclen, SEEK_SET )<0)
            {
                perror("lseek");
                exit(77);
            };
          }
        }
            compute_val=(double)0;
        for(i=0; i<numrecs64; i++) 
        {
            if(rlocking)
            {
                lock_offset=I_LSEEK(fd,0,SEEK_CUR);
                mylockr((int) fd, (int) 1, (int)1,
                  lock_offset, reclen);
            }
            if(compute_flag)
                compute_val+=do_compute(compute_time);
                        if(multi_buffer)
                        {
                                Index +=reclen;
                                if(Index > (MAXBUFFERSIZE-reclen))
                                        Index=0;
                                nbuff = mbuffer + Index;
                        }

            if(purge)
                purgeit(nbuff,reclen);
            if(mmapflag)
            {
                wmaddr = &maddr[((numrecs64-1)-i)*reclen];
                fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
            }
            else
            if(async_flag)
            {
                if(no_copy_flag)
                   async_read_no_copy(gc, (long long)fd, &buffer1, ((((numrecs64-1)-i)*reclen)),
                      reclen, -1LL,(numrecs64*reclen),depth);
                else
                   async_read(gc, (long long)fd, nbuff, (((numrecs64-1)-i)*reclen),
                      reclen,-1LL,(numrecs64*reclen),depth);
            }else
            {
                if(read((int)fd, (void*)nbuff, (size_t) reclen) != reclen)
                {
#ifdef NO_PRINT_LLD
                    printf("\nError reading block %ld\n", i); 
#else
                    printf("\nError reading block %lld\n", i); 
#endif
                    perror("read");
                    exit(79);
                }
            }
            if(verify){
               if(async_flag && no_copy_flag)
               {
                if(verify_buffer(buffer1,reclen,(off64_t)(numrecs64-1)-i,reclen,(long long)pattern,sverify)){
                    exit(80);
                }
               }
               else
               {
                if(verify_buffer(nbuff,reclen,(off64_t)(numrecs64-1)-i,reclen,(long long)pattern,sverify)){
                    exit(81);
                }
               }
            }
            if(async_flag && no_copy_flag)
                async_release(gc);
            if(rlocking)
            {
                mylockr((int) fd, (int) 0, (int)1,
                  lock_offset, reclen);
            }
            if (!(h_flag || k_flag || mmapflag))
            {
              I_LSEEK( fd, (off64_t)-2*reclen, SEEK_CUR );
            }
        }
#ifdef ASYNC_IO
        if(async_flag)
        {
            end_async(gc);
            gc=0;
        }
#endif
        if(include_flush)   
        {
            if(mmapflag)
                msync(maddr,(size_t)filebytes64,MS_SYNC);
            else
                fsync(fd);
        }
        if(include_close)
        {
            if(mmapflag)
            {
                mmap_end(maddr,(unsigned long long)filebytes64);
            }
            close(fd);
        }
        revreadtime[j] = ((time_so_far() - starttime2)-time_res)
            -compute_val;
        if(revreadtime[j] < (double).000001) 
        {
            revreadtime[j]= time_res;
            if(rec_prob < reclen)
                rec_prob = reclen;
            res_prob=1;
        }
        if(!include_close)
        {
            if(mmapflag)
                msync(maddr,(size_t)filebytes64,MS_SYNC);
            else
                fsync(fd);
            if(mmapflag)
            {
                mmap_end(maddr,(unsigned long long)filebytes64);
            }
            close(fd);
        }
        if(cpuutilflag)
        {
            cputime[j]  = cputime_so_far() - cputime[j];
            if (cputime[j] < cputime_res)
                cputime[j] = 0.0;
            walltime[j] = time_so_far() - walltime[j];
            if (walltime[j] < cputime[j])
               walltime[j] = cputime[j];
        }
        if(restf)
            sleep((int)rest_val);
        }
    if(OPS_flag || MS_flag){
       filebytes64=filebytes64/reclen;
    }
    for(j=0;j<ltest;j++){
        if(MS_flag)
        {
            revreadrate[j]=1000000.0*(revreadtime[j] / (double)filebytes64);
            continue;
        }
            else
            {
                  revreadrate[j] = 
              (unsigned long long) ((double) filebytes64 / revreadtime[j]);
            }
        if(!(OPS_flag || MS_flag))
            revreadrate[j] >>= 10;
    }
    /* Must save walltime & cputime before calling store_value() for each/any cell.*/
    if(cpuutilflag)
        store_times(walltime[0], cputime[0]);
    store_value((off64_t)revreadrate[0]);
#ifdef NO_PRINT_LLD
    if(!silent) printf("%8ld",revreadrate[0]);
#else
    if(!silent) printf("%8lld",revreadrate[0]);
#endif
    if(!silent) fflush(stdout);
}

Here is the call graph for this function:

void rewriterec_perf_test ( off64_t  kilo64,
long long  reclen,
long long *  data1,
long long*  data2 
)

Definition at line 9617 of file iozone.c.

{
    double writeintime;
    double starttime1;
    double walltime, cputime;
    double compute_val = (double)0;
    long long i;
    off64_t numrecs64;
    long long flags;
    long long Index=0;
    unsigned long long writeinrate;
    off64_t filebytes64;
    off64_t lock_offset=0;
    int fd,wval;
    char *maddr;
    char *wmaddr,*free_addr,*nbuff;
#if defined(VXFS) || defined(solaris)
    int test_foo=0;
#endif
#ifdef ASYNC_IO
    struct cache *gc=0;
#else
    long long *gc=0;
#endif

    walltime=cputime=0;
    maddr=wmaddr=free_addr=nbuff=0;
    numrecs64 = (kilo64*1024)/reclen;
    filebytes64 = numrecs64*reclen;
/*  flags = O_RDWR|O_CREAT|O_TRUNC;*/
    flags = O_RDWR|O_CREAT;
#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        flags |=O_DIRECTIO;
#endif
#endif
    if(oflag)
        flags |= O_SYNC;
#if defined(O_DSYNC)
    if(odsync)
        flags |= O_DSYNC;
#endif
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        flags |=O_RSYNC|O_SYNC;
#endif
/*
    if (!no_unlink)
    {
       if(check_filename(filename))
        unlink(filename);
    }
*/
    if(Uflag) /* Unmount and re-mount the mountpoint */
    {
        purge_buffer_cache();
    }
        if((fd = I_OPEN(filename, (int)flags,0640))<0)
        {
                    printf("\nCan not open temporary file %s for write.\n",filename);
            perror("open");
                    exit(84);
        }
#ifdef VXFS
    if(direct_flag)
    {
        ioctl(fd,VX_SETCACHE,VX_DIRECT);
        ioctl(fd,VX_GETCACHE,&test_foo);
        if(test_foo == 0)
        {
            if(!client_iozone)
              printf("\nVxFS advanced setcache feature not available.\n");
            exit(3);
        }
    }
#endif
#if defined(solaris)
               if(direct_flag)
               {
                       test_foo = directio(fd, DIRECTIO_ON);
                       if(test_foo != 0)
                       {
                               if(!client_iozone)
                                 printf("\ndirectio not available.\n");
                               exit(3);
                       }
               }
#endif
    if(mmapflag)
    {
        maddr=(char *)initfile(fd,filebytes64,1,PROT_READ|PROT_WRITE);
    }
#ifdef ASYNC_IO
    if(async_flag)
        async_init(&gc,fd,direct_flag);
#endif
    wval=fsync(fd);
    if(wval==-1){
        perror("fsync");
        signal_handler();
    }
    nbuff=mainbuffer;
    mbuffer=mainbuffer;
    if(fetchon)
        fetchit(nbuff,reclen);
    /*
    wval=write(fd, nbuff, (size_t) reclen);
    if(wval != reclen)
    {
#ifdef NO_PRINT_LLD
            printf("\nError writing block %ld, fd= %d\n", 0, fd);
#else
            printf("\nError writing block %lld, fd= %d\n", 0, fd);
#endif
        if(wval==-1)
            perror("write");
        signal_handler();
    }
    */
    if(verify || dedup || dedup_interior)
        fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
    starttime1 = time_so_far();
    if(cpuutilflag)
    {
        walltime = time_so_far();
        cputime  = cputime_so_far();
    }
    for(i=0; i<numrecs64; i++){
        if(rlocking)
        {
            lock_offset=I_LSEEK(fd,0,SEEK_CUR);
            mylockr((int) fd, (int) 1, (int)0,
              lock_offset, reclen);
        }
        if(compute_flag)
            compute_val+=do_compute(compute_time);
            if(multi_buffer)
            {
                    Index +=reclen;
                        if(Index > (MAXBUFFERSIZE-reclen))
                                Index=0;
                        nbuff = mbuffer + Index;
                }
        if(async_flag && no_copy_flag)
        {
            free_addr=nbuff=(char *)malloc((size_t)reclen+page_size);
            nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
            if(verify || dedup || dedup_interior)
                fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
        }
        if((verify & diag_v) || dedup || dedup_interior)
            fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
        if(purge)
            purgeit(nbuff,reclen);
        if(mmapflag)
        {
            wmaddr = &maddr[i*reclen];
            fill_area((long long*)nbuff,(long long*)wmaddr,(long long)reclen);
            if(!mmapnsflag)
            {
              if(mmapasflag)
                msync(wmaddr,(size_t)reclen,MS_ASYNC);
              if(mmapssflag)
                msync(wmaddr,(size_t)reclen,MS_SYNC);
            }
        }
        else
        {
              if(async_flag)
              {
                 if(no_copy_flag)
                   async_write_no_copy(gc, (long long)fd, nbuff, reclen, (i*reclen), depth,free_addr);
                 else
                   async_write(gc, (long long)fd, nbuff, reclen, (i*reclen), depth);
              }
              else
              {
                   wval=write(fd, nbuff, (size_t) reclen);
                   if(wval != reclen)
                   {
#ifdef NO_PRINT_LLD
                       printf("\nError writing block %ld, fd= %d\n", i, fd);
#else
                       printf("\nError writing block %lld, fd= %d\n", i, fd);
#endif
                   if(wval==-1)
                    perror("write");
                   signal_handler();
                   }
              }
        }
        if(rlocking)
        {
            mylockr((int) fd, (int) 0, (int)0,
              lock_offset, reclen);
        }
        if (!(h_flag || k_flag || mmapflag))
        {
          I_LSEEK(fd, (off64_t)0,SEEK_SET);
        }
    }

#ifdef ASYNC_IO
    if(async_flag)
    {
        end_async(gc);
        gc=0;
    }
#endif
    if(include_flush)
    {
        if(mmapflag)
            msync(maddr,(size_t)filebytes64,MS_SYNC);/* Clean up before read starts running */
        else
        {
            wval=fsync(fd);
            if(wval==-1){
                perror("fsync");
                signal_handler();
            }
        }
    }
    if(include_close)
    {
        if(mmapflag)
            mmap_end(maddr,(unsigned long long)filebytes64);
        wval=close(fd);
        if(wval==-1){
            perror("close");
            signal_handler();
        }
    }
    writeintime = ((time_so_far() - starttime1)-time_res)-
        compute_val;
    if(cpuutilflag)
    {
        cputime  = cputime_so_far() - cputime;
        if (cputime < cputime_res)
            cputime = 0.0;
        walltime = time_so_far() - walltime;
        if (walltime < cputime)
           walltime = cputime;
    }
    if(writeintime < (double).000001) 
    {
        writeintime= time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }

    if(!include_close)
    {
        if(mmapflag)
            msync(maddr,(size_t)filebytes64,MS_SYNC);/* Clean up before read starts running */
        else
        {
            wval=fsync(fd);
            if(wval==-1){
                perror("fsync");
                signal_handler();
            }
        }
        if(mmapflag)
            mmap_end(maddr,(unsigned long long)filebytes64);
        wval=close(fd);
        if(wval==-1){
            perror("close");
            signal_handler();
        }

    }

    if(OPS_flag || MS_flag){
       filebytes64=filebytes64/reclen;
    }
    if(MS_flag)
    {
        writeinrate=1000000.0*(writeintime / (double)filebytes64);
    }
      else
      {
            writeinrate = (unsigned long long) ((double) filebytes64 / writeintime);
      }
    if(!(OPS_flag || MS_flag))
        writeinrate >>= 10;
    /* Must save walltime & cputime before calling store_value() for each/any cell.*/
    if(cpuutilflag)
        store_times(walltime, cputime);
    store_value((off64_t)writeinrate);
#ifdef NO_PRINT_LLD
    if(!silent) printf(" %8ld",writeinrate);
#else
    if(!silent) printf(" %8lld",writeinrate);
#endif
    if(!silent) fflush(stdout);
    if(restf)
        sleep((int)rest_val);
}

Here is the call graph for this function:

void send_stop ( )

Definition at line 22607 of file iozone.c.

{
    struct master_command mc;

    bzero(&mc, sizeof(struct master_command));
    mc.m_command = R_STOP_FLAG;
    mc.m_mygen = mygen;
    mc.m_version = proto_version;
    mc.m_client_number = chid;
    mc.m_client_error = client_error;
    if(cdebug)
    {
        fprintf(newstdout,"Child %d sending stop flag to master\n",(int)chid);
        fflush(newstdout);
    }
        child_send(controlling_host_name,(struct master_command *)&mc, sizeof(struct master_command));
    client_error=0;  /* clear error, it has been delivered */
}

Here is the call graph for this function:

Here is the caller graph for this function:

void show_help ( )

Definition at line 3318 of file iozone.c.

{
        long long i;
        if(!silent) printf("iozone: help mode\n\n");
        for(i=0; strlen(help[i]); i++)
        {
        if(!silent) printf("%s\n", help[i]);
        }
}

Here is the caller graph for this function:

void signal_handler ( )

Definition at line 3336 of file iozone.c.

{
    long long i;
    if(distributed)
    {
        if(master_iozone)
            cleanup_children();
    }
    if((long long)getpid()==myid)
    {
            if(!silent) printf("\niozone: interrupted\n\n");
#ifndef VMS
        if (!no_unlink)
        {
           if(check_filename(filename))
                unlink(filename);   /* delete the file */
        }
        for(i=1;i<num_child;i++)
        {
           if(check_filename(dummyfile[i]))
                unlink(dummyfile[i]);   /* delete the file */
        }
        if (!no_unlink)
        {
           if(check_filename(dummyfile[0]))
                unlink(dummyfile[0]);   /* delete the file */
        }
        
#endif
        if(Rflag && !trflag){
            dump_excel();
        }
        if(Rflag && trflag){
            dump_throughput();
        }

            if(!silent) printf("exiting iozone\n\n");
        if(res_prob)
        {
            printf("Timer resolution is poor. Some small transfers may have \n");
            printf("reported inaccurate results. Sizes %ld Kbytes and below.\n",
                (long)rec_prob/1024);
        }
        if(trflag && !use_thread)
           for(i=0;i<num_child;i++)
            kill((pid_t)childids[i],SIGTERM);
        if(r_traj_flag)
            fclose(r_traj_fd);
        if(w_traj_flag)
            fclose(w_traj_fd);
    }
    if(sp_msfd)
        close(sp_msfd);
    if(sp_mrfd)
        close(sp_mrfd);
        exit(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void sp_do_child_t ( void  )

Definition at line 23183 of file iozone.c.

{
    int i,y;
    int offset;
    int sp_tcount=0;
    /* child */
    /*
     * Child reads from master 
     */
    sp_crfd=sp_start_child_listen(sp_child_listen_port, sp_msize);
    sp_start_time=time_so_far();
    for(i=0;i<sp_count;i++)
    {
        offset=0;
        while(offset<sp_msize)
        {
            y=read(sp_crfd,&sp_buf[offset],sp_msize-offset);
            if(y < 0)
            {
                    if(cdebug)
                {
                    fprintf(newstdout,"Child error %d offset %d\n",
                        errno,offset);
                    fflush(newstdout);
                }
                exit(1);
            }
            offset+=y;
            if(cdebug)
            {
                fprintf(newstdout,"Child offset %d read %d\n",offset,y);
                fflush(newstdout);
            }
        }
        sp_tcount+=offset;
    }
    sp_finish_time=time_so_far();

    close(sp_crfd);
    sleep(1); /* Wait for master to get into sp_get_result */
    sp_send_result(sp_master_results_port, sp_tcount/1024, 
        (float)(sp_tcount/1024)/(sp_finish_time-sp_start_time));

    sleep(1);
    /*
     * Child writes to master 
     */
    sp_csfd=sp_start_child_send(sp_dest, sp_master_listen_port,
        &sp_my_cs_addr);
    sp_tcount=0;
    offset=0;
    sp_start_time=time_so_far();
    for(i=0;i<sp_count;i++)
    {
        y=write(sp_csfd,sp_buf,sp_msize);
        sp_tcount+=y;
    }
    sp_finish_time=time_so_far();
    close(sp_csfd);
    sleep(1);
    sp_send_result(sp_master_results_port, sp_tcount/1024, 
        (float)(sp_tcount/1024)/(sp_finish_time-sp_start_time));
    if(cdebug)
    {
        fprintf(newstdout,"child exits\n");
        fflush(newstdout);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void sp_do_master_t ( void  )

Definition at line 23261 of file iozone.c.

{
    int i,y,sp_offset;
    int sp_tcount = 0;


    /*
     * Master writes to child 
     */
    sp_msfd=sp_start_master_send(sp_dest, sp_child_listen_port,
        &sp_my_ms_addr);
    sp_start_time=time_so_far();
    for(i=0;i<sp_count;i++)
    {
        y=write(sp_msfd,sp_buf,sp_msize);
        sp_tcount+=y;
    }
    sp_finish_time=time_so_far();
    close(sp_msfd);
    sp_msfd=0;
    sp_get_result(sp_master_results_port,0);
    printf("%-20s  sent     %10d kbytes @ %10.2f Kbytes/sec \n",
        sp_master_host,sp_tcount/1024, 
        (float)(sp_tcount/1024)/(sp_finish_time-sp_start_time));

    /* printf("\n"); */
    /*
     * Master reads from child 
     */
    sp_mrfd=sp_start_master_listen(sp_master_listen_port, sp_msize);
    sp_offset=0;
    sp_start_time=time_so_far();
    sp_tcount=0;
    for(i=0;i<sp_count;i++)
    {
        sp_offset=0;
        while(sp_offset<sp_msize)
        {
            y=read(sp_mrfd,&sp_buf[sp_offset],sp_msize-sp_offset);
            if(y < 0)
            {
                    printf("Master error %d offset %d\n",errno,
                    sp_offset);
                exit(1);
            }
            sp_offset+=y;
            /* printf("Master offset %d read %d\n",offset,y);*/
        }
        sp_tcount+=sp_offset;
    }
    sp_finish_time=time_so_far();
    sp_get_result(sp_master_results_port,1);
    printf("%-20s received  %10d kbytes @ %10.2f Kbytes/sec \n",
        sp_master_host,sp_tcount/1024,
        (float)(sp_tcount/1024)/(sp_finish_time-sp_start_time));
    printf("\n");
    wait(NULL);
    close(sp_mrfd);
    sp_mrfd=0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void sp_get_result ( int  port,
int  flag 
)

Definition at line 22905 of file iozone.c.

{
    int tcfd;
    float throughput;
    int count;
    char mybuf[1024];
    int sp_offset,xx;

    tcfd=sp_start_master_listen(port, 1024);
    sp_offset=0;
    while(sp_offset < 1024)
    {
        xx=read(tcfd,&mybuf[sp_offset],1024);
        sp_offset+=xx;
    }
    sscanf(mybuf,"%d %f",&count,&throughput);
    if(!flag)
        printf("%-20s received  %10d Kbytes @ %10.2f Kbytes/sec \n",
            sp_remote_host,count,throughput);
    else
        printf("%-20s  sent     %10d Kbytes @ %10.2f Kbytes/sec \n",
            sp_remote_host,count,throughput);
    close(tcfd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void sp_send_result ( int  port,
int  count,
float  throughput 
)

Definition at line 22940 of file iozone.c.

{
    int msfd;
    char mybuf[1024];
    sprintf(mybuf,"%d %f",count, throughput);
    msfd=sp_start_child_send(sp_dest, port, &sp_my_cs_addr);
    junk=write(msfd,mybuf,1024);
    if(cdebug)
    {
        fprintf(newstdout,"Sending result\n");
        fflush(newstdout);
    }
    close(msfd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int sp_start_child_listen ( int  listen_port,
int  size_of_message 
)

Definition at line 23090 of file iozone.c.

{
    int tsize;
    int s,ns;
    unsigned int me;
    int rc;
    int xx;
    int tmp_port;
    struct sockaddr_in *addr;
    int sockerr;
    int recv_buf_size=65536;
    int optval=1;
    xx = 0;
    me=sizeof(struct sockaddr_in);
    tsize=size_of_message; /* Number of messages to receive */
        s = socket(AF_INET, SOCK_STREAM, 0);
        if (s < 0)
        {
                perror("socket failed:");
                exit(19);
        }
    sockerr = setsockopt (s, SOL_SOCKET, SO_RCVBUF, (char *)
        &recv_buf_size, sizeof(int));
    if ( sockerr == -1 ) {
        perror("Error in setsockopt 7\n");
    }
    sockerr = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)
        &optval, sizeof(int));
    if ( sockerr == -1 ) {
        perror("Error in setsockopt 8\n");
    }
        bzero(&sp_child_sync_sock, sizeof(struct sockaddr_in));
    tmp_port=sp_child_listen_port;
        sp_child_sync_sock.sin_port = htons(tmp_port);
        sp_child_sync_sock.sin_family = AF_INET;
        sp_child_sync_sock.sin_addr.s_addr = INADDR_ANY;
        rc = -1;
        while (rc < 0)
        {
                rc = bind(s, (struct sockaddr *)&sp_child_sync_sock,
                                sizeof(struct sockaddr_in));
        if(rc < 0)
        {
            tmp_port++;
                    sp_child_sync_sock.sin_port=htons(tmp_port);
            continue;
        }
        }
    sp_child_listen_port = ntohs(sp_child_sync_sock.sin_port);
    if(cdebug ==1)
    {
        fprintf(newstdout,"Child: Listen: Bound at port %d\n", tmp_port);
        fflush(newstdout);
    }
    if(rc < 0)
    {
        if(cdebug ==1)
        {
           fprintf(newstdout,"bind failed. Errno %d\n", errno);
           fflush(newstdout);
        }
        exit(20);
    }

    addr=&sp_child_async_sock;
    listen(s,10);
    if(cdebug)
    {
        fprintf(newstdout,"Child enters accept\n");
        fflush(newstdout);
    }
    ns=accept(s,(void *)addr,&me);
    if(cdebug)
    {
        fprintf(newstdout,"Child attached for receive. Sock %d  %d\n", ns,errno);
        fflush(newstdout);
    }
    close(s);
    return(ns);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

int sp_start_child_send ( char *  sp_master_host_name,
int  sp_master_listen_port,
struct in_addr *  sp_my_cs_addr 
)

Definition at line 23420 of file iozone.c.

{
    int rc,sp_child_socket_val;
    struct sockaddr_in addr,raddr;
    struct hostent *he;
    int port,tmp_port;
    struct in_addr *ip;
    int ecount=0;
    struct timespec req,rem;

    req.tv_sec = 0;
    req.tv_nsec = 10000000;
    rem.tv_sec = 0;
    rem.tv_nsec = 10000000;

        he = gethostbyname(sp_master_host_name);
        if (he == NULL)
        {
                printf("Child: Bad hostname >%s<\n",sp_master_host_name);
        fflush(stdout);
                exit(22);
        }
    if(cdebug ==1)
    {
            fprintf(newstdout,"Child: start child send: %s\n", he->h_name);
            fprintf(newstdout,"To: %s at port %d\n",sp_master_host_name,
            sp_master_listen_port);
        fflush(newstdout);
    }
        ip = (struct in_addr *)he->h_addr_list[0];

    port=sp_master_listen_port;
    sp_my_cs_addr->s_addr = ip->s_addr;

        raddr.sin_family = AF_INET;
        raddr.sin_port = htons(port);
        raddr.sin_addr.s_addr = ip->s_addr;
        sp_child_socket_val = socket(AF_INET, SOCK_STREAM, 0);
        if (sp_child_socket_val < 0)
        {
                perror("child: socket failed:");
                exit(23);
        }
        bzero(&addr, sizeof(struct sockaddr_in));
    tmp_port=sp_child_esend_port;
        addr.sin_port = htons(tmp_port);
        addr.sin_family = AF_INET;
        addr.sin_addr.s_addr = INADDR_ANY;
        rc = -1;
        while (rc < 0)
        {
                rc = bind(sp_child_socket_val, (struct sockaddr *)&addr,
                                                sizeof(struct sockaddr_in));
        if(rc < 0)
        {
            tmp_port++;
                    addr.sin_port=htons(tmp_port);
            continue;
        }
        }
    if(cdebug ==1)
    {
        fprintf(newstdout,"Child: Bound port %d\n",tmp_port);
        fflush(newstdout);
    }
        if (rc < 0)
        {
                perror("Child: bind failed for sync channel to child.\n");
                exit(24);
        }
#if defined(Windows)
    sleep(1);
#else
    nanosleep(&req,&rem);
#endif
again:
        rc = connect(sp_child_socket_val, (struct sockaddr *)&raddr, 
            sizeof(struct sockaddr_in));
    if (rc < 0)
        {
        if(ecount++<300)
        {
#if defined(Windows)
            sleep(1);
#else
            nanosleep(&req,&rem);
#endif
            goto again;
        }

        fprintf(newstdout,"child: connect failed. Errno %d \n",errno);
        fflush(newstdout);
        exit(25);
        }
    if(cdebug ==1)
    {
        fprintf(newstdout,"child Connected\n");
        fflush(newstdout);
    }
    return (sp_child_socket_val);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int sp_start_master_listen ( int  sp_master_listen_port,
int  sp_size_of_message 
)

Definition at line 23331 of file iozone.c.

{
    int tsize;
    int s,ns;
    unsigned int me;
    int rc;
    int xx;
    int tmp_port;
    struct sockaddr_in *addr;
    int sockerr;
    int recv_buf_size=65536;
    int optval=1;
    xx = 0;
    me=sizeof(struct sockaddr_in);
    tsize=sp_size_of_message; /* Number of messages to receive */
        s = socket(AF_INET, SOCK_STREAM, 0);
        if (s < 0)
        {
                perror("socket failed:");
                exit(19);
        }
    sockerr = setsockopt (s, SOL_SOCKET, SO_RCVBUF, (char *)
        &recv_buf_size, sizeof(int));
    if ( sockerr == -1 ) {
        perror("Error in setsockopt 9\n");
    }
    sockerr = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)
        &optval, sizeof(int));
    if ( sockerr == -1 ) {
        perror("Error in setsockopt 10\n");
    }
        bzero(&sp_master_sync_sock, sizeof(struct sockaddr_in));
    tmp_port=sp_master_listen_port;
        sp_master_sync_sock.sin_port = htons(tmp_port);
        sp_master_sync_sock.sin_family = AF_INET;
        sp_master_sync_sock.sin_addr.s_addr = INADDR_ANY;
        rc = -1;
        while (rc < 0)
        {
                rc = bind(s, (struct sockaddr *)&sp_master_sync_sock,
                                sizeof(struct sockaddr_in));
        if(rc < 0)
        {
            tmp_port++;
                    sp_master_sync_sock.sin_port=htons(tmp_port);
            continue;
        }
        }
    sp_master_listen_port = ntohs(sp_master_sync_sock.sin_port);
    if(mdebug ==1)
    {
        printf("Master: Listen: Bound at port %d\n", tmp_port);
        fflush(stdout);
    }
    if(rc < 0)
    {
        perror("bind failed\n");
        exit(20);
    }

    addr=&sp_master_async_sock;
    listen(s,10);
    if(mdebug)
    {
        printf("Master enters accept\n");
        fflush(stdout);
    }
    ns=accept(s,(void *)addr,&me);
    if(mdebug)
    {
        printf("Master attached for receive. Sock %d  %d\n", ns,errno);
        fflush(stdout);
    }
    close(s);
    return(ns);
}

Here is the call graph for this function:

int sp_start_master_send ( char *  sp_child_host_name,
int  sp_child_listen_port,
struct in_addr *  sp_my_ms_addr 
)

Definition at line 22968 of file iozone.c.

{
    int rc,master_socket_val;
    struct sockaddr_in addr,raddr;
    struct hostent *he;
    int port,tmp_port;
    int ecount=0;
    struct in_addr *ip;
    struct timespec req,rem;

    req.tv_sec = 0;
    req.tv_nsec = 10000000;
    rem.tv_sec = 0;
    rem.tv_nsec = 10000000;

        he = gethostbyname(sp_child_host_name);
        if (he == NULL)
        {
                printf("Master: Bad hostname >%s<\n",sp_child_host_name);
        fflush(stdout);
                exit(22);
        }
    if(mdebug ==1)
    {
            printf("Master: start master send: %s\n", he->h_name);
        fflush(stdout);
    }
        ip = (struct in_addr *)he->h_addr_list[0];
#ifndef UWIN
    if(mdebug ==1)
    {
            printf("Master: child name: %s\n", (char *)inet_ntoa(*ip));
            printf("Master: child Port: %d\n", sp_child_listen_port);
        fflush(stdout);
    }
#endif

    port=sp_child_listen_port;
    sp_my_ms_addr->s_addr = ip->s_addr;
    /*port=CHILD_LIST_PORT;*/

        raddr.sin_family = AF_INET;
        raddr.sin_port = htons(port);
        raddr.sin_addr.s_addr = ip->s_addr;
        master_socket_val = socket(AF_INET, SOCK_STREAM, 0);
        if (master_socket_val < 0)
        {
                perror("Master: socket failed:");
                exit(23);
        }
        bzero(&addr, sizeof(struct sockaddr_in));
    tmp_port=sp_master_esend_port;
        addr.sin_port = htons(tmp_port);
        addr.sin_family = AF_INET;
        addr.sin_addr.s_addr = INADDR_ANY;
        rc = -1;
        while (rc < 0)
        {
                rc = bind(master_socket_val, (struct sockaddr *)&addr,
                                                sizeof(struct sockaddr_in));
        if(rc < 0)
        {
            tmp_port++;
                    addr.sin_port=htons(tmp_port);
            continue;
        }
        }
    if(mdebug ==1)
    {
        printf("Master: Bound port\n");
        fflush(stdout);
    }
        if (rc < 0)
        {
                perror("Master: bind failed for sync channel to child.\n");
                exit(24);
        }
#if defined(Windows)
    sleep(1);
#else
    nanosleep(&req,&rem);
#endif

again:
        rc = connect(master_socket_val, (struct sockaddr *)&raddr, 
            sizeof(struct sockaddr_in));
    if (rc < 0)
        {
        if(ecount++ < 300)
        {
#if defined(Windows)
            sleep(1);
#else
            nanosleep(&req,&rem);
#endif
            /*sleep(1);*/
            goto again;
        }
                perror("Master: connect failed\n");
        printf("Error %d\n",errno);
                exit(25);
        }
    if(mdebug ==1)
    {
        printf("Master Connected\n");
        fflush(stdout);
    }
    return (master_socket_val);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void speed_main ( char *  client_name,
char *  e_path,
long long  reclen,
long long  kilos,
int  client_flag 
)

Definition at line 22822 of file iozone.c.

{
    int x;


    strcpy(sp_master_host,controlling_host_name);
    sp_msize=(int)reclen;
    sp_count=((int)kilos*1024)/(int)reclen;
    if(!client_flag)
    {
        printf("\n");
        strcpy(sp_remote_host,client_name);
        strcpy(sp_location,e_path);
    }

    if(client_flag)
        sp_child_mode=1;
    sp_buf=(char *)malloc(sp_msize);
    bzero(sp_buf,sp_msize); /* get page faults out of the way */

    if(sp_child_mode)
    {
        close(0);
        close(1);
        close(2);
        if(cdebug)
        {
            newstdin=freopen("/tmp/don_in","r+",stdin);
            newstdout=freopen("/tmp/don_out","a+",stdout);
            newstderr=freopen("/tmp/don_err","a+",stderr);
        }
        sp_dest=sp_master_host;
        sp_do_child_t();
        free(sp_buf);
        exit(0);
    }
    x=fork();
    if(x==0)
    {
        find_remote_shell(sp_remote_shell);
     sprintf(sp_command,"%s %s %s -+s -t 1 -r %d -s %d -+c %s -+t ",
            sp_remote_shell, sp_remote_host, 
            sp_location, (int)reclen/1024, 
            (int)kilos,sp_master_host);
        /*printf("%s\n",sp_command);*/
        junk=system(sp_command);
        exit(0);
    }
    else
    {
        if(!sp_once)
        {
        printf("***************************************************\n");
        printf("* >>>>>     Client Network Speed check      <<<<< *\n");
        printf("***************************************************\n\n");
            printf("Master: %s\n",sp_master_host);
            printf("Transfer size %d bytes  \n",sp_msize);
            printf("Count %d\n",sp_count);
            printf("Total size %d kbytes  \n\n",
                (sp_msize*sp_count)/1024);
            sp_once=1;
        }
        sp_dest=sp_remote_host;
        sleep(1);
        sp_do_master_t();
        free(sp_buf);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void srand ( )

Here is the caller graph for this function:

void srand48 ( )

Here is the caller graph for this function:

Here is the caller graph for this function:

int start_child_listen ( int  size_of_message)

Definition at line 20759 of file iozone.c.

{
    int tsize;
    int s;
    int rc;
    int xx;
    int tmp_port;
    int sockerr;
    int recv_buf_size=65536;
    int optval=1;
    struct linger dummy={1,0};
    xx = 0;
    tsize=size_of_message; /* Number of messages to receive */
        s = socket(AF_INET, SOCK_STREAM, 0);
        if (s < 0)
        {
                perror("socket failed:");
                exit(19);
        }
    sockerr = setsockopt (s, SOL_SOCKET, SO_RCVBUF, (char *)
        &recv_buf_size, sizeof(int));
    if ( sockerr == -1 ) {
        perror("Error in setsockopt 3\n");
    }
    sockerr = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)
        &optval, sizeof(int));
    if ( sockerr == -1 ) {
        perror("Error in setsockopt 4\n");
    }
    sockerr = setsockopt (s, SOL_SOCKET, SO_LINGER, (char *)
        &dummy, sizeof(struct linger));
    if ( sockerr == -1 ) {
        perror("Error in setsockopt 4\n");
    }
        bzero(&child_sync_sock, sizeof(struct sockaddr_in));
    tmp_port=CHILD_LIST_PORT+chid;
        child_sync_sock.sin_port = htons(tmp_port);
        child_sync_sock.sin_family = AF_INET;
        child_sync_sock.sin_addr.s_addr = INADDR_ANY;
        rc = -1;
        while (rc < 0)
        {
                rc = bind(s, (struct sockaddr *)&child_sync_sock,
                                sizeof(struct sockaddr_in));
        if(rc < 0)
        {
            tmp_port++;
                    child_sync_sock.sin_port=htons(tmp_port);
            continue;
        }
        }
    child_port = ntohs(child_sync_sock.sin_port);
    if(cdebug ==1)
    {
        fprintf(newstdout,"Child %d: Listen: Bound at port %d\n",(int)chid, tmp_port);
        fflush(newstdout);
    }
    if(rc < 0)
    {
        fprintf(newstdout,"Child bind failed. Errno %d\n",errno);
        fflush(newstdout);
        exit(20);
    }
    return(s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int start_child_listen_async ( int  size_of_message)

Definition at line 20939 of file iozone.c.

{
    int tsize;
    int s;
    int rc;
    int xx;
    int tmp_port;
    int sockerr;
    int recv_buf_size=65536;
    int optval=1;
    xx = 0;
    tsize=size_of_message; /* Number of messages to receive */
        s = socket(AF_INET, SOCK_STREAM, 0);
        if (s < 0)
        {
                perror("socket failed:");
                exit(19);
        }
    sockerr = setsockopt (s, SOL_SOCKET, SO_RCVBUF, (char *)
        &recv_buf_size, sizeof(int));
    if ( sockerr == -1 ) {
        perror("Error in setsockopt 5\n");
    }
    sockerr = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)
        &optval, sizeof(int));
    if ( sockerr == -1 ) {
        perror("Error in setsockopt 6\n");
    }
        bzero(&child_async_sock, sizeof(struct sockaddr_in));
    tmp_port=CHILD_ALIST_PORT;
        child_async_sock.sin_port = htons(tmp_port);
        child_async_sock.sin_family = AF_INET;
        child_async_sock.sin_addr.s_addr = INADDR_ANY;
        rc = -1;
        while (rc < 0)
        {
                rc = bind(s, (struct sockaddr *)&child_async_sock,
                                sizeof(struct sockaddr_in));
        if(rc < 0)
        {
            tmp_port++;
                    child_async_sock.sin_port=htons(tmp_port);
            continue;
        }
        }
    child_async_port = ntohs(child_async_sock.sin_port);
    if(cdebug ==1)
    {
        fprintf(newstdout,"Child %d: Async Listen: Bound at port %d\n",
            (int)chid,tmp_port);
        fflush(newstdout);
    }
    if(rc < 0)
    {
        fprintf(newstdout,"bind failed. Errno %d \n",errno);
        fflush(newstdout);
        exit(20);
    }
    return(s);
}

Here is the call graph for this function:

Definition at line 22287 of file iozone.c.

{
    int i;
    struct child_stats *child_stat;
    struct client_command cc;
    struct client_neutral_command *cnc;

    client_listen_pid=fork();
    if(client_listen_pid!=0)
        return;
    if(cdebug>=1)
    {
        fprintf(newstdout,"Child %d starting client listen loop\n",(int)chid);
        fflush(newstdout);
    }
    while(1)
    {
        bzero(&cc,sizeof(struct client_command));
        child_listen_async(l_async_sock,sizeof(struct client_neutral_command));
        cnc=(struct client_neutral_command *)&child_async_rcv_buf;
        /*
         * Convert from string format to arch format
         */
        sscanf(cnc->c_command,"%d",&cc.c_command);
        sscanf(cnc->c_client_number,"%d",&cc.c_client_number);
        sscanf(cnc->c_stop_flag,"%d",&cc.c_stop_flag);

        switch(cc.c_command) {
        case R_STOP_FLAG:
            i = cc.c_client_number;
            if(cdebug)
            {
                fprintf(newstdout,"child loop: R_STOP_FLAG for client %d\n",i);
                fflush(newstdout);
            }
            child_stat = (struct child_stats *)&shmaddr[i]; 
            *stop_flag = cc.c_stop_flag; /* In shared memory with other copy */
            sent_stop=1;
            break;
        case R_TERMINATE:
            if(cdebug)
            {
                fprintf(newstdout,"Child loop: R_TERMINATE: Client %d \n",
                  (int)cc.c_client_number);
                fflush(newstdout);
            }
            sleep(2);
            /* Aync listener goes away */
            stop_child_listen(l_async_sock);
            exit(0);
        case R_DEATH:
            if(cdebug)
            {
                fprintf(newstdout,"Child loop: R_DEATH: Client %d \n",
                  (int)cc.c_client_number);
                fflush(newstdout);
            }
            i = cc.c_client_number;
            child_remove_files(i);
            sleep(2);
            /* Aync listener goes away */
            stop_child_listen(l_async_sock);
            exit(0);
        }
            
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

long long start_child_proc ( )

Here is the caller graph for this function:

long long start_child_proc ( int  testnum,
long long  numrecs64,
long long  reclen 
)

Definition at line 21286 of file iozone.c.

{
    long long x;
    if(distributed && master_iozone)
    {
        x=(long long)pick_client(testnum,numrecs64, reclen);
    }
    else
    {
        x=(long long)fork();
    }
    if(mdebug)
        printf("Starting proc %d\n",(int)x);    
    return(x);
}   

Here is the call graph for this function:

Definition at line 20277 of file iozone.c.

{
    int s;
    int rc;
    int tmp_port;
    int sockerr;
    struct sockaddr_in addr;
    int recv_buf_size=65536*4;
    int optval=1;
    struct linger dummy={1,0};

        s = socket(AF_INET, SOCK_STREAM, 0);
        if (s < 0)
        {
                perror("socket failed:");
                exit(19);
        }
    sockerr = setsockopt (s, SOL_SOCKET, SO_RCVBUF, (char *)
        &recv_buf_size, sizeof(int));
    if ( sockerr == -1 ) {
        perror("Error in setsockopt 1\n");
    }
    sockerr = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)
        &optval, sizeof(int));
    if ( sockerr == -1 ) {
        perror("Error in setsockopt 2\n");
    }
    sockerr = setsockopt (s, SOL_SOCKET, SO_LINGER, (char *)
        &dummy, sizeof(struct linger));
    if ( sockerr == -1 ) {
        perror("Error in setsockopt 2\n");
    }
    tmp_port=HOST_LIST_PORT;
        bzero(&addr, sizeof(struct sockaddr_in));
        addr.sin_port = htons(tmp_port);
        addr.sin_family = AF_INET;
        addr.sin_addr.s_addr = INADDR_ANY;
        rc = -1;
        while (rc < 0)
        {
                rc = bind(s, (struct sockaddr *)&addr,
                                sizeof(struct sockaddr_in));
        if(rc < 0)
        {
            tmp_port++;
                    addr.sin_port=htons(tmp_port);
            continue;
        }
        master_listen_port = ntohs(addr.sin_port);
        }
    if(rc < 0)
    {
        perror("bind failed\n");
        exit(20);
    }

    if(mdebug)
       printf("Master listening on socket %d Port %d\n",s,tmp_port);
    return(s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

void start_master_listen_loop ( int  num)

Definition at line 22150 of file iozone.c.

{
    int i;
    struct child_stats *child_stat;
    struct master_neutral_command *mnc;
    struct master_command mc;
    int temp;
    struct timespec req,rem;

    req.tv_sec = 0;
    req.tv_nsec = 10000000;
    rem.tv_sec = 0;
    rem.tv_nsec = 10000000;


    master_join_count=num;
    master_listen_pid=fork();
    if(master_listen_pid!=0)
        return;
    if(mdebug>=1)
        printf("Starting Master listen loop m %d c %d count %d\n",master_iozone, 
            client_iozone,num);

    while(master_join_count)
    {
        master_listen(master_listen_socket,sizeof(struct master_neutral_command));
        mnc=(struct master_neutral_command *)&master_rcv_buf[0];
        
        /*
         * Convert from string format to arch format
         */
        sscanf(mnc->m_command,"%d",&mc.m_command);
        sscanf(mnc->m_client_number,"%d",&mc.m_client_number);
        sscanf(mnc->m_client_error,"%d",&mc.m_client_error);
        sscanf(mnc->m_mygen,"%d",&mc.m_mygen);
        sscanf(mnc->m_version,"%d",&mc.m_version);
        if(mc.m_version != proto_version)
        {
            printf("Client # %d is not running the same version of Iozone !\n",
                mc.m_client_number);
        }       
        if(mc.m_client_error != 0)
        {
            printf("\nClient # %d reporting an error %s !\n",
                mc.m_client_number,strerror(mc.m_client_error));
        }       
#ifdef NO_PRINT_LLD
        sscanf(mnc->m_child_flag,"%ld",&mc.m_child_flag);
#else
        sscanf(mnc->m_child_flag,"%lld",&mc.m_child_flag);
#endif
        sscanf(mnc->m_actual,"%f",&mc.m_actual);
        sscanf(mnc->m_throughput,"%f",&mc.m_throughput);
        sscanf(mnc->m_cputime,"%f",&mc.m_cputime);
        sscanf(mnc->m_walltime,"%f",&mc.m_walltime);
        sscanf(mnc->m_stop_flag,"%d",&temp);
        mc.m_stop_flag = temp;

        switch(mc.m_command) {
        case R_STAT_DATA:
            if(mc.m_mygen != mygen)
            {
                /* 
                 * >>> You are NOT one of my children !!!  <<<
                 * Probably children left behind from another run !!!
                 * Ignore their messages, and go on without them.
                 */
                printf("*** Unknown Iozone children responding !!! ***\n");
                continue;
            }
            i = mc.m_client_number;
            if(mdebug)
                printf("loop: R_STAT_DATA for client %d\n",i);
            child_stat = (struct child_stats *)&shmaddr[i]; 
            child_stat->flag = mc.m_child_flag;
            child_stat->actual = mc.m_actual;
            child_stat->throughput = mc.m_throughput;
            child_stat->cputime = mc.m_cputime;
            child_stat->walltime = mc.m_walltime;
            *stop_flag = mc.m_stop_flag;
            master_join_count--;
            break;
        case R_FLAG_DATA:
            if(mc.m_mygen != mygen)
            {
                /* You are NOT one of my children !!! */
                printf("*** Unknown Iozone children responding !!! ***\n");
                continue;
            }
            if(mdebug)
                printf("loop: R_FLAG_DATA: Client %d flag %d \n",
                  (int)mc.m_client_number,
                  (int)mc.m_child_flag);
            i = mc.m_client_number;
            child_stat = (struct child_stats *)&shmaddr[i]; 
            child_stat->flag = (long long)(mc.m_child_flag);
            break;
        case R_STOP_FLAG:
            if(mc.m_mygen != mygen)
            {
                /* You are NOT one of my children !!! */
                printf("*** Unknown Iozone children responding !!! ***\n");
                continue;
            }
            if(mdebug)
              printf("Master loop: R_STOP_FLAG: Client %d STOP_FLAG \n",
                  (int)mc.m_client_number);
            *stop_flag=1;
            distribute_stop();
            break;
        }
            
    }
    /* Let the clients report results before exiting.
           Also, exiting too quickly can close the async
           socket to the child, and cause it to become ill.
           On Solaris, it gets stuck in a 0=read() loop. */

#if defined(Windows)
    sleep(1);
#else
    nanosleep(&req,&rem);
#endif

    exit(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int start_master_send ( char *  child_host_name,
int  child_port,
struct in_addr *  my_s_addr 
)

Definition at line 21070 of file iozone.c.

{
    int rc,master_socket_val;
    struct sockaddr_in addr,raddr;
    struct hostent *he;
    int port,tmp_port;
    int ecount = 0;
    struct in_addr *ip;
    struct timespec req,rem;

    req.tv_sec = 0;
    req.tv_nsec = 10000000;
    rem.tv_sec = 0;
    rem.tv_nsec = 10000000;

        he = gethostbyname(child_host_name);
        if (he == NULL)
        {
                printf("Master: Bad hostname >%s<\n",child_host_name);
        fflush(stdout);
                exit(22);
        }
    if(mdebug ==1)
    {
            printf("Master: start master send: %s\n", he->h_name);
        fflush(stdout);
    }
        ip = (struct in_addr *)he->h_addr_list[0];
#ifndef UWIN
    if(mdebug ==1)
    {
            printf("Master: child name: %s\n", (char *)inet_ntoa(*ip));
            printf("Master: child Port: %d\n", child_port);
        fflush(stdout);
    }
#endif

    port=child_port;
    my_s_addr->s_addr = ip->s_addr;
    /*port=CHILD_LIST_PORT;*/

        raddr.sin_family = AF_INET;
        raddr.sin_port = htons(port);
        raddr.sin_addr.s_addr = ip->s_addr;
        master_socket_val = socket(AF_INET, SOCK_STREAM, 0);
        if (master_socket_val < 0)
        {
                perror("Master: socket failed:");
                exit(23);
        }
        bzero(&addr, sizeof(struct sockaddr_in));
    tmp_port=HOST_ESEND_PORT;
        addr.sin_port = htons(tmp_port);
        addr.sin_family = AF_INET;
        addr.sin_addr.s_addr = INADDR_ANY;
        rc = -1;
        while (rc < 0)
        {
                rc = bind(master_socket_val, (struct sockaddr *)&addr,
                                                sizeof(struct sockaddr_in));
        if(rc < 0)
        {
            tmp_port++;
                    addr.sin_port=htons(tmp_port);
            continue;
        }
        }
    if(mdebug ==1)
    {
        printf("Master: Bound port\n");
        fflush(stdout);
    }
        if (rc < 0)
        {
                perror("Master: bind failed for sync channel to child.\n");
                exit(24);
        }
    nanosleep(&req,&rem);
again:
        rc = connect(master_socket_val, (struct sockaddr *)&raddr, 
            sizeof(struct sockaddr_in));
    if (rc < 0)
        {
        if(ecount++ < 300)
        {
            nanosleep(&req,&rem);
            /*sleep(1);*/
            goto again;
        }
                perror("Master: connect failed\n");
        printf("Error %d\n",errno);
                exit(25);
        }
    if(mdebug ==1)
    {
        printf("Master Connected\n");
        fflush(stdout);
    }
    return (master_socket_val);
}

Here is the call graph for this function:

int start_master_send_async ( char *  child_host_name,
int  child_port,
struct in_addr  my_s_addr 
)

Definition at line 21184 of file iozone.c.

{
    int rc,master_socket_val;
    struct sockaddr_in addr,raddr;
    int port,tmp_port;
    int ecount = 0;
    struct timespec req,rem;

    req.tv_sec = 0;
    req.tv_nsec = 10000000;
    rem.tv_sec = 0;
    rem.tv_nsec = 10000000;


    port=child_port;
    nanosleep(&req,&rem);

over:
        raddr.sin_family = AF_INET;
        raddr.sin_port = htons(port);
        raddr.sin_addr.s_addr = my_s_addr.s_addr;
        master_socket_val = socket(AF_INET, SOCK_STREAM, 0);
        if (master_socket_val < 0)
        {
                perror("Master: async socket failed:");
                exit(23);
        }
        bzero(&addr, sizeof(struct sockaddr_in));
    tmp_port=HOST_ASEND_PORT;
        addr.sin_port = htons(tmp_port);
        addr.sin_family = AF_INET;
        addr.sin_addr.s_addr = INADDR_ANY;
        rc = -1;
        while (rc < 0)
        {
                rc = bind(master_socket_val, (struct sockaddr *)&addr,
                                                sizeof(struct sockaddr_in));
        if(rc < 0)
        {
            tmp_port++;
                    addr.sin_port=htons(tmp_port);
            continue;
        }
        }
    if(mdebug ==1)
    {
        printf("Master: Bound async port\n");
        fflush(stdout);
    }
        if (rc < 0)
        {
                perror("Master: bind async failed\n");
                exit(24);
        }
again:

        rc = connect(master_socket_val, (struct sockaddr *)&raddr, 
            sizeof(struct sockaddr_in));
    if (rc < 0)
        {
        if(ecount++ < 300)
        {
        /* Really need this sleep for Windows */
#if defined (Windows)
            sleep(1);
#else
            nanosleep(&req,&rem);
#endif
            goto again;
        }
                perror("Master: async connect failed\n");
                close(master_socket_val);
#if defined (Windows)
        sleep(1);
#else
        nanosleep(&req,&rem);
#endif
                /*sleep(1);*/
                ecount=0;
                goto over;
        }
    if(mdebug ==1)
    {
        printf("Master async Connected\n");
        fflush(stdout);
    }
    return (master_socket_val);
}

Here is the call graph for this function:

Here is the caller graph for this function:

start_monitor ( char *  test)

Definition at line 23678 of file iozone.c.

{
    char command_line[256];
    if(strlen(imon_start)!=0)
    {
        if(imon_sync)
           sprintf(command_line,"%s %s",imon_start,test);
        else
           sprintf(command_line,"%s %s&",imon_start,test);
        junk=system(command_line);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

void stop_child_listen ( int  child_socket_val)

Definition at line 20693 of file iozone.c.

{
    close(child_socket_val);
}

Here is the call graph for this function:

void stop_child_send ( )

Here is the caller graph for this function:

void stop_master_listen ( int  master_socket_val)

Definition at line 20723 of file iozone.c.

{
    if(mdebug)
       printf("Stop master listen\n");
/*
    shutdown(master_socket_val,SHUT_RDWR);
*/
    close(master_socket_val);
    master_socket_val = 0;
}

Here is the call graph for this function:

Definition at line 22064 of file iozone.c.

{
    if(mdebug>=1)
        printf("Stopping Master listen loop");
    kill(master_listen_pid,SIGKILL);
}

Here is the call graph for this function:

void stop_master_send ( )
void stop_master_send ( int  child_socket_val)

Definition at line 20744 of file iozone.c.

{
    close(child_socket_val);
}

Here is the call graph for this function:

stop_monitor ( char *  test)

Definition at line 23696 of file iozone.c.

{
    char command_line[256];
    if(strlen(imon_stop)!=0)
    {
        if(imon_sync)
           sprintf(command_line,"%s %s",imon_stop,test);
        else
           sprintf(command_line,"%s %s &",imon_stop,test);
        junk=system(command_line);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void store_dvalue ( )

Here is the caller graph for this function:

void store_dvalue ( double  value)

Definition at line 18780 of file iozone.c.

{
    report_darray[current_x][current_y]=value;
    current_x++;
    if(current_x > max_x)
        max_x=current_x;
    if(current_y > max_y)
        max_y=current_y;
    if(max_x >= MAX_X)
    {
        printf("\nMAX_X too small\n");
        exit(163);
    }
    if(max_y >= MAXSTREAMS)
    {
        printf("\nMAXSTREAMS too small\n");
        exit(164);
    }
}

Here is the call graph for this function:

store_times ( double  walltime,
double  cputime 
)

Definition at line 11551 of file iozone.c.

Here is the call graph for this function:

Here is the caller graph for this function:

store_value ( off64_t  value)

Definition at line 11518 of file iozone.c.

{
    report_array[current_x][current_y]=value;
    current_x++;
    if(current_x > max_x)
        max_x=current_x;
    if(current_y > max_y)
        max_y=current_y;
    if(max_x >= MAX_X)
    {
        printf("\nMAX_X too small\n");
        exit(117);
    }
    if(max_y >= MAX_Y)
    {
        printf("\nMAX_Y too small\n");
        exit(118);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int system ( )

Here is the caller graph for this function:

Here is the caller graph for this function:

void tell_children_begin ( long long  childnum)

Definition at line 22365 of file iozone.c.

{
    struct client_command cc;
    int x;
    bzero(&cc,sizeof(struct client_command));
    x = (int) childnum;
    if(mdebug>=1)
        printf("Master: Tell child %d to begin\n",x);
    cc.c_command = R_FLAG_DATA;
    cc.c_child_flag = CHILD_STATE_BEGIN; 
    cc.c_client_number = (int)childnum; 
    master_send(master_send_sockets[x],child_idents[x].child_name, &cc,sizeof(struct client_command));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tell_master_ready ( long long  chid)

Definition at line 22082 of file iozone.c.

{
    struct master_command mc;
    bzero(&mc,sizeof(struct master_command));
    if(cdebug>=1)
    {
        fprintf(newstdout,"Child %d: Tell master to go\n",(int)chid);
        fflush(newstdout);
    }
    mc.m_command = R_FLAG_DATA;
    mc.m_mygen = mygen;
    mc.m_version = proto_version;
    mc.m_child_flag = CHILD_STATE_READY; 
    mc.m_client_number = (int)chid; 
    mc.m_client_error = client_error;
    child_send(controlling_host_name,(struct master_command *)&mc, sizeof(struct master_command));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void tell_master_stats ( int  testnum,
long long  chid,
double  throughput,
double  actual,
float  cpu_time,
double  wall_time,
char  stop_flag,
long long  child_flag 
)

Definition at line 22022 of file iozone.c.

{
    struct master_command mc;
    bzero(&mc,sizeof(struct master_command));
    mc.m_client_number = (int) chid;
    mc.m_client_error = (int) client_error;
    mc.m_throughput= throughput;
    mc.m_testnum = testnum;
    mc.m_actual = actual;
    mc.m_cputime = cpu_time;
    mc.m_walltime = wall_time;
    mc.m_stop_flag = stop_flag;
    mc.m_child_flag = child_flag;
    mc.m_command = R_STAT_DATA;
    mc.m_mygen = mygen;
    mc.m_version = proto_version;
    if(cdebug>=1)
    {
        fprintf(newstdout,"Child %d: Tell master stats and terminate\n",(int)chid);
        fflush(newstdout);
    }
    child_send(controlling_host_name,(struct master_command *)&mc, sizeof(struct master_command));
}

Here is the call graph for this function:

Definition at line 22538 of file iozone.c.

{
    int i;
    struct client_command cc;
    bzero(&cc,sizeof(struct client_command));
    cc.c_command = R_TERMINATE;
    for(i=0;i<num_child;i++)
    {
        child_idents[i].state = C_STATE_ZERO;
        cc.c_client_number = (int)i; 
        if(mdebug)
            printf("Master terminating async channels to children.\n");
        master_send(master_send_async_sockets[i],child_idents[i].child_name, &cc,sizeof(struct client_command));
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void*() thread_cleanup_test ( )

Here is the caller graph for this function:

void* thread_cleanup_test ( x  )

Definition at line 18369 of file iozone.c.

{
    long long xx;
    struct child_stats *child_stat;
    char *dummyfile[MAXSTREAMS];           /* name of dummy file     */

    
#ifdef NO_THREADS
    xx=chid;
#else
    if(use_thread)
        xx = (long long)((long)x);
    else
    {
        xx=chid;
    }
#endif
    dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
    if(mfflag)
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s",filearray[xx]);
#else
        sprintf(dummyfile[xx],"%s",filearray[xx]);
#endif
    }
    else
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx],xx);
#else
        sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx],xx);
#endif
    }
    if(!no_unlink)
    {
        if(check_filename(dummyfile[xx]))
        unlink(dummyfile[xx]);
    }

    child_stat = (struct child_stats *)&shmaddr[xx];
    /*****************/
    /* Children only */
    /*****************/
    child_stat=(struct child_stats *)&shmaddr[xx];
    child_stat->flag = CHILD_STATE_READY;
    if(distributed && client_iozone)
        {
        tell_master_ready(chid);
                wait_for_master_go(chid);
        }
        else
        {
                while(child_stat->flag!=CHILD_STATE_BEGIN)   /* Wait for signal from parent */
                        Poll((long long)1);
        }

    *stop_flag=1;
    if(distributed && client_iozone)
        send_stop();
        if(distributed && client_iozone)
                tell_master_stats(THREAD_CLEANUP_TEST, chid, child_stat->throughput,
                        child_stat->actual,
            child_stat->cputime, child_stat->walltime,
            (char)*stop_flag,
                        (long long)CHILD_STATE_HOLD);
    child_stat->flag = CHILD_STATE_HOLD;    /* Tell parent I'm done */
    free(dummyfile[xx]);

    if(distributed && client_iozone)
        return(0);
#ifdef NO_THREADS
    exit(0);
#else
    if(use_thread)
        thread_exit();
    else
        exit(0);
#endif
return(0);
}

Here is the call graph for this function:

int thread_exit ( )

Definition at line 18526 of file iozone.c.

{
    pthread_exit((void *)NULL);
return(0);
}

Here is the caller graph for this function:

void*() thread_fread_test ( )

Here is the caller graph for this function:

void* thread_fread_test ( x  )

Definition at line 24871 of file iozone.c.

{
        struct child_stats *child_stat;
        double starttime1 = 0;
        double temp_time;
        double hist_time;
    double desired_op_rate_time;
    double actual_rate;
        double walltime, cputime;
        double compute_val = (double)0;
        float delay = (float)0;
        double thread_qtime_stop,thread_qtime_start;
        off64_t traj_offset;
        long long w_traj_bytes_completed;
        long long w_traj_ops_completed;
        FILE *w_traj_fd;
        int fd;
        long long recs_per_buffer;
        long long stopped,i;
        off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far;
        long long xx,xx2;
        char *dummyfile [MAXSTREAMS];           /* name of dummy file     */
        char *nbuff;
        char *maddr;
        char *wmaddr,*free_addr;
        char now_string[30];
        int anwser,bind_cpu;
#if defined(VXFS) || defined(solaris)
        int test_foo = 0;
#endif
        off64_t filebytes64;
        char tmpname[256];
        FILE *thread_wqfd;
        FILE *thread_Lwqfd;

        if(compute_flag)
                delay=compute_time;
        nbuff=maddr=wmaddr=free_addr=0;
        thread_qtime_stop=thread_qtime_start=0;
        thread_wqfd=w_traj_fd=thread_Lwqfd=(FILE *)0;
        traj_offset=walltime=cputime=0;
        anwser=bind_cpu=0;
        char *stdio_buf;
        long long Index = 0;
        FILE *stream = NULL;
        char *filename;

        if(w_traj_flag)
        {
                filebytes64 = w_traj_fsize;
                numrecs64=w_traj_ops;
        }
        else
        {
                filebytes64 = numrecs64*reclen;
        }
        written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
        w_traj_bytes_completed=w_traj_ops_completed=0;
        recs_per_buffer = cache_size/reclen ;
#ifdef NO_THREADS
        xx=chid;
#else
        if(use_thread)
        {
                xx = (long long)((long)x);
        }
        else
        {
                xx=chid;
        }
#endif
#ifndef NO_THREADS
#ifdef _HPUX_SOURCE
        if(ioz_processor_bind)
        {
                 bind_cpu=(begin_proc+(int)xx)%num_processors;
                 pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
                         (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
                my_nap(40);     /* Switch to new cpu */
        }
#endif
#endif
        if(use_thread)
                nbuff=barray[xx];
        else
                nbuff=buffer;
        if(debug1 )
        {
           if(use_thread)
#ifdef NO_PRINT_LLD
                printf("\nStarting child %ld\n",xx);
#else
                printf("\nStarting child %lld\n",xx);
#endif
           else
#ifdef NO_PRINT_LLD
                printf("\nStarting process %d slot %ld\n",getpid(),xx);
#else
                printf("\nStarting process %d slot %lld\n",getpid(),xx);
#endif

        }
        dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
        xx2=xx;
        if(share_file)
                xx2=(long long)0;
        if(mfflag)
        {
#ifdef NO_PRINT_LLD
           sprintf(dummyfile[xx],"%s",filearray[xx2]);
#else
           sprintf(dummyfile[xx],"%s",filearray[xx2]);
#endif
        }
        else
        {
#ifdef NO_PRINT_LLD
           sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
#else
           sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
#endif
        }

        filename=dummyfile[xx];

        if(mmapflag || async_flag)
                return(0);

        stdio_buf=(char *)malloc((size_t)reclen);

    if(Uflag) /* Unmount and re-mount the mountpoint */
    {
        purge_buffer_cache();
    }
#ifdef IRIX64
    if((stream=(FILE *)fopen(filename,"r")) == 0)
    {
        printf("\nCan not fdopen temp file: %s\n",
            filename);
        perror("fdopen");
        exit(51);
    }
#else
    if((stream=(FILE *)I_FOPEN(filename,"r")) == 0)
    {
        printf("\nCan not fdopen temp file: %s\n",
            filename);
        perror("fdopen");
        exit(52);
    }
#endif
    fd=I_OPEN(filename,O_RDONLY,0);
    fsync(fd);
    close(fd);
        if(direct_flag)
          setvbuf(stream,stdio_buf,_IONBF,reclen);
        else
          setvbuf(stream,stdio_buf,_IOFBF,reclen);

    buffer=mainbuffer;
    if(fetchon)
        fetchit(buffer,reclen);
    compute_val=(double)0;

       /*******************************************************************/
       /*******************************************************************/

        child_stat = (struct child_stats *)&shmaddr[xx];
        child_stat->throughput = 0;
        child_stat->actual = 0;
        child_stat->flag=CHILD_STATE_READY; /* Tell parent child is ready to go */

        if(distributed && client_iozone)
                tell_master_ready(chid);
        if(distributed && client_iozone)
        {
                if(cdebug)
                {
                        printf("Child %d waiting for go from master\n",(int)xx);
                        fflush(stdout);
                }
                wait_for_master_go(chid);
                if(cdebug)
                {
                        printf("Child %d received go from master\n",(int)xx);
                        fflush(stdout);
                }
        }
        else
        {
                while(child_stat->flag!=CHILD_STATE_BEGIN)   /* Wait for signal from parent */
                        Poll((long long)1);
        }

        written_so_far=0;
        child_stat = (struct child_stats *)&shmaddr[xx];
        child_stat->actual = 0;
        child_stat->throughput = 0;
        stopped=0;
        if(Q_flag)
        {
                sprintf(tmpname,"Child_%d_frol.dat",(int)xx);
                thread_wqfd=fopen(tmpname,"a");
                if(thread_wqfd==0)
                {
                        client_error=errno;
                        if(distributed && client_iozone)
                                send_stop();
                        printf("Unable to open %s\n",tmpname);
                        exit(40);
                }
                fprintf(thread_wqfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
        }
        if(L_flag)
        {
                sprintf(tmpname,"Child_%d.log",(int)xx);
                thread_Lwqfd=fopen(tmpname,"a");
                if(thread_Lwqfd==0)
                {
                        client_error=errno;
                        if(distributed && client_iozone)
                                send_stop();
                        printf("Unable to open %s\n",tmpname);
                        exit(40);
                }
                get_date(now_string);
                fprintf(thread_Lwqfd,"%-25s %s","fread test start: ",now_string);
        }
        starttime1 = time_so_far();
        if(cpuutilflag)
        {
                walltime = starttime1;
                cputime = cputime_so_far();
        }



       /*******************************************************************/

    for(i=0; i<numrecs64; i++)
    {
        if(compute_flag)
            compute_val+=do_compute(compute_time);
        if(multi_buffer)
        {
            Index +=reclen;
            if(Index > (MAXBUFFERSIZE-reclen))
                Index=0;
            buffer = mbuffer + Index;
        }
        if(purge)
            purgeit(buffer,reclen);
        if(Q_flag || hist_summary || op_rate_flag)
        {
            thread_qtime_start=time_so_far();
        }
        if(fread(buffer, (size_t) reclen,1, stream) != 1)
        {
#ifdef _64BIT_ARCH_
#ifdef NO_PRINT_LLD
            printf("\nError freading block %ld %x\n", i,
                (unsigned long)buffer);
#else
            printf("\nError freading block %lld %llx\n", i,
                (unsigned long long)buffer);
#endif
#else
#ifdef NO_PRINT_LLD
            printf("\nError freading block %ld %lx\n", i,
                (long)buffer);
#else
            printf("\nError freading block %lld %lx\n", i,
                (long)buffer);
#endif
#endif
            perror("read");
            exit(54);
        }
        if(verify){
            if(verify_buffer(buffer,reclen,(off64_t)i,reclen,(long long)pattern,sverify)){
                exit(55);
            }
        }
        if(hist_summary)
        {
            thread_qtime_stop=time_so_far();
            hist_time =(thread_qtime_stop-thread_qtime_start);
            hist_insert(hist_time);
        }
        if(op_rate_flag)
        {
            thread_qtime_stop=time_so_far();
            desired_op_rate_time = ((double)1.0/(double)op_rate);
            actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
            if( actual_rate < desired_op_rate_time)
                  my_unap((unsigned long long)((desired_op_rate_time-actual_rate)*1000000.0 ));
        }
        if(Q_flag)
        {
            thread_qtime_stop=time_so_far();
#ifdef NO_PRINT_LLD
            fprintf(thread_wqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#else
            fprintf(thread_wqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#endif
        }
                w_traj_ops_completed++;
                w_traj_bytes_completed+=reclen;
                written_so_far+=reclen/1024;

    }
    if(include_flush)
        fflush(stream);
    if(include_close)
    {
        fclose(stream);
    }

        /*******************************************************************/

        if(!stopped){
                temp_time = time_so_far();
                child_stat->throughput = ((temp_time - starttime1)-time_res)
                        -compute_val;
                if(child_stat->throughput < (double).000001)
                {
                        child_stat->throughput= time_res;
                        if(rec_prob < reclen)
                                rec_prob = reclen;
                        res_prob=1;
                }

                if(OPS_flag){
                   /*written_so_far=(written_so_far*1024)/reclen;*/
                   written_so_far=w_traj_ops_completed;
                }
                child_stat->throughput =
                        (double)written_so_far/child_stat->throughput;
                child_stat->actual = (double)written_so_far;
        }
        if(cdebug)
        {
                printf("Child %d: throughput %f actual %f \n",(int)chid, child_stat->throughput,
                        child_stat->actual);
                fflush(stdout);
        }
        if(cpuutilflag)
        {
                cputime = cputime_so_far() - cputime;
                if (cputime < cputime_res)
                        cputime = 0.0;
                child_stat->cputime = cputime;
                walltime = time_so_far() - walltime;
                child_stat->walltime = walltime;
        }
        if(distributed && client_iozone)
                tell_master_stats(THREAD_FREAD_TEST, chid, child_stat->throughput,
                        child_stat->actual,
                        child_stat->cputime, child_stat->walltime,
                        (char)*stop_flag,
                        (long long)CHILD_STATE_HOLD);

        if (debug1) {
                printf(" child/slot: %lld, wall-cpu: %8.3f %8.3fC" " -> %6.2f%%\n",
                        xx, walltime, cputime,
                        cpu_util(cputime, walltime));
        }
        child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
        stopped=0;

        /*******************************************************************/
        /* End fead performance test.  *************************************/
        /*******************************************************************/

        if(debug1)
#ifdef NO_PRINT_LLD
                printf("\nChild finished %ld\n",xx);
#else
                printf("\nChild finished %lld\n",xx);
#endif
        if(Q_flag && (thread_wqfd !=0) )
                fclose(thread_wqfd);
        free(dummyfile[xx]);
        if(w_traj_flag)
                fclose(w_traj_fd);

        if(L_flag)
        {
                get_date(now_string);
                fprintf(thread_Lwqfd,"%-25s %s","Fread test finished: ",now_string);
                fclose(thread_Lwqfd);
        }

        /*******************************************************************/

        if(!include_close)
    {
        fflush(stream);
        fclose(stream);
    }
        stream = NULL;

        if(restf)
                sleep((int)(int)rest_val);

        free(stdio_buf);
        if(OPS_flag || MS_flag){
           filebytes64=filebytes64/reclen;
        }

        /*******************************************************************/
    if(hist_summary)
       dump_hist("Fread",(int)xx);
        if(distributed && client_iozone)
                return(0);
#ifdef NO_THREADS
        exit(0);
#else
        if(use_thread)
                thread_exit();
        else
                exit(0);
#endif

return(0);
}

Here is the call graph for this function:

void*() thread_fwrite_test ( )

Here is the caller graph for this function:

void* thread_fwrite_test ( x  )

Definition at line 24419 of file iozone.c.

{

        struct child_stats *child_stat;
        double starttime1 = 0;
        double temp_time;
        double hist_time;
    double desired_op_rate_time;
    double actual_rate;
        double walltime, cputime;
        double compute_val = (double)0;
        float delay = (float)0;
        double thread_qtime_stop,thread_qtime_start;
        off64_t traj_offset;
        long long w_traj_bytes_completed;
        long long w_traj_ops_completed;
        FILE *w_traj_fd;
        int fd;
        long long recs_per_buffer;
        long long stopped,i;
        off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far;
        long long xx,xx2;
        char *dummyfile [MAXSTREAMS];           /* name of dummy file     */
        char *nbuff;
        char *maddr;
        char *wmaddr,*free_addr;
        char now_string[30];
        int anwser,bind_cpu,wval;
#if defined(VXFS) || defined(solaris)
        int test_foo = 0;
#endif
        off64_t filebytes64;
        char tmpname[256];
        FILE *thread_wqfd;
        FILE *thread_Lwqfd;
        char *filename;

        char *stdio_buf;
        char *how;
        long long Index = 0;
        FILE *stream = NULL;
        static int First_Run = 1;

        if(compute_flag)
                delay=compute_time;
        nbuff=maddr=wmaddr=free_addr=0;
        thread_qtime_stop=thread_qtime_start=0;
        thread_wqfd=w_traj_fd=thread_Lwqfd=(FILE *)0;
        traj_offset=walltime=cputime=0;
        anwser=bind_cpu=0;

        if(w_traj_flag)
        {
                filebytes64 = w_traj_fsize;
                numrecs64=w_traj_ops;
        }
        else
        {
                filebytes64 = numrecs64*reclen;
        }
        written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
        w_traj_bytes_completed=w_traj_ops_completed=0;
        recs_per_buffer = cache_size/reclen ;
#ifdef NO_THREADS
        xx=chid;
#else
        if(use_thread)
        {
                xx = (long long)((long)x);
        }
        else
        {
                xx=chid;
        }
#endif
#ifndef NO_THREADS
#ifdef _HPUX_SOURCE
        if(ioz_processor_bind)
        {
                 bind_cpu=(begin_proc+(int)xx)%num_processors;
                 pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
                         (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
                my_nap(40);     /* Switch to new cpu */
        }
#endif
#endif
        if(use_thread)
                nbuff=barray[xx];
        else
                nbuff=buffer;
        if(debug1 )
        {
           if(use_thread)
#ifdef NO_PRINT_LLD
                printf("\nStarting child %ld\n",xx);
#else
                printf("\nStarting child %lld\n",xx);
#endif
           else
#ifdef NO_PRINT_LLD
                printf("\nStarting process %d slot %ld\n",getpid(),xx);
#else
                printf("\nStarting process %d slot %lld\n",getpid(),xx);
#endif

        }
        dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
        xx2=xx;
        if(share_file)
                xx2=(long long)0;
        if(mfflag)
        {
#ifdef NO_PRINT_LLD
           sprintf(dummyfile[xx],"%s",filearray[xx2]);
#else
           sprintf(dummyfile[xx],"%s",filearray[xx2]);
#endif
        }
        else
        {
#ifdef NO_PRINT_LLD
           sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
#else
           sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
#endif
        }
        filename=dummyfile[xx];

        if(mmapflag || async_flag)
                return(0);

        stdio_buf=(char *)malloc((size_t)reclen);

        if(Uflag) /* Unmount and re-mount the mountpoint */
        {
                purge_buffer_cache();
        }

        if(First_Run==1)
        {
        First_Run=0;
                if(check_filename(filename))
                        how="r+"; /* file exists, don't create and zero a new one. */
                else
                        how="w+"; /* file doesn't exist. create it. */
        }
        else
                how="r+"; /* re-tests should error out if file does not exist. */

#ifdef IRIX64
        if((stream=(FILE *)fopen(filename,how)) == 0)
        {
                printf("\nCan not fdopen temp file: %s %lld\n",
                        filename,errno);
                perror("fdopen");
                exit(48);
        }
#else
       if((stream=(FILE *)I_FOPEN(filename,how)) == 0)
        {
#ifdef NO_PRINT_LLD
                printf("\nCan not fdopen temp file: %s %d\n",
                        filename,errno);
#else
                printf("\nCan not fdopen temp file: %s %d\n",
                        filename,errno);
#endif
                perror("fdopen");
                exit(49);
        }
#endif
        fd=fileno(stream);
        fsync(fd);
        if(direct_flag)
          setvbuf(stream,stdio_buf,_IONBF,reclen);
        else
          setvbuf(stream,stdio_buf,_IOFBF,reclen);

        buffer=mainbuffer;
        if(fetchon)
                fetchit(buffer,reclen);
        if(verify || dedup || dedup_interior)
                fill_buffer(buffer,reclen,(long long)pattern,sverify,(long long)0);

        compute_val=(double)0;

       /*******************************************************************/

        child_stat = (struct child_stats *)&shmaddr[xx];
        child_stat->throughput = 0;
        child_stat->actual = 0;
        child_stat->flag=CHILD_STATE_READY; /* Tell parent child is ready to go */

        if(distributed && client_iozone)
                tell_master_ready(chid);
        if(distributed && client_iozone)
        {
                if(cdebug)
                {
                        printf("Child %d waiting for go from master\n",(int)xx);
                        fflush(stdout);
                }
                wait_for_master_go(chid);
                if(cdebug)
                {
                        printf("Child %d received go from master\n",(int)xx);
                        fflush(stdout);
                }
        }
        else
        {
                while(child_stat->flag!=CHILD_STATE_BEGIN)   /* Wait for signal from parent */
                        Poll((long long)1);
        }

        written_so_far=0;
        child_stat = (struct child_stats *)&shmaddr[xx];
        child_stat->actual = 0;
        child_stat->throughput = 0;
        stopped=0;
        if(Q_flag)
        {
                sprintf(tmpname,"Child_%d_fwol.dat",(int)xx);
                thread_wqfd=fopen(tmpname,"a");
                if(thread_wqfd==0)
                {
                        client_error=errno;
                        if(distributed && client_iozone)
                                send_stop();
                        printf("Unable to open %s\n",tmpname);
                        exit(40);
                }
                fprintf(thread_wqfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
        }
        if(L_flag)
        {
                sprintf(tmpname,"Child_%d.log",(int)xx);
                thread_Lwqfd=fopen(tmpname,"a");
                if(thread_Lwqfd==0)
                {
                        client_error=errno;
                        if(distributed && client_iozone)
                                send_stop();
                        printf("Unable to open %s\n",tmpname);
                        exit(40);
                }
                get_date(now_string);
                fprintf(thread_Lwqfd,"%-25s %s","fwrite test start: ",now_string);
        }
        starttime1 = time_so_far();
        if(cpuutilflag)
        {
                walltime = starttime1;
                cputime = cputime_so_far();
        }
       /*******************************************************************/
        for(i=0; i<numrecs64; i++){
                if(compute_flag)
                        compute_val+=do_compute(compute_time);
                if(multi_buffer)
                {
                        Index +=reclen;
                        if(Index > (MAXBUFFERSIZE-reclen))
                                Index=0;
                        buffer = mbuffer + Index;
                }
                if((verify & diag_v) || dedup || dedup_interior)
                        fill_buffer(buffer,reclen,(long long)pattern,sverify,i);
                if(purge)
                        purgeit(buffer,reclen);
        if(Q_flag || hist_summary || op_rate_flag)
        {
            thread_qtime_start=time_so_far();
        }
                if(fwrite(buffer, (size_t) reclen, 1, stream) != 1)
                {
#ifdef NO_PRINT_LLD
                        printf("\nError fwriting block %ld, fd= %d\n", i,
                                 fd);
#else
                        printf("\nError fwriting block %lld, fd= %d\n", i,
                                 fd);
#endif
                        perror("fwrite");
                        signal_handler();
                }
        if(hist_summary)
        {
            thread_qtime_stop=time_so_far();
            hist_time =(thread_qtime_stop-thread_qtime_start);
            hist_insert(hist_time);
        }
        if(op_rate_flag)
        {
            thread_qtime_stop=time_so_far();
            desired_op_rate_time = ((double)1.0/(double)op_rate);
            actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
            if( actual_rate < desired_op_rate_time)
                  my_unap((unsigned long long)((desired_op_rate_time-actual_rate)*1000000.0 ));
        }
        if(Q_flag)
        {
            thread_qtime_stop=time_so_far();
#ifdef NO_PRINT_LLD
            fprintf(thread_wqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#else
            fprintf(thread_wqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#endif
        }
                w_traj_ops_completed++;
                w_traj_bytes_completed+=reclen;
                written_so_far+=reclen/1024;
        }
        if(include_flush)
        {
                fflush(stream);
                wval=fsync(fd);
                if(wval==-1){
                        perror("fsync");
                        signal_handler();
                }
        }
        if(include_close)
        {
                wval=fclose(stream);
                if(wval==-1){
                        perror("fclose");
                        signal_handler();
                }
        }
        /*******************************************************************/
        if(!stopped){
                temp_time = time_so_far();
                child_stat->throughput = ((temp_time - starttime1)-time_res)
                        -compute_val;
                if(child_stat->throughput < (double).000001)
                {
                        child_stat->throughput= time_res;
                        if(rec_prob < reclen)
                                rec_prob = reclen;
                        res_prob=1;
                }

                if(OPS_flag){
                   /*written_so_far=(written_so_far*1024)/reclen;*/
                   written_so_far=w_traj_ops_completed;
                }
                child_stat->throughput =
                        (double)written_so_far/child_stat->throughput;
                child_stat->actual = (double)written_so_far;
        }
        if(cdebug)
        {
                printf("Child %d: throughput %f actual %f \n",(int)chid, child_stat->throughput,
                        child_stat->actual);
                fflush(stdout);
        }
        if(cpuutilflag)
        {
                cputime = cputime_so_far() - cputime;
                if (cputime < cputime_res)
                        cputime = 0.0;
                child_stat->cputime = cputime;
                walltime = time_so_far() - walltime;
                child_stat->walltime = walltime;
        }
        if(distributed && client_iozone)
                tell_master_stats(THREAD_FWRITE_TEST, chid, child_stat->throughput,
                        child_stat->actual,
                        child_stat->cputime, child_stat->walltime,
                        (char)*stop_flag,
                        (long long)CHILD_STATE_HOLD);

        if (debug1) {
                printf(" child/slot: %lld, wall-cpu: %8.3f %8.3fC" " -> %6.2f%%\n",
                        xx, walltime, cputime,
                        cpu_util(cputime, walltime));
        }
        child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
        stopped=0;

        /*******************************************************************/
        /* End fwrite performance test. *************************************/
        /*******************************************************************/

        if(debug1)
#ifdef NO_PRINT_LLD
                printf("\nChild finished %ld\n",xx);
#else
                printf("\nChild finished %lld\n",xx);
#endif
        if(Q_flag && (thread_wqfd !=0) )
                fclose(thread_wqfd);
        free(dummyfile[xx]);
        if(w_traj_flag)
                fclose(w_traj_fd);

        if(L_flag)
        {
                get_date(now_string);
                fprintf(thread_Lwqfd,"%-25s %s","Fwrite test finished: ",now_string);
                fclose(thread_Lwqfd);
        }
        /*******************************************************************/
        if(!include_close)
        {
                wval=fflush(stream);
                if(wval==-1){
                        perror("fflush");
                        signal_handler();
                }
                wval=fsync(fd);
                if(wval==-1){
                        perror("fsync");
                        signal_handler();
                }
                wval=fclose(stream);
                if(wval==-1){
                        perror("fclose");
                        signal_handler();
                }
        }

        if(restf)
                sleep((int)(int)rest_val);

        free(stdio_buf);
        if(OPS_flag || MS_flag){
           filebytes64=filebytes64/reclen;
        }
        /*******************************************************************/
    if(hist_summary)
       dump_hist("Fwrite",(int)xx);
        if(distributed && client_iozone)
                return(0);
#ifdef NO_THREADS
        exit(0);
#else
        if(use_thread)
                thread_exit();
        else
                exit(0);
#endif

return(0);
}

Here is the call graph for this function:

void*() thread_join ( )

Here is the caller graph for this function:

void* thread_join ( long long  tid,
void *  status 
)

Definition at line 18585 of file iozone.c.

{
    int xx;
    pthread_t eek;
    pthread_attr_t foo;

    bcopy(&p_childids[tid],&eek,sizeof(pthread_t));
    xx=pthread_join(eek,(void **)&foo);
    if(xx<0)
        printf("Thread join returned error %d\n",errno);
    return(0);
}
void*() thread_mix_test ( )

Here is the caller graph for this function:

void* thread_mix_test ( x  )

Definition at line 16993 of file iozone.c.

{
    int selector;
    int num_readers;
    long xx;

#ifdef NO_THREADS
    xx=chid;
#else
    if(use_thread)
    {
        xx = (long)x;
    }
    else
    {
        xx=(long)chid;
    }
#endif
    if(pct_read!=0)
    {
        num_readers = (pct_read * num_child)/100;
                if(xx < num_readers)
                        selector=0;
                else
                        selector=1;
    }
    else
    {
       if(Kplus_flag)
       {
        if(xx+1 <= Kplus_readers)
            selector=0;
        else
            selector=1;
       }
       else
       {
        /* Simple round robin */
        selector= ((int)xx) % 2;
       }        
    }
    if(selector==0)
    {
        if(seq_mix)
            thread_read_test(x);
        else
            thread_ranread_test(x);
    }
    else
    {
        if(seq_mix)
            thread_write_test(x);
        else
            thread_ranwrite_test(x);
    }
    return(0);
}

Here is the call graph for this function:

void*() thread_ranread_test ( )

Here is the caller graph for this function:

void* thread_ranread_test ( x  )

Definition at line 17059 of file iozone.c.

{
    long long xx,xx2;
    struct child_stats *child_stat;
    double walltime, cputime;
    int fd;
    long long flags = 0;
    double thread_qtime_stop,thread_qtime_start;
    double hist_time;
    double desired_op_rate_time;
    double actual_rate;
    double starttime1 = 0;
    float delay = 0;
    double temp_time;
    double compute_val = (double)0;
    off64_t written_so_far, ranread_so_far, re_written_so_far,re_read_so_far;
    long long recs_per_buffer;
    off64_t current_offset=0;
    off64_t i;
    char *dummyfile[MAXSTREAMS];           /* name of dummy file     */
    char *nbuff=0;
    char *maddr=0;
    char *wmaddr=0;
    volatile char *buffer1;
    int anwser,bind_cpu;
    off64_t traj_offset;
    off64_t lock_offset=0;
    char tmpname[256];
    char now_string[30];
    FILE *thread_randrfd=0;
    FILE *thread_Lwqfd=0;
    long long *recnum=0;
#if defined(VXFS) || defined(solaris)
    int test_foo = 0;
#endif
    long long save_pos;
#if defined (bsd4_2) || defined(Windows)
    long long rand1,rand2,rand3;
#endif
    unsigned long long big_rand;
#ifdef ASYNC_IO
    struct cache *gc=0;
#else
    long long *gc=0;
#endif
#ifdef MERSENNE
        unsigned long long init[4]={0x12345ULL, 0x23456ULL, 0x34567ULL, 0x45678ULL}, length=4;
#endif

#ifdef MERSENNE
        init_by_array64(init, length);
#else
#ifdef bsd4_2
        srand(0);
#else
#ifdef Windows
        srand(0);
#else
        srand48(0);
#endif
#endif
#endif
        recnum = (long long *)malloc(sizeof(*recnum)*numrecs64);
        if (recnum){
             /* pre-compute random sequence based on 
        Fischer-Yates (Knuth) card shuffle */
            for(i = 0; i < numrecs64; i++){
                recnum[i] = i;
            }
            for(i = 0; i < numrecs64; i++) {
                long long tmp = recnum[i];
#ifdef MERSENNE
               big_rand = genrand64_int64();
#else
#ifdef bsd4_2
               rand1=(long long)rand();
               rand2=(long long)rand();
               rand3=(long long)rand();
               big_rand=(rand1<<32)|(rand2<<16)|(rand3);
#else
#ifdef Windows
               rand1=(long long)rand();
               rand2=(long long)rand();
               rand3=(long long)rand();
               big_rand=(rand1<<32)|(rand2<<16)|(rand3);
#else
               big_rand = lrand48();
#endif
#endif
#endif
               big_rand = big_rand%numrecs64;
               tmp = recnum[i];
               recnum[i] = recnum[big_rand];
               recnum[big_rand] = tmp;
            }
        }
    else
    {
        fprintf(stderr,"Random uniqueness fallback.\n");
    }
    if(compute_flag)
        delay=compute_time;
    hist_time=thread_qtime_stop=thread_qtime_start=0;
    traj_offset=walltime=cputime=0;
    anwser=bind_cpu=0;
    written_so_far=ranread_so_far=re_written_so_far=re_read_so_far=0;
    recs_per_buffer = cache_size/reclen ;
#ifdef NO_THREADS
    xx=chid;
#else
    if(use_thread)
        xx = (long long)((long)x);
    else
    {
        xx=chid;
    }
#endif
#ifndef NO_THREADS
#if defined( _HPUX_SOURCE ) || defined ( linux )
    if(ioz_processor_bind)
    {
         bind_cpu=(begin_proc+(int)xx)%num_processors;
#if defined(_HPUX_SOURCE)
         pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
                         (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
#else
     cpu_set_t cpuset;

     CPU_ZERO(&cpuset);
     CPU_SET(bind_cpu, &cpuset);

     pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
#endif
        my_nap(40); /* Switch to new cpu */
    }
#endif
#endif
    if(use_thread)
        nbuff=barray[xx];
    else
        nbuff=buffer;
    dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
    xx2=xx;
    if(share_file)
        xx2=(long long)0;
    if(mfflag)
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#else
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#endif
    }
    else
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
#else
        sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
#endif
    }
    if(oflag)
    {
        flags=O_RDONLY|O_SYNC;
    }
    else
        flags=O_RDONLY;
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        flags |=O_RSYNC|O_SYNC;
#endif

#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        flags |=O_DIRECTIO;
#endif
#endif

#if defined(Windows)
        if(unbuffered)
        {
            hand=CreateFile(dummyfile[xx],
          GENERIC_READ|GENERIC_WRITE,
              FILE_SHARE_WRITE|FILE_SHARE_READ,
          NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
          FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
          NULL);
        }
#endif
    if((fd = I_OPEN(dummyfile[xx], ((int)flags),0))<0)
    {
        client_error=errno;
        if(distributed && client_iozone)
            send_stop();
        perror(dummyfile[xx]);
        exit(156);
    }
#ifdef ASYNC_IO
    if(async_flag)
        async_init(&gc,fd,direct_flag);
#endif

#ifdef VXFS
    if(direct_flag)
    {
        ioctl(fd,VX_SETCACHE,VX_DIRECT);
        ioctl(fd,VX_GETCACHE,&test_foo);
        if(test_foo == 0)
        {
            if(!client_iozone)
              printf("\nVxFS advanced setcache feature not available.\n");
            exit(3);
        }
    }
#endif
#if defined(solaris)
        if(direct_flag)
        {
                test_foo = directio(fd, DIRECTIO_ON);
                if(test_foo != 0)
                {
                        if(!client_iozone)
                          printf("\ndirectio not available.\n");
                        exit(3);
                }
        }
#endif

    if(mmapflag)
    {
        maddr=(char *)initfile(fd,(numrecs64*reclen),0,PROT_READ);
    }
    child_stat = (struct child_stats *)&shmaddr[xx];
    child_stat->throughput = 0;
    child_stat->actual = 0;
    if(debug1)
    {
       if(use_thread)
#ifdef NO_PRINT_LLD
        printf("\nStarting child %ld\n",xx);
#else
        printf("\nStarting child %lld\n",xx);
#endif
       else
#ifdef NO_PRINT_LLD
        printf("\nStarting process %d slot %ld\n",getpid(),xx);
#else
        printf("\nStarting process %d slot %lld\n",getpid(),xx);
#endif
        
    }
    /*****************/
    /* Children only */
    /*****************/
    if(fetchon)
        fetchit(nbuff,reclen);
        if(Q_flag)
        {
                sprintf(tmpname,"Child_%d_randrol.dat",(int)xx);
                thread_randrfd=fopen(tmpname,"a");
                if(thread_randrfd==0)
                {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
                        printf("Unable to open %s\n",tmpname);
                        exit(40);
                }
        fprintf(thread_randrfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
        }
    if(L_flag)
    {
        sprintf(tmpname,"Child_%d.log",(int)xx);
        thread_Lwqfd=fopen(tmpname,"a");
        if(thread_Lwqfd==0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            printf("Unable to open %s\n",tmpname);
            exit(40);
        }
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Random read start: ",
            now_string);
    }
    child_stat=(struct child_stats *)&shmaddr[xx];
    child_stat->flag = CHILD_STATE_READY;
        if(distributed && client_iozone)
        {
                tell_master_ready(chid);
                wait_for_master_go(chid);
        }
        else
        {
                while(child_stat->flag!=CHILD_STATE_BEGIN)   /* Wait for signal from parent */
                        Poll((long long)1);
        }
    starttime1 = time_so_far();
    if(cpuutilflag)
    {
        walltime = starttime1;
        cputime = cputime_so_far();
    }

#ifdef MERSENNE
        init_by_array64(init, length);
#else
#ifdef bsd4_2
        srand(0);
#else
#ifdef Windows
        srand(0);
#else
    srand48(0);
#endif
#endif
#endif
    if(file_lock)
        if(mylockf((int) fd, (int) 1, (int)1)!=0)
            printf("File lock for read failed. %d\n",errno);
    for(i=0; i<numrecs64; i++) {
        if(compute_flag)
            compute_val+=do_compute(delay);
        if(*stop_flag)
        {
            if(debug1)
                printf("\n(%ld) Stopped by another 2\n", (long)xx);
            break;
        }
        if(purge)
            purgeit(nbuff,reclen);
        if (recnum) {
            current_offset = reclen * (long long)recnum[i];
                } else {
#ifdef MERSENNE
                   big_rand = genrand64_int64();
           current_offset = (off64_t)reclen * (big_rand%numrecs64);
#else
#ifdef bsd4_2
           rand1=(long long)rand();
           rand2=(long long)rand();
           rand3=(long long)rand();
           big_rand=(rand1<<32)|(rand2<<16)|(rand3);
           current_offset = (off64_t)reclen * (big_rand%numrecs64);
#else
#ifdef Windows
           rand1=(long long)rand();
           rand2=(long long)rand();
           rand3=(long long)rand();
           big_rand=(rand1<<32)|(rand2<<16)|(rand3);
           current_offset = (off64_t)reclen * (big_rand%numrecs64);
#else
           current_offset = reclen * (lrand48()%numrecs64);
#endif
#endif
#endif
        }

        if (!(h_flag || k_flag || mmapflag))
        {
          if(I_LSEEK( fd, current_offset, SEEK_SET )<0)
          {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            perror("lseek");
            exit(158);
          };
        }
        if(rlocking)
        {
            lock_offset=I_LSEEK(fd,0,SEEK_CUR);
            mylockr((int) fd, (int) 1, (int)1,
              lock_offset, reclen);
        }
        if(Q_flag || hist_summary || op_rate_flag)
        {
            traj_offset=I_LSEEK(fd,0,SEEK_CUR);
                        thread_qtime_start=time_so_far();
        }
        if(mmapflag)
        {
            wmaddr = &maddr[current_offset];
            fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
        }
        else
        {
            if(async_flag)
            {
                if(no_copy_flag)
                  async_read_no_copy(gc, (long long)fd, &buffer1, (current_offset),
                     reclen, 0LL,(numrecs64*reclen),depth);
                else
                  async_read(gc, (long long)fd, nbuff, (current_offset), reclen,
                    0LL,(numrecs64*reclen),depth);
            }
            else
            {
              if(read((int)fd, (void*)nbuff, (size_t)reclen) != reclen)
              {
                if(*stop_flag)
                {
                    if(debug1)
                        printf("\n(%ld) Stopped by another 2\n", (long)xx);
                    break;
                }
#ifdef NO_PRINT_LLD
                printf("\nError reading block at %ld\n",
                     offset); 
#else
                printf("\nError reading block at %lld\n",
                     offset); 
#endif
                perror("ranread");
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                exit(160);
              }
            }
        }
        if(rlocking)
        {
            mylockr((int) fd, (int) 0, (int)1,
              lock_offset, reclen);
        }
        save_pos=current_offset/reclen;
        current_offset+=reclen;
        if(verify){
           if(async_flag && no_copy_flag)
           {
            if(verify_buffer(buffer1,reclen,(off64_t)save_pos,reclen,(long long)pattern,sverify)){
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                exit(161);
            }
           }
           else
           {
            if(verify_buffer(nbuff,reclen,(off64_t)save_pos,reclen,(long long)pattern,sverify)){
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                exit(162);
            }
           }
        }
        if(async_flag && no_copy_flag)
            async_release(gc);
        ranread_so_far+=reclen/1024;
        if(*stop_flag)
        {
            ranread_so_far-=reclen/1024;
        }
        if(hist_summary)
        {
            thread_qtime_stop=time_so_far();
            hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
            hist_insert(hist_time);
        }
        if(op_rate_flag)
        {
            thread_qtime_stop=time_so_far();
            desired_op_rate_time = ((double)1.0/(double)op_rate);
            actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
/*
printf("Desired rate %g  Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
    actual_rate, (desired_op_rate_time-actual_rate));
*/
            if( actual_rate < desired_op_rate_time)
                my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
        }
                if(Q_flag)
                {
                        thread_qtime_stop=time_so_far();
#ifdef NO_PRINT_LLD
                        fprintf(thread_randrfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#else
                        fprintf(thread_randrfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#endif
                }
    }
    if(file_lock)
        if(mylockf((int) fd,(int)0,(int)1))
            printf("Read unlock failed %d\n",errno);
#ifdef ASYNC_IO
    if(async_flag)
    {
        end_async(gc);
        gc=0;
    }
#endif
    if(include_flush)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)(numrecs64*reclen),MS_SYNC);
        }else
            fsync(fd);
    }
    if(include_close)
    {   
        if(mmapflag)
        {
            mmap_end(maddr,(unsigned long long)numrecs64*reclen);
        }
        close(fd);
    }
    temp_time = time_so_far();
    child_stat=(struct child_stats *)&shmaddr[xx];
    child_stat->throughput = ((temp_time - starttime1)-time_res)
        -compute_val;
    if(child_stat->throughput < (double).000001) 
    {
        child_stat->throughput= time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
    if(OPS_flag){
       ranread_so_far=(ranread_so_far*1024)/reclen;
    }
    child_stat->throughput = ranread_so_far/child_stat->throughput;
    child_stat->actual = ranread_so_far;
    if(!xflag)
    {
        *stop_flag=1;
        if(distributed && client_iozone)
            send_stop();
    }
        if(cdebug)
    {
                fprintf(newstdout,"Child %d: throughput %f actual %f \n",(int)chid,child_stat->throughput,
                        child_stat->actual);
        fflush(newstdout);
    }
    if(cpuutilflag)
    {
        cputime = cputime_so_far() - cputime;
        if (cputime < cputime_res)
            cputime = 0.0;
        child_stat->cputime = cputime;
        walltime = time_so_far() - walltime;
        child_stat->walltime = walltime;
    }
        if(distributed && client_iozone)
                tell_master_stats(THREAD_RANDOM_READ_TEST, chid, child_stat->throughput,
                        child_stat->actual,
            child_stat->cputime, child_stat->walltime,
            (char)*stop_flag,
                        (long long)CHILD_STATE_HOLD);
    child_stat->flag = CHILD_STATE_HOLD;    /* Tell parent I'm done */
    if(!include_close)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)(numrecs64*reclen),MS_SYNC);
            mmap_end(maddr,(unsigned long long)numrecs64*reclen);
        }else
            fsync(fd);
        close(fd);
    }
        if(Q_flag && (thread_randrfd !=0) )
                fclose(thread_randrfd);
    free(dummyfile[xx]);
    if(debug1)
#ifdef NO_PRINT_LLD
        printf("\nChild finished %ld\n",xx);
#else
        printf("\nChild finished %lld\n",xx);
#endif

    if(L_flag)
    {
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Random read finished: ",now_string);
        fclose(thread_Lwqfd);
    }
    if(recnum)
        free(recnum);
    if(hist_summary)
       dump_hist("Random Read",(int)xx);
    if(distributed && client_iozone)
        return(0);
#ifdef NO_THREADS
    exit(0);
#else
    if(use_thread)
        thread_exit();
    else
        exit(0);
#endif
return(0);
}

Here is the call graph for this function:

void*() thread_ranwrite_test ( )

Here is the caller graph for this function:

void* thread_ranwrite_test ( x  )

Definition at line 17679 of file iozone.c.

{

    struct child_stats *child_stat;
    double starttime1 = 0;
    double temp_time;
    double walltime, cputime;
    double compute_val = (double)0;
    float delay = (double)0;
    double thread_qtime_stop,thread_qtime_start;
    double hist_time;
    double desired_op_rate_time;
    double actual_rate;
    off64_t traj_offset;
    off64_t current_offset=0;
    long long flags;
    long long w_traj_bytes_completed;
    long long w_traj_ops_completed;
    int fd;
    long long recs_per_buffer;
    long long stopped,i;
    off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far;
    long long xx,xx2;
    char *dummyfile [MAXSTREAMS];           /* name of dummy file     */
    char *nbuff=0;
    char *maddr=0;
    char *wmaddr=0;
    char *free_addr=0;
    int anwser,bind_cpu,wval;
    off64_t filebytes64;
    off64_t lock_offset=0;
    char tmpname[256];
    char now_string[30];
    FILE *thread_randwqfd=0;
    FILE *thread_Lwqfd=0;
    long long *recnum = 0;
#if defined(VXFS) || defined(solaris)
    int test_foo = 0;
#endif
#if defined (bsd4_2) || defined(Windows)
    long long rand1,rand2,rand3;
#endif
    unsigned long long big_rand;

#ifdef ASYNC_IO
    struct cache *gc=0;

#else
    long long *gc=0;
#endif
#ifdef MERSENNE
        unsigned long long init[4]={0x12345ULL, 0x23456ULL, 0x34567ULL, 0x45678ULL}, length=4;
#endif

    if(compute_flag)
        delay=compute_time;
    hist_time=thread_qtime_stop=thread_qtime_start=0;
    traj_offset=walltime=cputime=0;
    anwser=bind_cpu=0;
    filebytes64 = numrecs64*reclen;
    written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
    w_traj_bytes_completed=w_traj_ops_completed=0;
    recs_per_buffer = cache_size/reclen ;
#ifdef MERSENNE
        init_by_array64(init, length);
#else
#ifdef bsd4_2
        srand(0);
#else
#ifdef Windows
        srand(0);
#else
        srand48(0);
#endif
#endif
#endif
        recnum = (long long *) malloc(sizeof(*recnum)*numrecs64);
        if (recnum){
             /* pre-compute random sequence based on 
        Fischer-Yates (Knuth) card shuffle */
            for(i = 0; i < numrecs64; i++){
                recnum[i] = i;
            }
            for(i = 0; i < numrecs64; i++) {
                long long tmp = recnum[i];
#ifdef MERSENNE
               big_rand = genrand64_int64();
#else
#ifdef bsd4_2
               rand1=(long long)rand();
               rand2=(long long)rand();
               rand3=(long long)rand();
               big_rand=(rand1<<32)|(rand2<<16)|(rand3);
#else
#ifdef Windows
               rand1=(long long)rand();
               rand2=(long long)rand();
               rand3=(long long)rand();
               big_rand=(rand1<<32)|(rand2<<16)|(rand3);
#else
               big_rand = lrand48();
#endif
#endif
#endif
               big_rand = big_rand%numrecs64;
               tmp = recnum[i];
               recnum[i] = recnum[big_rand];
               recnum[big_rand] = tmp;
            }
        }
    else
    {
        fprintf(stderr,"Random uniqueness fallback.\n");
    }
#ifdef NO_THREADS
    xx=chid;
#else
    if(use_thread)
    {
        xx = (long long)((long)x);
    }
    else
    {
        xx=chid;
    }
#endif
#ifndef NO_THREADS
#if defined( _HPUX_SOURCE ) || defined ( linux )
    if(ioz_processor_bind)
    {
         bind_cpu=(begin_proc+(int)xx)%num_processors;
#if defined(_HPUX_SOURCE)
         pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
                         (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
#else
     cpu_set_t cpuset;

     CPU_ZERO(&cpuset);
     CPU_SET(bind_cpu, &cpuset);

     pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
#endif
        my_nap(40); /* Switch to new cpu */
    }
#endif
#endif
    if(use_thread)
        nbuff=barray[xx];
    else
        nbuff=buffer;
    if(debug1 )
    {
       if(use_thread)
#ifdef NO_PRINT_LLD
        printf("\nStarting child %ld\n",xx);
#else
        printf("\nStarting child %lld\n",xx);
#endif
       else
#ifdef NO_PRINT_LLD
        printf("\nStarting process %d slot %ld\n",getpid(),xx);
#else
        printf("\nStarting process %d slot %lld\n",getpid(),xx);
#endif
        
    }
    dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
    xx2=xx;
    if(share_file)
        xx2=(long long)0;
    if(mfflag)
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#else
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#endif
    }
    else
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
#else
        sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
#endif
    }
    /*****************/
    /* Children only */
    /*******************************************************************/
    /* Random write throughput performance test. **********************/
    /*******************************************************************/
    if(oflag)
        flags=O_RDWR|O_SYNC|O_CREAT;
    else
        flags=O_RDWR|O_CREAT;
#if defined(O_DSYNC)
    if(odsync)
        flags |= O_DSYNC;
#endif
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        flags |=O_RSYNC|O_SYNC;
#endif

#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        flags |=O_DIRECTIO;
#endif
#endif
#if defined(Windows)
        if(unbuffered)
        {
            hand=CreateFile(dummyfile[xx],
          GENERIC_READ|GENERIC_WRITE,
              FILE_SHARE_WRITE|FILE_SHARE_READ,
          NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
          FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
          NULL);
        }
#endif
    if((fd = I_OPEN(dummyfile[xx], ((int)flags),0640))<0)
    {
        client_error=errno;
        if(distributed && client_iozone)
            send_stop();
        printf("\nCan not open temp file: %s\n", 
            filename);
        perror("open");
        exit(125);
    }
#ifdef VXFS
    if(direct_flag)
    {
        ioctl(fd,VX_SETCACHE,VX_DIRECT);
        ioctl(fd,VX_GETCACHE,&test_foo);
        if(test_foo == 0)
        {
            if(!client_iozone)
              printf("\nVxFS advanced setcache feature not available.\n");
            exit(3);
        }
    }
#endif
#if defined(solaris)
        if(direct_flag)
        {
                test_foo = directio(fd, DIRECTIO_ON);
                if(test_foo != 0)
                {
                        if(!client_iozone)
                          printf("\ndirectio not available.\n");
                        exit(3);
                }
        }
#endif
#ifdef ASYNC_IO
    if(async_flag)
        async_init(&gc,fd,direct_flag);
#endif
    if(mmapflag)
    {
        maddr=(char *)initfile(fd,(filebytes64),1,PROT_READ|PROT_WRITE);
    }
    if(reclen < cache_size )
    {
        recs_per_buffer = cache_size/reclen ;
        nbuff=&nbuff[(xx%recs_per_buffer)*reclen];
    }
    if(fetchon)         /* Prefetch into processor cache */
        fetchit(nbuff,reclen);

    child_stat = (struct child_stats *)&shmaddr[xx];    
    child_stat->throughput = 0;
    child_stat->actual = 0;
    child_stat->flag=CHILD_STATE_READY; /* Tell parent child is ready to go */
    if(distributed && client_iozone)
    {
        tell_master_ready(chid);
        wait_for_master_go(chid);
    }
    else
    {
        while(child_stat->flag!=CHILD_STATE_BEGIN)   /* Wait for signal from parent */
            Poll((long long)1);
    }
    written_so_far=0;
    child_stat = (struct child_stats *)&shmaddr[xx];
    child_stat->actual = 0;
    child_stat->throughput = 0;
    stopped=0;
    if(file_lock)
        if(mylockf((int) fd, (int) 1, (int)0) != 0)
            printf("File lock for write failed. %d\n",errno);
    if(Q_flag)
    {
        sprintf(tmpname,"Child_%d_randwol.dat",(int)xx);
        thread_randwqfd=fopen(tmpname,"a");
        if(thread_randwqfd==0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            printf("Unable to open %s\n",tmpname);
            exit(40);
        }
        fprintf(thread_randwqfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
    }
    if(L_flag)
    {
        sprintf(tmpname,"Child_%d.log",(int)xx);
        thread_Lwqfd=fopen(tmpname,"a");
        if(thread_Lwqfd==0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            printf("Unable to open %s\n",tmpname);
            exit(40);
        }
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Random write start: ",
            now_string);
    }
    if((verify && !no_copy_flag) || dedup || dedup_interior)
        fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
    starttime1 = time_so_far();
    if(cpuutilflag)
    {
        walltime = starttime1;
        cputime = cputime_so_far();
    }
    for(i=0; i<numrecs64; i++){
        if(compute_flag)
            compute_val+=do_compute(delay);
        if (recnum) {
            current_offset = reclen * (long long)recnum[i];
                } else {
#ifdef bsd4_2
           rand1=rand();
           rand2=rand();
           rand3=rand();
           big_rand=(rand1<<32)|(rand2<<16)|(rand3);
           current_offset = (off64_t)reclen * (big_rand%numrecs64);
#else
#ifdef Windows
           rand1=rand();
           rand2=rand();
           rand3=rand();
           big_rand=(rand1<<32)|(rand2<<16)|(rand3);
           current_offset = (off64_t)reclen * (big_rand%numrecs64);
#else
           current_offset = reclen * (lrand48()%numrecs64);
#endif
#endif
        }

        if (!(h_flag || k_flag || mmapflag))
        {
          if(I_LSEEK( fd, current_offset, SEEK_SET )<0)
          {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            perror("lseek");
            exit(158);
          };
        }
        if(Q_flag || hist_summary || op_rate_flag)
        {
            traj_offset=I_LSEEK(fd,0,SEEK_CUR);
                        thread_qtime_start=time_so_far();
        }
        if(rlocking)
        {
            lock_offset=I_LSEEK(fd,0,SEEK_CUR);
            mylockr((int) fd, (int) 1, (int)0,
              lock_offset, reclen);
        }
        if((verify && !no_copy_flag) || dedup || dedup_interior)
            fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)(current_offset/reclen));
        if(*stop_flag && !stopped){
            if(include_flush)
            {
                if(mmapflag)
                    msync(maddr,(size_t)filebytes64,MS_SYNC);
                else
                    fsync(fd);
            }
            child_stat->throughput = 
                (time_so_far() - starttime1)-time_res;
            if(child_stat->throughput < (double).000001) 
            {
                child_stat->throughput = time_res;
                if(rec_prob < reclen)
                    rec_prob = reclen;
                res_prob=1;
            }

            if(OPS_flag){
               /*written_so_far=(written_so_far*1024)/reclen;*/
               written_so_far=w_traj_ops_completed;
            }
            child_stat->throughput = 
              (double)written_so_far/child_stat->throughput;
            child_stat->actual = (double)written_so_far;
            if(debug1)
            {
                printf("\n(%ld) Stopped by another\n", (long)xx);
            }
            stopped=1;
        }
        if(purge)
            purgeit(nbuff,reclen);
        if(Q_flag || hist_summary)
        {
            thread_qtime_start=time_so_far();
        }
again:      
        if(mmapflag)
        {
            wmaddr = &maddr[current_offset];
            fill_area((long long*)nbuff,(long long*)wmaddr,(long long)reclen);
            if(!mmapnsflag)
            {
              if(mmapasflag)
                msync(wmaddr,(size_t)reclen,MS_ASYNC);
              if(mmapssflag)
                msync(wmaddr,(size_t)reclen,MS_SYNC);
            }
        }
        else
        {
           if(async_flag)
           {
                 if(no_copy_flag)
                 {
                free_addr=nbuff=(char *)malloc((size_t)reclen+page_size);
                nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
                if(verify || dedup || dedup_interior)
                    fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)(current_offset/reclen));
                    async_write_no_copy(gc, (long long)fd, nbuff, reclen, (current_offset), depth,free_addr);
                 }
                 else
                async_write(gc, (long long)fd, nbuff, reclen, current_offset, depth);
           }
           else
           {
              wval = write(fd, nbuff, (size_t) reclen);
              if(wval != reclen)
              {
            if(*stop_flag && !stopped){
                if(include_flush)
                {
                    if(mmapflag)
                        msync(maddr,(size_t)filebytes64,MS_SYNC);
                    else
                        fsync(fd);
                }
                temp_time = time_so_far();
                child_stat->throughput = 
                    (temp_time - starttime1)-time_res;
                if(child_stat->throughput < (double).000001) 
                {
                    child_stat->throughput= time_res;
                    if(rec_prob < reclen)
                        rec_prob = reclen;
                    res_prob=1;
                }

                if(OPS_flag){
                   /*written_so_far=(written_so_far*1024)/reclen;*/
                   written_so_far=w_traj_ops_completed;
                }
                child_stat->throughput = 
                  (double)written_so_far/child_stat->throughput;
                child_stat->actual = (double)written_so_far;
                if(debug1)
                {
                    printf("\n(%ld) Stopped by another\n", (long)xx);
                }
                stopped=1;
                goto again;
            }
            /* Note: Writer must finish even though told
               to stop. Otherwise the readers will fail.
               The code will capture bytes transfered
               before told to stop but let the writer
               complete.
            */
#ifdef NO_PRINT_LLD
                printf("\nError writing block %ld, fd= %d\n", i,
                 fd);
#else
                printf("\nError writing block %lld, fd= %d\n", i,
                 fd);
#endif
            if(wval==-1)
                perror("write");
            if (!no_unlink)
            {
                    if(check_filename(dummyfile[xx]))
                unlink(dummyfile[xx]);
            }
            child_stat->flag = CHILD_STATE_HOLD;
                exit(127);
              }
            }
        }
        if(rlocking)
        {
            mylockr((int) fd, (int) 0, (int)0,
              lock_offset, reclen);
        }
        if(hist_summary)
        {
            thread_qtime_stop=time_so_far();
            hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
            hist_insert(hist_time);
        }
        if(op_rate_flag)
        {
            thread_qtime_stop=time_so_far();
            desired_op_rate_time = ((double)1.0/(double)op_rate);
            actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
/*
printf("Desired rate %g  Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
    actual_rate, (desired_op_rate_time-actual_rate));
*/
            if( actual_rate < desired_op_rate_time)
                my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
        }
        if(Q_flag)
        {
            thread_qtime_stop=time_so_far();
#ifdef NO_PRINT_LLD
            fprintf(thread_randwqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#else
            fprintf(thread_randwqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#endif
        }
        w_traj_ops_completed++;
        w_traj_bytes_completed+=reclen;
        written_so_far+=reclen/1024;
        if(*stop_flag)
        {
            written_so_far-=reclen/1024;
            w_traj_bytes_completed-=reclen;
        }
    }
    

    if(file_lock)
        if(mylockf((int) fd, (int) 0, (int)0))
            printf("Write unlock failed. %d\n",errno);
    
#ifdef ASYNC_IO
    if(async_flag)
    {
        end_async(gc);
        gc=0;
    }
#endif
    if(!xflag)
    {
        *stop_flag=1;
        if(distributed && client_iozone)
            send_stop();
    }
    
    if(include_flush)
    {
        if(mmapflag)
            msync(maddr,(size_t)filebytes64,MS_SYNC);
        else
            fsync(fd);
    }
    if(include_close)
    {
        if(mmapflag)
            mmap_end(maddr,(unsigned long long)filebytes64);
        close(fd);
    }
    if(!stopped){
        temp_time = time_so_far();
        child_stat->throughput = ((temp_time - starttime1)-time_res)
            -compute_val;
        if(child_stat->throughput < (double).000001) 
        {
            child_stat->throughput= time_res;
            if(rec_prob < reclen)
                rec_prob = reclen;
            res_prob=1;
        }

        if(OPS_flag){
           /*written_so_far=(written_so_far*1024)/reclen;*/
           written_so_far=w_traj_ops_completed;
        }
        child_stat->throughput =
            (double)written_so_far/child_stat->throughput;
        child_stat->actual = (double)written_so_far;
    }
    child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
        if(cdebug)
    {
                fprintf(newstdout,"Child %d: throughput %f actual %f \n",(int)chid,child_stat->throughput,
                        child_stat->actual);
        fflush(newstdout);
    }
    if(cpuutilflag)
    {
        cputime = cputime_so_far() - cputime;
        if (cputime < cputime_res)
            cputime = 0.0;
        child_stat->cputime = cputime;
        walltime = time_so_far() - walltime;
        child_stat->walltime = walltime;
    }
        if(distributed && client_iozone)
                tell_master_stats(THREAD_RANDOM_WRITE_TEST, chid, child_stat->throughput,
                        child_stat->actual,
            child_stat->cputime, child_stat->walltime,
            (char)*stop_flag,
                        (long long)CHILD_STATE_HOLD);
    stopped=0;
    /*******************************************************************/
    /* End random write performance test. ******************************/
    /*******************************************************************/
    if(debug1)
#ifdef NO_PRINT_LLD
        printf("\nChild finished %ld\n",xx);
#else
        printf("\nChild finished %lld\n",xx);
#endif
    if(!include_close)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)numrecs64*reclen,MS_SYNC); /*Clean up before read starts running*/ 
            mmap_end(maddr,(unsigned long long)numrecs64*reclen);
        }else
            fsync(fd);
            
        close(fd);
    }
    if(Q_flag && (thread_randwqfd !=0) )
        fclose(thread_randwqfd);
    free(dummyfile[xx]);

    if(L_flag)
    {
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Random write finished: ",
            now_string);
        fclose(thread_Lwqfd);
    }
    if(recnum)
        free(recnum);
    if(hist_summary)
       dump_hist("Random Write",(int)xx);
    if(distributed && client_iozone)
        return(0);
#ifdef NO_THREADS
    exit(0);
#else
    if(use_thread)
        thread_exit();
    else
        exit(0);
#endif
return(0);
}

Here is the call graph for this function:

void*() thread_read_test ( )

Here is the caller graph for this function:

void* thread_read_test ( x  )

Definition at line 14230 of file iozone.c.

{
    long long xx,xx2;
    struct child_stats *child_stat;
    double walltime, cputime;
    long long r_traj_bytes_completed;
    long long r_traj_ops_completed;
    int fd;
    FILE *r_traj_fd,*thread_rqfd;
    FILE *thread_Lwqfd;
    long long flags = 0;
    off64_t traj_offset;
    off64_t lock_offset=0;
    double starttime1 = 0;
    float delay = 0;
    double temp_time;
    double thread_qtime_start,thread_qtime_stop;
    double hist_time;
    double desired_op_rate_time;
    double actual_rate;
    double compute_val = (double)0;
    off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far;
    long long recs_per_buffer,traj_size;
    off64_t i;
    char *dummyfile[MAXSTREAMS];           /* name of dummy file     */
    char *nbuff=0;
    char *maddr=0;
    char *wmaddr=0;
    char tmpname[256];
    volatile char *buffer1;
    char now_string[30];
    int anwser,bind_cpu;
    long wval;
#if defined(VXFS) || defined(solaris)
    int test_foo = 0;
#endif
#ifdef ASYNC_IO
    struct cache *gc=0;
#else
    long long *gc=0;
#endif

    if(compute_flag)
        delay=compute_time;
    thread_rqfd=thread_Lwqfd=r_traj_fd=(FILE *)0;
    hist_time=traj_offset=thread_qtime_stop=thread_qtime_start=0;
    walltime=cputime=0;
    anwser=bind_cpu=0;
    r_traj_bytes_completed=r_traj_ops_completed=0;
    written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
    recs_per_buffer = cache_size/reclen ;
    if(r_traj_flag)
    {
        filebytes64 = r_traj_fsize;
        numrecs64=r_traj_ops;
    }
    else
    {
        filebytes64 = numrecs64*reclen;
    }
    
#ifdef NO_THREADS
    xx=chid;
#else
    if(use_thread)
        xx = (long long)((long)x);
    else
    {
        xx=chid;
    }
#endif
#ifndef NO_THREADS
#if defined( _HPUX_SOURCE ) || defined ( linux )
    if(ioz_processor_bind)
    {
         bind_cpu=(begin_proc+(int)xx)%num_processors;
#if defined(_HPUX_SOURCE)
         pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
                         (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
#else
     cpu_set_t cpuset;

     CPU_ZERO(&cpuset);
     CPU_SET(bind_cpu, &cpuset);

     pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
#endif
        my_nap(40); /* Switch to new cpu */
    }
#endif
#endif
    if(use_thread)
        nbuff=barray[xx];
    else
        nbuff=buffer;
    dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
    xx2=xx;
    if(share_file)
        xx2=(long long)0;
    if(mfflag)
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#else
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#endif
    }
    else
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
#else
        sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
#endif
    }
    if(oflag)
        flags=O_RDONLY|O_SYNC;
    else
        flags=O_RDONLY;
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        flags |=O_RSYNC|O_SYNC;
#endif

#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        flags |=O_DIRECTIO;
#endif
#endif
#if defined(Windows)
        if(unbuffered)
        {
            hand=CreateFile(dummyfile[xx],
          GENERIC_READ|GENERIC_WRITE,
              FILE_SHARE_WRITE|FILE_SHARE_READ,
          NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
          FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
          NULL);
        SetFilePointer(hand,(LONG)0,0,FILE_BEGIN);
        }
    else
    {
#endif
    if((fd = I_OPEN(dummyfile[xx], (int)flags,0))<0)
    {
        client_error=errno;
        if(distributed && client_iozone)
            send_stop();
        perror(dummyfile[xx]);
        exit(130);
    }
#if defined(Windows)
    }
#endif
#ifdef ASYNC_IO
    if(async_flag)
        async_init(&gc,fd,direct_flag);
#endif
#ifdef VXFS
    if(direct_flag)
    {
        ioctl(fd,VX_SETCACHE,VX_DIRECT);
        ioctl(fd,VX_GETCACHE,&test_foo);
        if(test_foo == 0)
        {
            if(!client_iozone)
              printf("\nVxFS advanced setcache feature not available.\n");
            exit(3);
        }
    }
#endif
#if defined(solaris)
        if(direct_flag)
        {
                test_foo = directio(fd, DIRECTIO_ON);
                if(test_foo != 0)
                {
                        if(!client_iozone)
                          printf("\ndirectio not available.\n");
                        exit(3);
                }
        }
#endif
    if(mmapflag)
    {
        maddr=(char *)initfile(fd,(numrecs64*reclen),0,PROT_READ);
    }
    child_stat = (struct child_stats *)&shmaddr[xx];
    child_stat->throughput = 0;
    child_stat->actual = 0;
    if(debug1)
    {
       if(use_thread)
#ifdef NO_PRINT_LLD
        printf("\nStarting child %ld\n",xx);
#else
        printf("\nStarting child %lld\n",xx);
#endif
       else
#ifdef NO_PRINT_LLD
        printf("\nStarting process %d slot %ld\n",getpid(),xx);
#else
        printf("\nStarting process %d slot %lld\n",getpid(),xx);
#endif
        
    }
    /*****************/
    /* Children only */
    /*****************/
    if(Q_flag)
    {
        sprintf(tmpname,"Child_%d_rol.dat",(int)xx);
        thread_rqfd=fopen(tmpname,"a");
        if(thread_rqfd==0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            printf("Unable to open %s\n",tmpname);
            exit(40);
        }
        fprintf(thread_rqfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
    }
    if(L_flag)
    {
        sprintf(tmpname,"Child_%d.log",(int)xx);
        thread_Lwqfd=fopen(tmpname,"a");
        if(thread_Lwqfd==0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            printf("Unable to open %s\n",tmpname);
            exit(40);
        }
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Read test start: ",now_string);
    }

    if(r_traj_flag)
        r_traj_fd=open_r_traj();
    if(fetchon)
        fetchit(nbuff,reclen);
    child_stat=(struct child_stats *)&shmaddr[xx];
    child_stat->flag = CHILD_STATE_READY;
    if(distributed && client_iozone)
        {
        tell_master_ready(chid);
                wait_for_master_go(chid);
        }
        else
        {
        /* Wait for signal from parent */
                while(child_stat->flag!=CHILD_STATE_BEGIN)   
                        Poll((long long)1);
        }
    if(file_lock)
        if(mylockf((int) fd, (int) 1, (int)1) != 0)
            printf("File lock for read failed. %d\n",errno);
    starttime1 = time_so_far();
    if(cpuutilflag)
    {
        walltime = starttime1;
        cputime = cputime_so_far();
    }

    if(r_traj_flag)
        rewind(r_traj_fd);
    for(i=0; i<numrecs64; i++){
        traj_offset= i*reclen;
        if(disrupt_flag && ((i%DISRUPT)==0))
        {
#if defined(Windows)
    
            if(unbuffered)
               disruptw(hand);
            else
               disrupt(fd);
#else
            disrupt(fd);
#endif
        }
        if(r_traj_flag)
        {
            traj_offset=get_traj(r_traj_fd, (long long *)&traj_size,(float *)&delay,(long)0);
            reclen=traj_size;
#if defined(Windows)
            if(unbuffered)
              SetFilePointer(hand,(LONG)traj_offset,0,FILE_BEGIN);
            else
#endif
            I_LSEEK(fd,traj_offset,SEEK_SET);
        }
        if(Q_flag)
        {
#if defined(Windows)
            if(unbuffered)
              traj_offset=SetFilePointer(hand,0,0,FILE_CURRENT);
            else
#endif
            traj_offset=I_LSEEK(fd,0,SEEK_CUR);
        }
        if(rlocking)
        {
            lock_offset=I_LSEEK(fd,0,SEEK_CUR);
            mylockr((int) fd, (int) 1, (int)1,
              lock_offset, reclen);
        }
        if(compute_flag)
            compute_val+=do_compute(delay);
        if(*stop_flag)
        {
            if(debug1)
                printf("\n(%ld) Stopped by another 2\n", (long)xx);
            break;
        }
        if(purge)
            purgeit(nbuff,reclen);
        if(Q_flag || hist_summary || op_rate_flag)
                {
                        thread_qtime_start=time_so_far();
                }
        if(mmapflag)
        {
            wmaddr = &maddr[i*reclen];
            fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
        }
        else
        {
              if(async_flag)
              {
                if(no_copy_flag)
                  async_read_no_copy(gc, (long long)fd, &buffer1, (i*reclen), reclen,
                    1LL,(numrecs64*reclen),depth);
                else
                  async_read(gc, (long long)fd, nbuff, (i*reclen), reclen,
                    1LL,(numrecs64*reclen),depth);
              }
              else
              {
#if defined(Windows)
                  if(unbuffered)
                  {
                ReadFile(hand,nbuff,reclen,(LPDWORD)&wval,0);
                  }
                  else
#endif
                  wval=read((int)fd, (void*)nbuff, (size_t) reclen);
                  if(wval != reclen)
                  {
                if(*stop_flag)
                {
                    if(debug1)
                        printf("\n(%ld) Stopped by another 2\n", (long)xx);
                    break;
                }
#ifdef NO_PRINT_LLD
                    printf("\nError reading block %ld, fd= %d\n", i,
                     fd);
#else
                    printf("\nError reading block %lld, fd= %d\n", i,
                     fd);
#endif
                perror("read");
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                    exit(132);
                  }
              }
        }
        if(verify){
           if(async_flag && no_copy_flag)
           {
               if(verify_buffer(buffer1,reclen,(off64_t)i,reclen,(long long)pattern,sverify)){
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                exit(133);
               }
           }
           else
           {
               if(verify_buffer(nbuff,reclen,(off64_t)i,reclen,(long long)pattern,sverify)){
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                exit(134);
               }
           }
        }
        if(async_flag && no_copy_flag)
            async_release(gc);
        read_so_far+=reclen/1024;
        r_traj_bytes_completed+=reclen;
        r_traj_ops_completed++;
        if(*stop_flag)
        {
            read_so_far-=reclen/1024;
            r_traj_bytes_completed-=reclen;
        }
        if(hist_summary)
        {
            thread_qtime_stop=time_so_far();
            hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
            hist_insert(hist_time);
        }
        if(op_rate_flag)
        {
            thread_qtime_stop=time_so_far();
            desired_op_rate_time = ((double)1.0/(double)op_rate);
            actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
/*
printf("Desired rate %g  Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
    actual_rate, (desired_op_rate_time-actual_rate));
*/
            if( actual_rate < desired_op_rate_time)
                my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
        }
                if(Q_flag)
                {
                        thread_qtime_stop=time_so_far();
#ifdef NO_PRINT_LLD
                        fprintf(thread_rqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#else
                        fprintf(thread_rqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#endif
                }

        if(rlocking)
        {
            mylockr((int) fd, (int) 0, (int)1,
              lock_offset, reclen);
        }
    }
    if(file_lock)
        if(mylockf((int) fd, (int) 0, (int)1))
            printf("Read unlock failed. %d\n",errno);
#ifdef ASYNC_IO
    if(async_flag)
    {
        end_async(gc);
        gc=0;
    }
#endif
    if(include_flush)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)(filebytes64),MS_SYNC);
        }else
            fsync(fd);
    }
    if(include_close)
    {   
        if(mmapflag)
        {
            mmap_end(maddr,(unsigned long long)filebytes64);
        }
#if defined(Windows)
        if(unbuffered)
          CloseHandle(hand);
        else
#endif
        close(fd);
    }
    temp_time = time_so_far();
    child_stat=(struct child_stats *)&shmaddr[xx];
    child_stat->throughput = ((temp_time - starttime1)-time_res)
        -compute_val;
    if(child_stat->throughput < (double).000001) 
    {
        child_stat->throughput= time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }

    if(OPS_flag){
       /*read_so_far=(read_so_far*1024)/reclen;*/
       read_so_far=r_traj_ops_completed;
    }
    child_stat->throughput = read_so_far/child_stat->throughput;
    child_stat->actual = read_so_far;
    if(!xflag)
    {
        *stop_flag=1;
        if(distributed && client_iozone)
            send_stop();
    }
        if(cdebug)
    {
                fprintf(newstdout,"Child %d: throughput %f actual %f \n",(int)chid,child_stat->throughput,
                        child_stat->actual);
        fflush(newstdout);
    }
    if(cpuutilflag)
    {
        cputime = cputime_so_far() - cputime;
        if (cputime < cputime_res)
            cputime = 0.0;
        child_stat->cputime = cputime;
        walltime = time_so_far() - walltime;
        child_stat->walltime = walltime;
    }
        if(distributed && client_iozone)
                tell_master_stats(THREAD_READ_TEST, chid, child_stat->throughput,
                        child_stat->actual, 
            child_stat->cputime, child_stat->walltime,
            (char)*stop_flag,
                        (long long)CHILD_STATE_HOLD);
    child_stat->flag = CHILD_STATE_HOLD;    /* Tell parent I'm done */
    /*fsync(fd);*/
    if(!include_close)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)(filebytes64),MS_SYNC);
            mmap_end(maddr,(unsigned long long)filebytes64);
        }else
            fsync(fd);
#if defined(Windows)
        if(unbuffered)
          CloseHandle(hand);
        else
#endif
        close(fd);
    }
        if(Q_flag && (thread_rqfd !=0) )
                fclose(thread_rqfd);
    free(dummyfile[xx]);
    if(r_traj_flag)
        fclose(r_traj_fd);
    if(debug1)
#ifdef NO_PRINT_LLD
        printf("\nChild finished %ld\n",xx);
#else
        printf("\nChild finished %lld\n",xx);
#endif

    if(L_flag)
    {
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Read test finished: ",now_string);
        fclose(thread_Lwqfd);
    }
    if(hist_summary)
       dump_hist("Read",(int)xx);
    if(distributed && client_iozone)
        return(0);
#ifdef NO_THREADS
    exit(0);
#else
    if(use_thread)
        thread_exit();
    else
        exit(0);
#endif
return(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 15917 of file iozone.c.

{
    long long xx,xx2;
    char *nbuff;
    struct child_stats *child_stat;
    int fd;
    long long flags = 0;
    double walltime, cputime;
    double thread_qtime_stop,thread_qtime_start;
    double hist_time;
    double desired_op_rate_time;
    double actual_rate;
    double starttime2 = 0;
    float delay = 0;
    double temp_time;
    double compute_val = (double)0;
    long long recs_per_buffer;
    off64_t i,t_offset;
    off64_t lock_offset=0;
    off64_t current_position=0;
    off64_t written_so_far, reverse_read, re_read_so_far,read_so_far;
    char *dummyfile[MAXSTREAMS];           /* name of dummy file     */
    char *maddr=0;
    char *wmaddr=0;
    char now_string[30];
    volatile char *buffer1;
    int anwser,bind_cpu;
    off64_t traj_offset;
    char tmpname[256];
    FILE *thread_revqfd=0;
    FILE *thread_Lwqfd=0;
#if defined(VXFS) || defined(solaris)
    int test_foo = 0;
#endif
#ifdef ASYNC_IO
    struct cache *gc=0;
#else
    long long *gc=0;
#endif
    /*****************/
    /* Children only */
    /*****************/
    if(compute_flag)
        delay=compute_time;
    hist_time=thread_qtime_stop=thread_qtime_start=0;
    traj_offset=walltime=cputime=0;
    anwser=bind_cpu=0;
    written_so_far=read_so_far=reverse_read=re_read_so_far=0;
    recs_per_buffer = cache_size/reclen ;
#ifdef NO_THREADS
    xx=chid;
#else
    if(use_thread)
        xx = (long long)((long)x);
    else
    {
        xx=chid;
    }
#endif
#ifndef NO_THREADS
#if defined( _HPUX_SOURCE ) || defined ( linux )
    if(ioz_processor_bind)
    {
         bind_cpu=(begin_proc+(int)xx)%num_processors;
#if defined(_HPUX_SOURCE)
         pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
                         (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
#else
     cpu_set_t cpuset;

     CPU_ZERO(&cpuset);
     CPU_SET(bind_cpu, &cpuset);

     pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
#endif
        my_nap(40); /* Switch to new cpu */
    }
#endif
#endif
    if(use_thread)
        nbuff=barray[xx];
    else
        nbuff=buffer;
    if(debug1)
    {
       if(use_thread)
#ifdef NO_PRINT_LLD
        printf("\nStarting child %ld\n",xx);
#else
        printf("\nStarting child %lld\n",xx);
#endif
       else
#ifdef NO_PRINT_LLD
        printf("\nStarting process %d slot %ld\n",getpid(),xx);
#else
        printf("\nStarting process %d slot %lld\n",getpid(),xx);
#endif
        
    }
    dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
    xx2=xx;
    if(share_file)
        xx2=(long long)0;
    if(mfflag)
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#else
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#endif
    }
    else
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
#else
        sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
#endif
    }
    if(oflag)
        flags=O_RDONLY|O_SYNC;
    else
        flags=O_RDONLY;
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        flags |=O_RSYNC|O_SYNC;
#endif

#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        flags |=O_DIRECTIO;
#endif
#endif
#if defined(Windows)
        if(unbuffered)
        {
            hand=CreateFile(dummyfile[xx],
          GENERIC_READ|GENERIC_WRITE,
              FILE_SHARE_WRITE|FILE_SHARE_READ,
          NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
          FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
          NULL);
        }
#endif

    if((fd = I_OPEN(dummyfile[xx], ((int)flags),0))<0)
    {
        client_error=errno;
        if(distributed && client_iozone)
            send_stop();
        perror(dummyfile[xx]);
        exit(140);
    }
#ifdef ASYNC_IO
    if(async_flag)
        async_init(&gc,fd,direct_flag);
#endif
#ifdef VXFS
    if(direct_flag)
    {
        ioctl(fd,VX_SETCACHE,VX_DIRECT);
        ioctl(fd,VX_GETCACHE,&test_foo);
        if(test_foo == 0)
        {
            if(!client_iozone)
              printf("\nVxFS advanced setcache feature not available.\n");
            exit(3);
        }
    }
#endif
#if defined(solaris)
        if(direct_flag)
        {
                test_foo = directio(fd, DIRECTIO_ON);
                if(test_foo != 0)
                {
                        if(!client_iozone)
                          printf("\ndirectio not available.\n");
                        exit(3);
                }
        }
#endif
    if(mmapflag)
    {
        maddr=(char *)initfile(fd,(numrecs64*reclen),0,PROT_READ);
    }
    if(fetchon)
        fetchit(nbuff,reclen);
        if(Q_flag)
        {
                sprintf(tmpname,"Child_%d_revol.dat",(int)xx);
                thread_revqfd=fopen(tmpname,"a");
                if(thread_revqfd==0)
                {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
                        printf("Unable to open %s\n",tmpname);
                        exit(40);
                }
        fprintf(thread_revqfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
        }
    if(L_flag)
    {
        sprintf(tmpname,"Child_%d.log",(int)xx);
        thread_Lwqfd=fopen(tmpname,"a");
        if(thread_Lwqfd==0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            printf("Unable to open %s\n",tmpname);
            exit(40);
        }
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Reverse read start: ",now_string);
    }
    child_stat = (struct child_stats *)&shmaddr[xx];
    child_stat->throughput = 0;
    child_stat->actual = 0;
    child_stat->flag = CHILD_STATE_READY;
        if(distributed && client_iozone)
        {
                tell_master_ready(chid);
                wait_for_master_go(chid);
        }
        else
        {
                while(child_stat->flag!=CHILD_STATE_BEGIN)   /* Wait for signal from parent */
                        Poll((long long)1);
        }
    starttime2 = time_so_far();
    if(cpuutilflag)
    {
        walltime = starttime2;
        cputime = cputime_so_far();
    }

    t_offset = (off64_t)reclen;
    if (!(h_flag || k_flag || mmapflag))
    {
      if(check_filename(dummyfile[xx]))
      {
        if((I_LSEEK( fd, -t_offset, SEEK_END ))<0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            perror("lseek");
            exit(142);
        }
      }
      else
      {
        if(I_LSEEK( fd, (numrecs64*reclen)-t_offset, SEEK_SET )<0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            perror("lseek");
            exit(77);
        }
      }
    }
    current_position=(reclen*numrecs64)-reclen;
    if(file_lock)
        if(mylockf((int) fd, (int) 1, (int)1)!=0)
            printf("File lock for read failed. %d\n",errno);
    for(i=0; i<numrecs64; i++) 
    {
        if(rlocking)
        {
            lock_offset=I_LSEEK(fd,0,SEEK_CUR);
            mylockr((int) fd, (int) 1, (int)1,
              lock_offset, reclen);
        }
        if(disrupt_flag && ((i%DISRUPT)==0))
        {
            disrupt(fd);
        }
        if(compute_flag)
            compute_val+=do_compute(delay);
        if(Q_flag)
        {
            traj_offset=I_LSEEK(fd,0,SEEK_CUR);
        }
        if(*stop_flag)
        {
            if(debug1)
                printf("\n(%ld) Stopped by another 3\n", (long)xx);
            break;
        }
        if(purge)
            purgeit(nbuff,reclen);
                if(Q_flag || hist_summary || op_rate_flag)
                {
                        thread_qtime_start=time_so_far();
                }
        if(mmapflag)
        {
            wmaddr = &maddr[current_position];
            fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
        }
        else
        {
              if(async_flag)
              {
                if(no_copy_flag)
                  async_read_no_copy(gc, (long long)fd, &buffer1, (current_position),
                    reclen, -1LL,(numrecs64*reclen),depth);
                else
                  async_read(gc, (long long)fd, nbuff, (current_position),reclen,
                    -1LL,(numrecs64*reclen),depth);
              }
              else
              {
                  if(read((int)fd, (void*)nbuff, (size_t) reclen) != reclen)
                  {
                if(*stop_flag)
                {
                    if(debug1)
                        printf("\n(%ld) Stopped by another 4\n", (long)xx);
                    break;
                }
#ifdef NO_PRINT_LLD
                printf("\nError reading block %ld\n", i); 
#else
                printf("\nError reading block %lld\n", i); 
#endif
                perror("read");
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                exit(144);
                  }
              }
        }
        if(verify){
           if(async_flag && no_copy_flag)
           {
            if(verify_buffer(buffer1,reclen,(off64_t)(current_position/reclen),reclen,(long long)pattern,sverify)){
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                exit(145);
            }
           }
           else
           {
            if(verify_buffer(nbuff,reclen,(off64_t)(current_position/reclen),reclen,(long long)pattern,sverify)){
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                exit(146);
            }
           }
        }
        if(rlocking)
        {
            mylockr((int) fd, (int) 0, (int)1,
              lock_offset, reclen);
        }
        current_position+=reclen;
        if(async_flag && no_copy_flag)
            async_release(gc);
        t_offset = (off64_t)reclen*2;
        if (!(h_flag || k_flag || mmapflag))
        {
          I_LSEEK( fd, -t_offset, SEEK_CUR );
        }
        current_position-=(2 *reclen);
        reverse_read +=reclen/1024;
        if(*stop_flag)
        {
            reverse_read -=reclen/1024;
        }
        if(hist_summary)
        {
            thread_qtime_stop=time_so_far();
            hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
            hist_insert(hist_time);
        }
        if(op_rate_flag)
        {
            thread_qtime_stop=time_so_far();
            desired_op_rate_time = ((double)1.0/(double)op_rate);
            actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
/*
printf("Desired rate %g  Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
    actual_rate, (desired_op_rate_time-actual_rate));
*/
            if( actual_rate < desired_op_rate_time)
                my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
        }
                if(Q_flag)
                {
                        thread_qtime_stop=time_so_far();
#ifdef NO_PRINT_LLD
                        fprintf(thread_revqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#else
                        fprintf(thread_revqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#endif
                }
    }
    if(file_lock)
        if(mylockf((int) fd,(int)0, (int)1))
            printf("Read unlock failed %d\n",errno);
#ifdef ASYNC_IO
    if(async_flag)
    {
        end_async(gc);
        gc=0;
    }
#endif
    if(include_flush)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)(numrecs64*reclen),MS_SYNC);
        }else
            fsync(fd);
    }
    if(include_close)
    {   
        if(mmapflag)
        {
            mmap_end(maddr,(unsigned long long)numrecs64*reclen);
        }
        close(fd);
    }
    temp_time = time_so_far();
    child_stat->throughput = ((temp_time - starttime2)-time_res)
        -compute_val;
    if(child_stat->throughput < (double).000001) 
    {
        child_stat->throughput= time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
    if(OPS_flag){
       reverse_read=(reverse_read*1024)/reclen;
    }
    child_stat->throughput = reverse_read/child_stat->throughput;
    child_stat->actual = reverse_read;
    if(!xflag)
    {
        *stop_flag=1;
        if(distributed && client_iozone)
            send_stop();
    }
    if(cpuutilflag)
    {
        cputime = cputime_so_far() - cputime;
        if (cputime < cputime_res)
            cputime = 0.0;
        child_stat->cputime = cputime;
        walltime = time_so_far() - walltime;
        child_stat->walltime = walltime;
    }
        if(distributed && client_iozone)
                tell_master_stats(THREAD_REVERSE_READ_TEST, chid, child_stat->throughput,
                        child_stat->actual,
            child_stat->cputime, child_stat->walltime,
            (char)*stop_flag,
            (long long)CHILD_STATE_HOLD);
    child_stat->flag = CHILD_STATE_HOLD;    /* Tell parent I'm done */
    if(!include_close)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)(numrecs64*reclen),MS_SYNC);
            mmap_end(maddr,(unsigned long long)numrecs64*reclen);
        }else
            fsync(fd);
        close(fd);
    }
    free(dummyfile[xx]);
        if(Q_flag && (thread_revqfd !=0) )
                fclose(thread_revqfd);
    if(debug1)
#ifdef NO_PRINT_LLD
        printf("\nChild finished %ld\n",xx);
#else
        printf("\nChild finished %lld\n",xx);
#endif

    if(L_flag)
    {
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Reverse read finished: ",
            now_string);
        fclose(thread_Lwqfd);
    }
    if(hist_summary)
       dump_hist("Read Backwards",(int)xx);
    if(distributed && client_iozone)
        return(0);
#ifdef NO_THREADS
    exit(0);
#else
    if(use_thread)
        thread_exit();
    else
        exit(0);
#endif
return(0);
}

Here is the call graph for this function:

void*() thread_rread_test ( )

Here is the caller graph for this function:

void* thread_rread_test ( x  )

Definition at line 15338 of file iozone.c.

{
    long long xx,xx2;
    char *nbuff;
    struct child_stats *child_stat;
    int fd;
    FILE *r_traj_fd,*thread_rrqfd;
    FILE *thread_Lwqfd;
    long long r_traj_bytes_completed;
    double walltime, cputime;
    long long r_traj_ops_completed;
    off64_t traj_offset;
    off64_t lock_offset=0;
    long long flags = 0;
    double starttime1 = 0;
    float delay = 0;
    double temp_time;
    double thread_qtime_start,thread_qtime_stop;
    double hist_time;
    double desired_op_rate_time;
    double actual_rate;
    double compute_val = (double)0;
    long long recs_per_buffer,traj_size;
    off64_t i;
    off64_t written_so_far, read_so_far, re_written_so_far,
        re_read_so_far;
    char *dummyfile[MAXSTREAMS];           /* name of dummy file     */
    char *maddr=0;
    char *wmaddr=0;
    char now_string[30];
    volatile char *buffer1;
    int anwser,bind_cpu;
    long wval;
    char tmpname[256];
#if defined(VXFS) || defined(solaris)
    int test_foo = 0;
#endif
#ifdef ASYNC_IO
    struct cache *gc=0;
#else
    long long *gc=0;
#endif
    /*****************/
    /* Children only */
    /*****************/
    if(compute_flag)
        delay=compute_time;
    hist_time=thread_qtime_stop=thread_qtime_start=0;
    thread_rrqfd=r_traj_fd=thread_Lwqfd=(FILE *)0;
    traj_offset=walltime=cputime=0;
    anwser=bind_cpu=0;
    r_traj_bytes_completed=r_traj_ops_completed=0;
    written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
    recs_per_buffer = cache_size/reclen ;
#ifdef NO_THREADS
    xx=chid;
#else
    if(r_traj_flag)
    {
        filebytes64 = r_traj_fsize;
        numrecs64=r_traj_ops;
    }
    else
    {
        filebytes64 = numrecs64*reclen;
    }
    if(use_thread)
        xx = (long long)((long)x);
    else
    {
        xx=chid;
    }
#endif
#ifndef NO_THREADS
#if defined( _HPUX_SOURCE ) || defined ( linux )
    if(ioz_processor_bind)
    {
         bind_cpu=(begin_proc+(int)xx)%num_processors;
#if defined(_HPUX_SOURCE)
         pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
                         (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
#else
     cpu_set_t cpuset;

     CPU_ZERO(&cpuset);
     CPU_SET(bind_cpu, &cpuset);

     pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
#endif
        my_nap(40); /* Switch to new cpu */
    }
#endif
#endif
    if(use_thread)
        nbuff=barray[xx];
    else
        nbuff=buffer;
    if(debug1)
    {
       if(use_thread)
#ifdef NO_PRINT_LLD
        printf("\nStarting child %ld\n",xx);
#else
        printf("\nStarting child %lld\n",xx);
#endif
       else
#ifdef NO_PRINT_LLD
        printf("\nStarting process %d slot %ld\n",getpid(),xx);
#else
        printf("\nStarting process %d slot %lld\n",getpid(),xx);
#endif
        
    }
    dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
    xx2=xx;
    if(share_file)
        xx2=(long long)0;
    if(mfflag)
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#else
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#endif
    }
    else
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
#else
        sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
#endif
    }
    if(oflag)
        flags=O_RDONLY|O_SYNC;
    else
        flags=O_RDONLY;
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        flags |=O_RSYNC|O_SYNC;
#endif

#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        flags |=O_DIRECTIO;
#endif
#endif

#if defined(Windows)
        if(unbuffered)
        {
            hand=CreateFile(dummyfile[xx],
          GENERIC_READ|GENERIC_WRITE,
              FILE_SHARE_WRITE|FILE_SHARE_READ,
          NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
          FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
          NULL);
        SetFilePointer(hand,(LONG)0,0,FILE_BEGIN);
        }
    else
    {
#endif
    if((fd = I_OPEN(dummyfile[xx], ((int)flags),0))<0)
    {
        client_error=errno;
        if(distributed && client_iozone)
            send_stop();
        perror(dummyfile[xx]);
        exit(135);
    }
#if defined(Windows)
    }
#endif
#ifdef ASYNC_IO
    if(async_flag)
        async_init(&gc,fd,direct_flag);
#endif
#ifdef VXFS
    if(direct_flag)
    {
        ioctl(fd,VX_SETCACHE,VX_DIRECT);
        ioctl(fd,VX_GETCACHE,&test_foo);
        if(test_foo == 0)
        {
            if(!client_iozone)
              printf("\nVxFS advanced setcache feature not available.\n");
            exit(3);
        }
    }
#endif
#if defined(solaris)
        if(direct_flag)
        {
                test_foo = directio(fd, DIRECTIO_ON);
                if(test_foo != 0)
                {
                        if(!client_iozone)
                          printf("\ndirectio not available.\n");
                        exit(3);
                }
        }
#endif
    if(mmapflag)
    {
        maddr=(char *)initfile(fd,(filebytes64),0,PROT_READ);
    }
    if(r_traj_flag)
        r_traj_fd=open_r_traj();
    if(fetchon)
        fetchit(nbuff,reclen);
        if(Q_flag)
        {
                sprintf(tmpname,"Child_%d_rrol.dat",(int)xx);
                thread_rrqfd=fopen(tmpname,"a");
                if(thread_rrqfd==0)
                {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
                        printf("Unable to open %s\n",tmpname);
                        exit(40);
                }
        fprintf(thread_rrqfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
        }
    if(L_flag)
    {
        sprintf(tmpname,"Child_%d.log",(int)xx);
        thread_Lwqfd=fopen(tmpname,"a");
        if(thread_Lwqfd==0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            printf("Unable to open %s\n",tmpname);
            exit(40);
        }
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Reread test start: ",now_string);
    }

    child_stat = (struct child_stats *)&shmaddr[xx];
    child_stat->throughput = 0;
    child_stat->actual = 0;
    child_stat->flag = CHILD_STATE_READY;

    if(distributed && client_iozone)
    {
        tell_master_ready(chid);
        wait_for_master_go(chid);
    }
    else
    
        /* Wait for signal from parent */
                while(child_stat->flag!=CHILD_STATE_BEGIN)   
                        Poll((long long)1);
    if(file_lock)
        if(mylockf((int) fd, (int) 1, (int)1) != 0)
            printf("File lock for read failed. %d\n",errno);
    starttime1 = time_so_far();
    if(cpuutilflag)
    {
        walltime = starttime1;
        cputime = cputime_so_far();
    }

    if(r_traj_flag)
        rewind(r_traj_fd);
    for(i=0; i<numrecs64; i++){
        traj_offset=i*reclen;
        if(disrupt_flag && ((i%DISRUPT)==0))
        {
#if defined(Windows)
    
            if(unbuffered)
               disruptw(hand);
            else
               disrupt(fd);
#else
            disrupt(fd);
#endif
        }
        if(r_traj_flag)
        {
            traj_offset=get_traj(r_traj_fd, (long long *)&traj_size,(float *)&delay,(long)0);
            reclen=traj_size;
#if defined(Windows)
            if(unbuffered)
              SetFilePointer(hand,(LONG)traj_offset,0,FILE_BEGIN);
            else
#endif
            I_LSEEK(fd,traj_offset,SEEK_SET);
        }
        if(Q_flag)
        {
#if defined(Windows)
            if(unbuffered)
              traj_offset=SetFilePointer(hand,(LONG)0,0,FILE_CURRENT);
            else
#endif
            traj_offset=I_LSEEK(fd,0,SEEK_CUR);
        }
        if(rlocking)
        {
            lock_offset=I_LSEEK(fd,0,SEEK_CUR);
            mylockr((int) fd, (int) 1, (int)1,
              lock_offset, reclen);
        }
        if(compute_flag)
            compute_val+=do_compute(delay);
        if(*stop_flag)
        {
            if(debug1)
                printf("\n(%ld) Stopped by another 3\n", (long)xx);
            break;
        }
        if(purge)
            purgeit(nbuff,reclen);
                if(Q_flag || hist_summary || op_rate_flag)
                {
                        thread_qtime_start=time_so_far();
                }
        if(mmapflag)
        {
            wmaddr = &maddr[i*reclen];
            fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
        }
        else
        {
              if(async_flag)
              {
                if(no_copy_flag)
                  async_read_no_copy(gc, (long long)fd, &buffer1, (i*reclen),reclen,
                    1LL,(filebytes64),depth);
                else
                  async_read(gc, (long long)fd, nbuff, (i*reclen),reclen,
                    1LL,(filebytes64),depth);
              }
              else
              {
#if defined(Windows)
                  if(unbuffered)
                  {
                ReadFile(hand,nbuff,reclen,(LPDWORD)&wval,0);
                  }
                  else
#endif
                  wval=read((int)fd, (void*)nbuff, (size_t) reclen);
                  if(wval != reclen)
                  {
                if(*stop_flag)
                {
                    if(debug1)
                        printf("\n(%ld) Stopped by another 4\n", (long)xx);
                    break;
                }
#ifdef NO_PRINT_LLD
                    printf("\nError writing block %ld, fd= %d\n", i,
                     fd);
#else
                    printf("\nError writing block %lld, fd= %d\n", i,
                     fd);
#endif
                perror("read");
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                    exit(137);
                  }
               }
        }
        if(verify){
           if(async_flag && no_copy_flag)
           {
            if(verify_buffer(buffer1,reclen,(off64_t)i,reclen,(long long)pattern,sverify)){
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                exit(138);
            }
           }
           else
           {
            if(verify_buffer(nbuff,reclen,(off64_t)i,reclen,(long long)pattern,sverify)){
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                exit(139);
            }
           }
        }
        if(async_flag && no_copy_flag)
            async_release(gc);
        re_read_so_far+=reclen/1024;
        r_traj_bytes_completed+=reclen;
        r_traj_ops_completed++;
        if(*stop_flag)
        {
            re_read_so_far-=reclen/1024;
            r_traj_bytes_completed-=reclen;
        }
        if(hist_summary)
        {
            thread_qtime_stop=time_so_far();
            hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
            hist_insert(hist_time);
        }
        if(op_rate_flag)
        {
            thread_qtime_stop=time_so_far();
            desired_op_rate_time = ((double)1.0/(double)op_rate);
            actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
/*
printf("Desired rate %g  Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
    actual_rate, (desired_op_rate_time-actual_rate));
*/
            if( actual_rate < desired_op_rate_time)
                my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
        }
                if(Q_flag)
                {
                        thread_qtime_stop=time_so_far();
#ifdef NO_PRINT_LLD
                        fprintf(thread_rrqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#else
                        fprintf(thread_rrqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#endif
                }

        if(rlocking)
        {
            mylockr((int) fd, (int) 0, (int)1,
              lock_offset, reclen);
        }
    }
    if(file_lock)
        if(mylockf((int) fd, (int) 0, (int)1))
            printf("Read unlock failed. %d\n",errno);
    /*fsync(fd);*/
#ifdef ASYNC_IO
    if(async_flag)
    {
        end_async(gc);
        gc=0;
    }
#endif
    if(include_flush)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)(filebytes64),MS_SYNC);
        }else
            fsync(fd);
    }
    if(include_close)
    {   
        if(mmapflag)
        {
            mmap_end(maddr,(unsigned long long)filebytes64);
        }
#if defined(Windows)
        if(unbuffered)
            CloseHandle(hand);
        else
#endif
        close(fd);
    }
    temp_time = time_so_far();
    child_stat->throughput = ((temp_time - starttime1)-time_res)
        -compute_val;
    if(child_stat->throughput < (double).000001) 
    {
        child_stat->throughput= time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }

    if(OPS_flag){
       /*re_read_so_far=(re_read_so_far*1024)/reclen;*/
       re_read_so_far=r_traj_ops_completed;
    }
    child_stat->throughput = re_read_so_far/child_stat->throughput;
    child_stat->actual = re_read_so_far;
    if(!xflag)
    {
        *stop_flag=1;
        if(distributed && client_iozone)
            send_stop();
    }
    if(cpuutilflag)
    {
        cputime = cputime_so_far() - cputime;
        if (cputime < cputime_res)
            cputime = 0.0;
        child_stat->cputime = cputime;
        walltime = time_so_far() - walltime;
        child_stat->walltime = walltime;
    }
    if(distributed && client_iozone)
    {
        tell_master_stats(THREAD_REREAD_TEST,chid, child_stat->throughput,
            child_stat->actual, 
            child_stat->cputime, child_stat->walltime,
            (char)*stop_flag,
            (long long)CHILD_STATE_HOLD);
    }
    child_stat->flag = CHILD_STATE_HOLD;    /* Tell parent I'm done */
    if(!include_close)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)(filebytes64),MS_SYNC);
            mmap_end(maddr,(unsigned long long)filebytes64);
        }else
            fsync(fd);
#if defined(Windows)
        if(unbuffered)
            CloseHandle(hand);
        else
#endif
        close(fd);
    }
        if(Q_flag && (thread_rrqfd !=0) )
                fclose(thread_rrqfd);
    free(dummyfile[xx]);
    if(r_traj_flag)
        fclose(r_traj_fd);
    if(debug1)
#ifdef NO_PRINT_LLD
        printf("\nChild finished %ld\n",xx);
#else
        printf("\nChild finished %lld\n",xx);
#endif

    if(L_flag)
    {
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Reread test finished: ",now_string);
        fclose(thread_Lwqfd);
    }
    if(hist_summary)
       dump_hist("Reread",(int)xx);
    if(distributed && client_iozone)
        return(0);
#ifdef NO_THREADS
    exit(0);
#else
    if(use_thread)
        thread_exit();
    else
        exit(0);
#endif
return(0);
}

Here is the call graph for this function:

void*() thread_rwrite_test ( )

Here is the caller graph for this function:

void* thread_rwrite_test ( x  )

Definition at line 13642 of file iozone.c.

{
    /************************/
    /* Children only here   */
    /************************/
    struct child_stats *child_stat;
    long long xx,xx2;
    double compute_val = (double)0;
    double walltime, cputime;
    float delay = (float)0;
    double thread_qtime_stop,thread_qtime_start;
    double hist_time;
    double desired_op_rate_time;
    double actual_rate;
    off64_t traj_offset;
    off64_t lock_offset=0;
    long long w_traj_bytes_completed;
    long long w_traj_ops_completed;
    int fd;
    FILE *w_traj_fd;
    long long flags = 0;
    double starttime1 = 0;
    double temp_time;
    long long recs_per_buffer,traj_size;
    long long i;
    off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far=0;
    char *dummyfile [MAXSTREAMS];           /* name of dummy file     */
    char *nbuff;
    char *maddr,*free_addr;
    char *wmaddr;
    char now_string[30];
    int anwser,bind_cpu,wval;
    FILE *thread_rwqfd,*thread_Lwqfd;
    char tmpname[256];
#if defined(VXFS) || defined(solaris)
    int test_foo = 0;
#endif
#ifdef ASYNC_IO
    struct cache *gc=0;

#else
    long long *gc=0;
#endif

    if(compute_flag)
        delay=compute_time;
    wmaddr=nbuff=maddr=free_addr=0;
    thread_rwqfd=w_traj_fd=thread_Lwqfd=(FILE *)0;
    hist_time=traj_offset=thread_qtime_stop=thread_qtime_start=0;
    walltime=cputime=0;
    anwser=bind_cpu=0;
    w_traj_bytes_completed=w_traj_ops_completed=0;
    written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
    recs_per_buffer = cache_size/reclen ;
    if(w_traj_flag)
    {
        filebytes64 = w_traj_fsize;
        numrecs64=w_traj_ops;
    }
    else
    {
        filebytes64 = numrecs64*reclen;
    }
#ifdef NO_THREADS
    xx=chid;
#else
    if(use_thread)
        xx=(long long)((long)x);
    else
    {
        xx=chid;
    }
#endif
#ifndef NO_THREADS
#if defined( _HPUX_SOURCE ) || defined ( linux )
    if(ioz_processor_bind)
    {
         bind_cpu=(begin_proc+(int)xx)%num_processors;
#if defined( _HPUX_SOURCE )
         pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
                         (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
#else
     cpu_set_t cpuset;
     CPU_ZERO(&cpuset);
     CPU_SET(bind_cpu, &cpuset);

     pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
#endif
        my_nap(40); /* Switch to new cpu */
    }
#endif
#endif
    if(use_thread)
        nbuff=barray[xx];
    else
        nbuff=buffer;
    child_stat = (struct child_stats *)&shmaddr[xx];
    child_stat->throughput = 0;
    child_stat->actual = 0;
    if(debug1)
    {
       if(use_thread)
#ifdef NO_PRINT_LLD
        printf("\nStarting child %ld\n",xx);
#else
        printf("\nStarting child %lld\n",xx);
#endif
       else
#ifdef NO_PRINT_LLD
        printf("\nStarting process %d slot %ld\n",getpid(),xx);
#else
        printf("\nStarting process %d slot %lld\n",getpid(),xx);
#endif
        
    }
    dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
    xx2=xx;
    if(share_file)
        xx2=(long long)0;
    if(mfflag)
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#else
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#endif
    }
    else
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
#else
        sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
#endif
    }
    flags = O_RDWR;
    if(oflag)
        flags|= O_SYNC;
#if defined(O_DSYNC)
    if(odsync)
        flags|= O_DSYNC;
#endif
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        flags |=O_RSYNC|O_SYNC;
#endif

#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        flags |=O_DIRECTIO;
#endif
#endif

#if defined(Windows)
        if(unbuffered)
        {
            hand=CreateFile(dummyfile[xx],
          GENERIC_READ|GENERIC_WRITE,
              FILE_SHARE_WRITE|FILE_SHARE_READ,
          NULL,OPEN_ALWAYS,FILE_FLAG_NO_BUFFERING|
          FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
          NULL);
        }
        else
        {
#endif
    if((fd = I_OPEN(dummyfile[xx], (int)flags,0))<0)
    {
        client_error=errno;
        if(distributed && client_iozone)
            send_stop();
#ifdef NO_PRINT_LLD
        printf("\nChild %ld\n",xx);
#else
        printf("\nChild %lld\n",xx);
#endif
        child_stat->flag = CHILD_STATE_HOLD;
        perror(dummyfile[xx]);
        exit(128);
    }
#if defined(Windows)
    }
#endif
#ifdef VXFS
    if(direct_flag)
    {
        ioctl(fd,VX_SETCACHE,VX_DIRECT);
        ioctl(fd,VX_GETCACHE,&test_foo);
        if(test_foo == 0)
        {
            if(!client_iozone)
              printf("\nVxFS advanced setcache feature not available.\n");
            exit(3);
        }
    }
#endif
#if defined(solaris)
        if(direct_flag)
        {
                test_foo = directio(fd, DIRECTIO_ON);
                if(test_foo != 0)
                {
                        if(!client_iozone)
                          printf("\ndirectio not available.\n");
                        exit(3);
                }
        }
#endif
#ifdef ASYNC_IO
    if(async_flag)
        async_init(&gc,fd,direct_flag);
#endif
    if(mmapflag)
    {
        maddr=(char *)initfile(fd,(numrecs64*reclen),1,PROT_READ|PROT_WRITE);
    }
    if(fetchon)
        fetchit(nbuff,reclen);
    if(w_traj_flag)
        w_traj_fd=open_w_traj();
    if(Q_flag)
    {
        sprintf(tmpname,"Child_%d_rwol.dat",(int)xx);
        thread_rwqfd=fopen(tmpname,"a");
        if(thread_rwqfd==0)
        {
            printf("Unable to open %s\n",tmpname);
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            exit(40);
        }
        fprintf(thread_rwqfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
    }
    if(L_flag)
    {
        sprintf(tmpname,"Child_%d.log",(int)xx);
        thread_Lwqfd=fopen(tmpname,"a");
        if(thread_Lwqfd==0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            printf("Unable to open %s\n",tmpname);
            exit(40);
        }
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Rewrite test start: ",now_string);
    }
    child_stat->flag = CHILD_STATE_READY;
    if(distributed && client_iozone)
        tell_master_ready(chid);
    if(distributed && client_iozone)
    {
        if(cdebug)
        {
            fprintf(newstdout,"Child %d waiting for go from master\n",(int)xx);
            fflush(newstdout);
        }
        wait_for_master_go(chid);
        if(cdebug)
        {
            fprintf(newstdout,"Child %d received go from master\n",(int)xx);
            fflush(newstdout);
        }
    }
    else
    {
        while(child_stat->flag!=CHILD_STATE_BEGIN)   /* Wait for signal from parent */
            Poll((long long)1);
    }
    starttime1 = time_so_far();
    if(cpuutilflag)
    {
        walltime = starttime1;
        cputime = cputime_so_far();
    }
    if(file_lock)
        if(mylockf((int) fd, (int) 1, (int)0) != 0)
            printf("File lock for write failed. %d\n",errno);
    if(cpuutilflag)
    {
        walltime = starttime1;
        cputime = cputime_so_far();
    }
    if(w_traj_flag)
        rewind(w_traj_fd);
    if((verify && !no_copy_flag) || dedup || dedup_interior)
        fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
    for(i=0; i<numrecs64; i++){
        traj_offset= i*reclen ;
        if(w_traj_flag)
        {
            traj_offset=get_traj(w_traj_fd, (long long *)&traj_size,(float *)&delay,(long)1);
            reclen=traj_size;
#if defined(Windows)
            if(unbuffered)
              SetFilePointer(hand,(LONG)traj_offset,0,FILE_BEGIN);
            else
#endif
            I_LSEEK(fd,traj_offset,SEEK_SET);
        }
        if(Q_flag)
        {
#if defined(Windows)
            if(unbuffered)
              traj_offset=SetFilePointer(hand,(LONG)0,0,FILE_CURRENT);
            else
#endif
            traj_offset=I_LSEEK(fd,0,SEEK_CUR);
        }
        if(rlocking)
        {
            lock_offset=I_LSEEK(fd,0,SEEK_CUR);
            mylockr((int) fd, (int) 1, (int)0,
              lock_offset, reclen);
        }
        if(compute_flag)
            compute_val+=do_compute(delay);
        if(*stop_flag && !mmapflag)
        {
            if(debug1)
                printf("\nStop_flag 1\n");
            break;
        }
        if((verify && !no_copy_flag) || dedup || dedup_interior)
        {
            fill_buffer(nbuff,reclen,(long long)pattern,sverify,i);
        }
        if(purge)
            purgeit(nbuff,reclen);
        if(Q_flag || hist_summary || op_rate_flag)
        {
            thread_qtime_start=time_so_far();
        }
        if(mmapflag)
        {
            wmaddr = &maddr[i*reclen];
            if(cdebug)
            {
fprintf(newstdout,"Chid: %lld Rewriting offset %lld for length of %lld\n",chid, i*reclen,reclen);
              fflush(newstdout);
            }
            fill_area((long long*)nbuff,(long long*)wmaddr,(long long)reclen);
            if(!mmapnsflag)
            {
              if(mmapasflag)
                msync(wmaddr,(size_t)reclen,MS_ASYNC);
              if(mmapssflag)
                msync(wmaddr,(size_t)reclen,MS_SYNC);
            }
        }
        else
        {
            if(async_flag)
            {
                 if(no_copy_flag)
                 {
                free_addr=nbuff=(char *)malloc((size_t)reclen+page_size);
                nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
                if(verify || dedup || dedup_interior)
                    fill_buffer(nbuff,reclen,(long long)pattern,sverify,i);
                    async_write_no_copy(gc, (long long)fd, nbuff, reclen, (i*reclen), depth,free_addr);
                 }
                 else
                async_write(gc, (long long)fd, nbuff, reclen, (i*reclen), depth);
            }
            else
            {
#if defined(Windows)
               if(unbuffered)
               {
                WriteFile(hand,nbuff,reclen,(LPDWORD)&wval,0);
               }
               else
#endif
               wval=write(fd, nbuff, (size_t) reclen);
               if(wval != reclen)
               {
                if(*stop_flag)
                {
                    if(debug1)
                        printf("\nStop_flag 2\n");
                    break;
                }
#ifdef NO_PRINT_LLD
                    printf("\nError writing block %ld, fd= %d\n", i,
                     fd);
#else
                    printf("\nError writing block %lld, fd= %d\n", i,
                     fd);
#endif
                if(wval==-1)
                    perror("write");
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                signal_handler();
               }
            }
        }
        re_written_so_far+=reclen/1024;
        w_traj_ops_completed++;
        w_traj_bytes_completed+=reclen;
        if(*stop_flag)
        {
            re_written_so_far-=reclen/1024;
            w_traj_bytes_completed-=reclen;
        }
        if(hist_summary)
        {
            thread_qtime_stop=time_so_far();
            hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
            hist_insert(hist_time);
        }
        if(op_rate_flag)
        {
            thread_qtime_stop=time_so_far();
            desired_op_rate_time = ((double)1.0/(double)op_rate);
            actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
/*
printf("Desired rate %g  Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
    actual_rate, (desired_op_rate_time-actual_rate));
*/
            if( actual_rate < desired_op_rate_time)
                my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
        }
        if(Q_flag)
        {
            thread_qtime_stop=time_so_far();
#ifdef NO_PRINT_LLD
            fprintf(thread_rwqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#else
            fprintf(thread_rwqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#endif
        }
        if(rlocking)
        {
            mylockr((int) fd, (int) 0, (int)0,
              lock_offset, reclen);
        }
    }
    if(file_lock)
        if(mylockf((int) fd, (int) 0, (int)0))
            printf("Write unlock failed. %d\n",errno);
#ifdef ASYNC_IO
    if(async_flag)
    {
        end_async(gc);
        gc=0;
    }
#endif
    if(include_flush)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)(filebytes64),MS_SYNC);
        }else
            fsync(fd);
    }
    if(include_close)
    {
        if(mmapflag)
        {
            mmap_end(maddr,(unsigned long long)filebytes64);
        }
#if defined(Windows)
        if(unbuffered)
            CloseHandle(hand);
        else
#endif
        close(fd);
    }
    temp_time=time_so_far();
    child_stat=(struct child_stats *)&shmaddr[xx];
    child_stat->throughput = ((temp_time - starttime1)-time_res)
        -compute_val;
    if(child_stat->throughput < (double).000001) 
    {
        child_stat->throughput= time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }

    if(OPS_flag){
       /*re_written_so_far=(re_written_so_far*1024)/reclen;*/
       re_written_so_far=w_traj_ops_completed;
    }
    child_stat->throughput = 
        (double)re_written_so_far/child_stat->throughput;
    child_stat->actual = (double)re_written_so_far;
    if(!xflag)
    {
        *stop_flag=1;
        if(distributed && client_iozone)
            send_stop();
    }
    if(cdebug)
    {
        fprintf(newstdout,"Child %d: throughput %f actual %f \n",(int)chid, child_stat->throughput,
            child_stat->actual);
        fflush(newstdout);
    }
    if(cpuutilflag)
    {
        cputime = cputime_so_far() - cputime;
        if (cputime < cputime_res)
            cputime = 0.0;
        child_stat->cputime = cputime;
        walltime = time_so_far() - walltime;
        child_stat->walltime = walltime;
    }
    if(distributed && client_iozone)
        tell_master_stats(THREAD_REWRITE_TEST, chid, child_stat->throughput, 
            child_stat->actual,
            child_stat->cputime, child_stat->walltime,
            (char)*stop_flag,
            (long long)CHILD_STATE_HOLD);
    child_stat->flag = CHILD_STATE_HOLD;    /* Tell parent I'm done */
    if(!include_close)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)(filebytes64),MS_SYNC);
            mmap_end(maddr,(unsigned long long)filebytes64);
        }
        else
            fsync(fd);
#if defined(Windows)
        if(unbuffered)
            CloseHandle(hand);
        else
#endif
        close(fd);
    }
    free(dummyfile[xx]);

    if(Q_flag && (thread_rwqfd !=0) )
        fclose(thread_rwqfd);

    if(w_traj_flag)
        fclose(w_traj_fd);
    if(debug1)
#ifdef NO_PRINT_LLD
        printf("\nChild Stopping  %ld\n",xx);
#else
        printf("\nChild Stopping  %lld\n",xx);
#endif

    if(L_flag)
    {
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Rewrite test finished: ",now_string);
        fclose(thread_Lwqfd);
    }
    if(hist_summary)
       dump_hist("Rewrite",(int)xx);
    if(distributed && client_iozone)
        return(0);
#ifdef NO_THREADS
    exit(0);
#else
    if(use_thread)
        thread_exit();
    else
        exit(0);
#endif
return(0);
}

Here is the call graph for this function:

void*() thread_set_base ( )

Here is the caller graph for this function:

Definition at line 16448 of file iozone.c.

{
    long long xx,xx2;
    char *nbuff=0;
    struct child_stats *child_stat;
    double walltime, cputime;
    int fd;
    long long flags = 0;
    double thread_qtime_stop,thread_qtime_start;
    double hist_time;
    double desired_op_rate_time;
    double actual_rate;
    double starttime2 = 0;
    float delay = 0;
    double compute_val = (double)0;
    double temp_time;
    long long recs_per_buffer;
    off64_t i;
    off64_t lock_offset=0;
    off64_t savepos64=0;
    off64_t written_so_far, stride_read,re_read_so_far,read_so_far;
    off64_t stripewrap = 0;
    off64_t current_position = 0;
    char *dummyfile[MAXSTREAMS];           /* name of dummy file     */
    char *maddr=0;
    char *wmaddr=0;
    volatile char *buffer1;
    int anwser,bind_cpu;
    off64_t traj_offset;
    char tmpname[256];
    char now_string[30];
    FILE *thread_strqfd=0;
    FILE *thread_Lwqfd=0;
#if defined(VXFS) || defined(solaris)
    int test_foo = 0;
#endif
#ifdef ASYNC_IO
    struct cache *gc=0;
#else
    long long *gc=0;
#endif
    /*****************/
    /* Children only */
    /*****************/
    if(compute_flag)
        delay=compute_time;
    hist_time=thread_qtime_stop=thread_qtime_start=0;
    traj_offset=walltime=cputime=0;
    anwser=bind_cpu=0;
    written_so_far=read_so_far=stride_read=re_read_so_far=0;
    recs_per_buffer = cache_size/reclen ;
#ifdef NO_THREADS
    xx=chid;
#else
    if(use_thread)
        xx = (long long)((long)x);
    else
    {
        xx=chid;
    }
#endif
#ifndef NO_THREADS
#if defined( _HPUX_SOURCE ) || defined ( linux )
    if(ioz_processor_bind)
    {
         bind_cpu=(begin_proc+(int)xx)%num_processors;
#if defined(_HPUX_SOURCE)
         pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
                         (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
#else
     cpu_set_t cpuset;

     CPU_ZERO(&cpuset);
     CPU_SET(bind_cpu, &cpuset);

     pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
#endif
        my_nap(40); /* Switch to new cpu */
    }
#endif
#endif
    if(use_thread)
        nbuff=barray[xx];
    else
        nbuff=buffer;
    if(debug1)
    {
       if(use_thread)
#ifdef NO_PRINT_LLD
        printf("\nStarting child %ld\n",xx);
#else
        printf("\nStarting child %lld\n",xx);
#endif
       else
#ifdef NO_PRINT_LLD
        printf("\nStarting process %d slot %ld\n",getpid(),xx);
#else
        printf("\nStarting process %d slot %lld\n",getpid(),xx);
#endif
        
    }
    dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
    xx2=xx;
    if(share_file)
        xx2=(long long)0;
    if(mfflag)
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#else
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#endif
    }
    else
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
#else
        sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
#endif
    }
    if(oflag)
        flags=O_RDONLY|O_SYNC;
    else
        flags=O_RDONLY;
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        flags |=O_RSYNC|O_SYNC;
#endif
#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        flags |=O_DIRECTIO;
#endif
#endif

#if defined(Windows)
        if(unbuffered)
        {
            hand=CreateFile(dummyfile[xx],
          GENERIC_READ|GENERIC_WRITE,
              FILE_SHARE_WRITE|FILE_SHARE_READ,
          NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
          FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
          NULL);
        }
#endif
    if((fd = I_OPEN(dummyfile[xx], ((int)flags),0))<0)
    {
        client_error=errno;
        if(distributed && client_iozone)
            send_stop();
        perror(dummyfile[xx]);
        exit(147);
    }
#ifdef ASYNC_IO
    if(async_flag)
        async_init(&gc,fd,direct_flag);
#endif
#ifdef VXFS
    if(direct_flag)
    {
        ioctl(fd,VX_SETCACHE,VX_DIRECT);
        ioctl(fd,VX_GETCACHE,&test_foo);
        if(test_foo == 0)
        {
            if(!client_iozone)
              printf("\nVxFS advanced setcache feature not available.\n");
            exit(3);
        }
    }
#endif
#if defined(solaris)
        if(direct_flag)
        {
                test_foo = directio(fd, DIRECTIO_ON);
                if(test_foo != 0)
                {
                        if(!client_iozone)
                          printf("\ndirectio not available.\n");
                        exit(3);
                }
        }
#endif

    if(mmapflag)
    {
        maddr=(char *)initfile(fd,(numrecs64*reclen),0,PROT_READ);
    }
    if(fetchon)
        fetchit(nbuff,reclen);
        if(Q_flag)
        {
                sprintf(tmpname,"Child_%d_strol.dat",(int)xx);
                thread_strqfd=fopen(tmpname,"a");
                if(thread_strqfd==0)
                {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
                        printf("Unable to open %s\n",tmpname);
                        exit(40);
                }
        fprintf(thread_strqfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
        }
    if(L_flag)
    {
        sprintf(tmpname,"Child_%d.log",(int)xx);
        thread_Lwqfd=fopen(tmpname,"a");
        if(thread_Lwqfd==0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            printf("Unable to open %s\n",tmpname);
            exit(40);
        }
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Stride test start: ",
            now_string);
    }
    child_stat = (struct child_stats *)&shmaddr[xx];
    child_stat->throughput = 0;
    child_stat->actual = 0;
    child_stat->flag = CHILD_STATE_READY;
        if(distributed && client_iozone)
        {
                tell_master_ready(chid);
                wait_for_master_go(chid);
        }
        else

        /* wait for parent to say go */
                while(child_stat->flag!=CHILD_STATE_BEGIN)      
                        Poll((long long)1);
    if(file_lock)
        if(mylockf((int) fd, (int) 1,  (int)1)!=0)
            printf("File lock for write failed. %d\n",errno);
    starttime2 = time_so_far();
    if(cpuutilflag)
    {
        walltime = starttime2;
        cputime = cputime_so_far();
    }
    for(i=0; i<numrecs64; i++){
        if(disrupt_flag && ((i%DISRUPT)==0))
        {
            disrupt(fd);
        }
        if(compute_flag)
            compute_val+=do_compute(delay);
        if(Q_flag)
        {
            traj_offset=I_LSEEK(fd,0,SEEK_CUR);
        }
        if(rlocking)
        {
            lock_offset=I_LSEEK(fd,0,SEEK_CUR);
            mylockr((int) fd, (int) 1, (int)1,
              lock_offset, reclen);
        }
        if(*stop_flag)
        {
            if(debug1)
                printf("\n(%ld) Stopped by another 3\n", (long)xx);
            break;
        }
        if(purge)
            purgeit(nbuff,reclen);
                if(Q_flag || hist_summary || op_rate_flag)
                {
                        thread_qtime_start=time_so_far();
                }
        if(verify)
            savepos64=current_position/(off64_t)reclen;
        if(mmapflag)
        {
            wmaddr = &maddr[current_position];
            fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
        }
        else
        {
            if(async_flag)
            {
                if(no_copy_flag)
                  async_read_no_copy(gc, (long long)fd, &buffer1, (current_position),
                    reclen, stride,(numrecs64*reclen),depth);
                else
                  async_read(gc, (long long)fd, nbuff, (current_position),reclen,
                    stride,(numrecs64*reclen),depth);
            }
            else
            {
              if(read((int)fd, (void*)nbuff, (size_t) reclen) != reclen)
              {
                if(*stop_flag)
                {
                    if(debug1)
                        printf("\n(%ld) Stopped by another 4\n", (long)xx);
                    break;
                }
#ifdef NO_PRINT_LLD
                    printf("\nError reading block %ld, fd= %d\n", i, fd);
#else
                    printf("\nError reading block %lld, fd= %d\n", i, fd);
#endif
                perror("read");
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                    exit(149);
              }
            }
        }
        if(rlocking)
        {
            mylockr((int) fd, (int) 0, (int)1,
              lock_offset, reclen);
        }
        current_position+=reclen;
        if(verify){
           if(async_flag && no_copy_flag)
           {
            if(verify_buffer(buffer1,reclen,(off64_t)savepos64,reclen,(long long)pattern,sverify)){
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                exit(150);
            }
           }
           else
           {
            if(verify_buffer(nbuff,reclen,(off64_t)savepos64,reclen,(long long)pattern,sverify)){
                if (!no_unlink)
                {
                   if(check_filename(dummyfile[xx]))
                    unlink(dummyfile[xx]);
                }
                child_stat->flag = CHILD_STATE_HOLD;
                exit(151);
            }
           }
        }
        if(async_flag && no_copy_flag)
            async_release(gc);
        if(current_position + (stride * reclen) >= (numrecs64 * reclen)-reclen) 
        {
            current_position=0;

            stripewrap++;
              
            if(numrecs64 <= stride)
            {
                current_position=0;
            }
            else
            {
                current_position = (off64_t)((stripewrap)%numrecs64)*reclen;
            }
            if (!(h_flag || k_flag || mmapflag))
            {
              if(I_LSEEK(fd,current_position,SEEK_SET)<0)
              {
                client_error=errno;
                if(distributed && client_iozone)
                    send_stop();
                perror("lseek");
                exit(152);
              }
            }
        }
        else            
        {
            current_position+=(stride*reclen)-reclen;
            if (!(h_flag || k_flag || mmapflag))
            {
              if(I_LSEEK(fd,current_position,SEEK_SET)<0)
              {
                client_error=errno;
                if(distributed && client_iozone)
                    send_stop();
                perror("lseek");
                exit(154);
              };
            }
        }
        stride_read +=reclen/1024;
        if(*stop_flag)
        {
            stride_read -=reclen/1024;
        }
        if(hist_summary)
        {
            thread_qtime_stop=time_so_far();
            hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
            hist_insert(hist_time);
        }
        if(op_rate_flag)
        {
            thread_qtime_stop=time_so_far();
            desired_op_rate_time = ((double)1.0/(double)op_rate);
            actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
/*
printf("Desired rate %g  Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
    actual_rate, (desired_op_rate_time-actual_rate));
*/
            if( actual_rate < desired_op_rate_time)
                my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
        }
                if(Q_flag)
                {
                        thread_qtime_stop=time_so_far();
#ifdef NO_PRINT_LLD
                        fprintf(thread_strqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#else
                        fprintf(thread_strqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#endif
                }
    }
    if(file_lock)
        if(mylockf((int) fd,(int)0,(int)1))
            printf("Read unlock failed %d\n",errno);
#ifdef ASYNC_IO
    if(async_flag)
    {
        end_async(gc);
        gc=0;
    }
#endif
    if(include_flush)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)(numrecs64*reclen),MS_SYNC);
        }else
            fsync(fd);
    }
    if(include_close)
    {   
        if(mmapflag)
        {
            mmap_end(maddr,(unsigned long long)numrecs64*reclen);
        }
        close(fd);
    }
    temp_time = time_so_far();
    child_stat->throughput = ((temp_time - starttime2)-time_res)
        -compute_val;
    if(child_stat->throughput < (double).000001) 
    {
        child_stat->throughput= time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
    if(OPS_flag){
       stride_read=(stride_read*1024)/reclen;
    }
    child_stat->throughput = stride_read/child_stat->throughput;
    child_stat->actual = stride_read;
    if(!xflag)
    {
        *stop_flag=1;
        if(distributed && client_iozone)
            send_stop();
    }
    if(cpuutilflag)
    {
        cputime = cputime_so_far() - cputime;
        if (cputime < cputime_res)
            cputime = 0.0;
        child_stat->cputime = cputime;
        walltime = time_so_far() - walltime;
        child_stat->walltime = walltime;
    }
        if(distributed && client_iozone)
        {
                tell_master_stats(THREAD_STRIDE_TEST,chid, child_stat->throughput,
                        child_stat->actual,
            child_stat->cputime, child_stat->walltime,
            (char)*stop_flag,
                        (long long)CHILD_STATE_HOLD);
        }
    child_stat->flag = CHILD_STATE_HOLD;    /* Tell parent I'm done */
    if(!include_close)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)(numrecs64*reclen),MS_SYNC);
            mmap_end(maddr,(unsigned long long)numrecs64*reclen);
        }else
            fsync(fd);
        close(fd);
    }
        if(Q_flag && (thread_strqfd !=0) )
                fclose(thread_strqfd);
    free(dummyfile[xx]);
    if(debug1)
#ifdef NO_PRINT_LLD
        printf("\nChild finished %ld\n",xx);
#else
        printf("\nChild finished %lld\n",xx);
#endif

    if(L_flag)
    {
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Stride test finished: ",
            now_string);
        fclose(thread_Lwqfd);
    }
    if(hist_summary)
       dump_hist("Stride Read",(int)xx);
    if(distributed && client_iozone)
        return(0);
#ifdef NO_THREADS
    exit(0);
#else
    if(use_thread)
        thread_exit();
    else
        exit(0);
#endif
return(0);
}

Here is the call graph for this function:

void*() thread_write_test ( )

Here is the caller graph for this function:

void* thread_write_test ( x  )

Definition at line 12313 of file iozone.c.

{

    struct child_stats *child_stat;
    double starttime1 = 0;
    double temp_time;
    double walltime, cputime;
    double compute_val = (double)0;
    float delay = (float)0;
    double thread_qtime_stop,thread_qtime_start;
    double hist_time;
    double desired_op_rate_time;
    double actual_rate;
    off64_t traj_offset;
    off64_t lock_offset=0;
    off64_t save_offset=0;
    long long flags,traj_size;
    long long w_traj_bytes_completed;
    long long w_traj_ops_completed;
    FILE *w_traj_fd;
    int fd;
    long long recs_per_buffer;
    long long stopped,i;
    off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far;
    long long xx,xx2;
    char *dummyfile [MAXSTREAMS];           /* name of dummy file     */
    char *nbuff;
    char *maddr;
    char *wmaddr,*free_addr;
    char now_string[30];
    int anwser,bind_cpu,wval;
#if defined(VXFS) || defined(solaris)
    int test_foo = 0;
#endif
    off64_t filebytes64;
    char tmpname[256];
    FILE *thread_wqfd;
    FILE *thread_Lwqfd;

#ifdef ASYNC_IO
    struct cache *gc=0;

#else
    long long *gc=0;
#endif

    if(compute_flag)
        delay=compute_time;
    nbuff=maddr=wmaddr=free_addr=0;
    hist_time=thread_qtime_stop=thread_qtime_start=0;
    thread_wqfd=w_traj_fd=thread_Lwqfd=(FILE *)0;
    traj_offset=walltime=cputime=0;
    anwser=bind_cpu=0;
    if(w_traj_flag)
    {
        filebytes64 = w_traj_fsize;
        numrecs64=w_traj_ops;
    }
    else
    {
        filebytes64 = numrecs64*reclen;
    }
    written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
    w_traj_bytes_completed=w_traj_ops_completed=0;
    recs_per_buffer = cache_size/reclen ;
#ifdef NO_THREADS
    xx=chid;
#else
    if(use_thread)
    {
        xx = (long long)((long)x);
    }
    else
    {
        xx=chid;
    }
#endif
#ifndef NO_THREADS
#if defined(_HPUX_SOURCE) || defined(linux)
    if(ioz_processor_bind)
    {
         bind_cpu=(begin_proc+(int)xx)%num_processors;
#if defined(_HPUX_SOURCE)
         pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
                         (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
#else
     cpu_set_t cpuset;

     CPU_ZERO(&cpuset);
     CPU_SET(bind_cpu, &cpuset);

     pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
#endif
        my_nap(40); /* Switch to new cpu */
    }
#endif
#endif
    if(use_thread)
        nbuff=barray[xx];
    else
        nbuff=buffer;
    if(debug1 )
    {
       if(use_thread)
#ifdef NO_PRINT_LLD
        printf("\nStarting child %ld\n",xx);
#else
        printf("\nStarting child %lld\n",xx);
#endif
       else
#ifdef NO_PRINT_LLD
        printf("\nStarting process %d slot %ld\n",getpid(),xx);
#else
        printf("\nStarting process %d slot %lld\n",getpid(),xx);
#endif
        
    }
    dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
    xx2=xx;
    if(share_file)
        xx2=(long long)0;
    if(mfflag)
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#else
        sprintf(dummyfile[xx],"%s",filearray[xx2]);
#endif
    }
    else
    {
#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
#else
        sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
#endif
    }
    /*****************/
    /* Children only */
    /*******************************************************************/
    /* Initial write throughput performance test. **********************/
    /*******************************************************************/
#if defined(Windows)
    if(unbuffered)
    {
        hand=CreateFile(dummyfile[xx],
            GENERIC_READ|GENERIC_WRITE,
            FILE_SHARE_WRITE|FILE_SHARE_READ,
            NULL,OPEN_ALWAYS,FILE_FLAG_NO_BUFFERING|
            FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
            NULL);
        CloseHandle(hand);
    }
#endif
    if(oflag)
        flags=O_RDWR|O_SYNC|O_CREAT;
    else
        flags=O_RDWR|O_CREAT;
#if defined(O_DSYNC)
    if(odsync)
        flags |= O_DSYNC;
#endif
#if defined(_HPUX_SOURCE) || defined(linux)
    if(read_sync)
        flags |=O_RSYNC|O_SYNC;
#endif

#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        flags |=O_DIRECTIO;
#endif
#endif
#if defined(Windows)
        if(unbuffered)
        {
            hand=CreateFile(dummyfile[xx],
          GENERIC_READ|GENERIC_WRITE,
              FILE_SHARE_WRITE|FILE_SHARE_READ,
          NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
          FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
          NULL);
        }
        else
        {
#endif
    if((fd = I_OPEN(dummyfile[xx], (int)flags,0640))<0)
    {
        client_error=errno;
        if(distributed && client_iozone)
            send_stop();
        printf("\nCan not open temp file: %s\n", 
            filename);
        perror("open");
        exit(125);
    }
#if defined(Windows)
    }
#endif
#ifdef VXFS
    if(direct_flag)
    {
        ioctl(fd,VX_SETCACHE,VX_DIRECT);
        ioctl(fd,VX_GETCACHE,&test_foo);
        if(test_foo == 0)
        {
            if(!client_iozone)
              printf("\nVxFS advanced setcache feature not available.\n");
            exit(3);
        }
    }
#endif
#if defined(solaris)
               if(direct_flag)
               {
                       test_foo = directio(fd, DIRECTIO_ON);
                       if(test_foo != 0)
                       {
                               if(!client_iozone)
                                 printf("\ndirectio not available.\n");
                               exit(3);
                       }
               }
#endif
#ifdef ASYNC_IO
    if(async_flag)
        async_init(&gc,fd,direct_flag);
#endif
    if(mmapflag)
    {
        maddr=(char *)initfile(fd,(filebytes64),1,PROT_READ|PROT_WRITE);
    }
    if(reclen < cache_size )
    {
        recs_per_buffer = cache_size/reclen ;
        nbuff=&nbuff[(xx%recs_per_buffer)*reclen];
    }
    if(fetchon)         /* Prefetch into processor cache */
        fetchit(nbuff,reclen);
    if((verify && !no_copy_flag) || dedup || dedup_interior)
        fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);

    if(w_traj_flag)
        w_traj_fd=open_w_traj();

    child_stat = (struct child_stats *)&shmaddr[xx];    
    child_stat->throughput = 0;
    child_stat->actual = 0;
    child_stat->flag=CHILD_STATE_READY; /* Tell parent child is ready to go */
    if(distributed && client_iozone)
        tell_master_ready(chid);
    if(distributed && client_iozone)
    {
        if(cdebug)
        {
            fprintf(newstdout,"Child %d waiting for go from master\n",(int)xx);
            fflush(newstdout);
        }
        wait_for_master_go(chid);
        if(cdebug)
        {
            fprintf(newstdout,"Child %d received go from master\n",(int)xx);
            fflush(newstdout);
        }
    }
    else
    {
        while(child_stat->flag!=CHILD_STATE_BEGIN)   /* Wait for signal from parent */
            Poll((long long)1);
    }

    written_so_far=0;
    child_stat = (struct child_stats *)&shmaddr[xx];
    child_stat->actual = 0;
    child_stat->throughput = 0;
    stopped=0;
    if(file_lock)
        if(mylockf((int) fd, (int) 1, (int)0) != 0)
            printf("File lock for write failed. %d\n",errno);
    if(Q_flag)
    {
        sprintf(tmpname,"Child_%d_wol.dat",(int)xx);
        thread_wqfd=fopen(tmpname,"a");
        if(thread_wqfd==0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            printf("Unable to open %s\n",tmpname);
            exit(40);
        }
        fprintf(thread_wqfd,"Offset in Kbytes   Latency in microseconds Transfer size in bytes\n");
    }
    if(L_flag)
    {
        sprintf(tmpname,"Child_%d.log",(int)xx);
        thread_Lwqfd=fopen(tmpname,"a");
        if(thread_Lwqfd==0)
        {
            client_error=errno;
            if(distributed && client_iozone)
                send_stop();
            printf("Unable to open %s\n",tmpname);
            exit(40);
        }
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Write test start: ",now_string);
    }
    starttime1 = time_so_far();
    if(cpuutilflag)
    {
        walltime = starttime1;
        cputime = cputime_so_far();
    }
    if(w_traj_flag)
        rewind(w_traj_fd);
    for(i=0; i<numrecs64; i++){
        if(w_traj_flag)
        {
            traj_offset=get_traj(w_traj_fd, (long long *)&traj_size,(float *)&delay, (long)1);
            reclen=traj_size;
#if defined(Windows)
            if(unbuffered)
              SetFilePointer(hand,(LONG)traj_offset,0,FILE_BEGIN);
            else
#endif
            I_LSEEK(fd,traj_offset,SEEK_SET);
        }
        if(Q_flag)
        {
#if defined(Windows)
            if(unbuffered)
              traj_offset=SetFilePointer(hand,0,0,FILE_CURRENT);
            else
#endif
            traj_offset=I_LSEEK(fd,0,SEEK_CUR);
        }
        if(rlocking)
        {
            lock_offset=I_LSEEK(fd,0,SEEK_CUR);
            mylockr((int) fd, (int) 1, (int)0,
              lock_offset, reclen);
        }
        if((verify && !no_copy_flag) || dedup || dedup_interior)
            fill_buffer(nbuff,reclen,(long long)pattern,sverify,i);
        if(compute_flag)
            compute_val+=do_compute(delay);
        if(*stop_flag && !stopped){
            if(include_flush)
            {
                if(mmapflag)
                    msync(maddr,(size_t)filebytes64,MS_SYNC);
                else
                    fsync(fd);
            }
            /* Close and re-open to get close in measurment */
            if(include_close)
            {
              save_offset=I_LSEEK(fd,0,SEEK_CUR);
              close(fd);
            }
            child_stat->throughput = 
                (time_so_far() - starttime1)-time_res;
            if(include_close)
            {
              if((fd = I_OPEN(dummyfile[xx], (int)flags,0))<0)
              {
                client_error=errno;
                if(distributed && client_iozone)
                    send_stop();
                printf("\nCan not open temp file: %s\n", 
                    filename);
                perror("open");
                exit(125);
              }
              I_LSEEK(fd,save_offset,SEEK_SET);
            }
            if(child_stat->throughput < (double).000001) 
            {
                child_stat->throughput = time_res;
                if(rec_prob < reclen)
                    rec_prob = reclen;
                res_prob=1;
            }

            if(OPS_flag){
               /*written_so_far=(written_so_far*1024)/reclen;*/
               written_so_far=w_traj_ops_completed;
            }
            child_stat->throughput = 
              (double)written_so_far/child_stat->throughput;
            child_stat->actual = (double)written_so_far;
            if(debug1)
            {
                printf("\n(%ld) Stopped by another\n", (long)xx);
            }
            stopped=1;
        }
        if(purge)
            purgeit(nbuff,reclen);
        if(Q_flag || hist_summary || op_rate_flag)
        {
            thread_qtime_start=time_so_far();
        }
again:      
        if(mmapflag)
        {
            wmaddr = &maddr[i*reclen];
            fill_area((long long*)nbuff,(long long*)wmaddr,(long long)reclen);
            /*printf("CHid: %lld  Writing offset %lld for length of %lld\n",chid,i*reclen,reclen);*/
            if(!mmapnsflag)
            {
              if(mmapasflag)
                msync(wmaddr,(size_t)reclen,MS_ASYNC);
              if(mmapssflag)
                msync(wmaddr,(size_t)reclen,MS_SYNC);
            }
        }
        else
        {
           if(async_flag)
           {
                 if(no_copy_flag)
                 {
                free_addr=nbuff=(char *)malloc((size_t)reclen+page_size);
                nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
                if(verify || dedup || dedup_interior)
                    fill_buffer(nbuff,reclen,(long long)pattern,sverify,i);
                    async_write_no_copy(gc, (long long)fd, nbuff, reclen, (i*reclen), depth,free_addr);
                 }
                 else
                async_write(gc, (long long)fd, nbuff, reclen, (i*reclen), depth);
           }
           else
           {
#if defined(Windows)
              if(unbuffered)
              {
            WriteFile(hand,nbuff,reclen, (LPDWORD)&wval,0);
              }
              else
              {
#endif
              wval=write(fd, nbuff, (size_t) reclen);
#if defined(Windows)
              }
#endif
              if(wval != reclen)
              {
            if(*stop_flag && !stopped){
                if(include_flush)
                {
                    if(mmapflag)
                        msync(maddr,(size_t)filebytes64,MS_SYNC);
                    else
                        fsync(fd);
                }
                temp_time = time_so_far();
                child_stat->throughput = 
                    (temp_time - starttime1)-time_res;
                if(child_stat->throughput < (double).000001) 
                {
                    child_stat->throughput= time_res;
                    if(rec_prob < reclen)
                        rec_prob = reclen;
                    res_prob=1;
                }

                if(OPS_flag){
                   /*written_so_far=(written_so_far*1024)/reclen;*/
                   written_so_far=w_traj_ops_completed;
                }
                child_stat->throughput = 
                  (double)written_so_far/child_stat->throughput;
                child_stat->actual = (double)written_so_far;
                if(debug1)
                {
                    printf("\n(%ld) Stopped by another\n", (long)xx);
                }
                stopped=1;
                goto again;
            }
            /* Note: Writer must finish even though told
               to stop. Otherwise the readers will fail.
               The code will capture bytes transfered
               before told to stop but let the writer
               complete.
            */
#ifdef NO_PRINT_LLD
                printf("\nError writing block %ld, fd= %d\n", i,
                 fd);
#else
                printf("\nError writing block %lld, fd= %d\n", i,
                 fd);
#endif
            if(wval==-1)
                perror("write");
            if (!no_unlink)
            {
               if(check_filename(dummyfile[xx]))
                unlink(dummyfile[xx]);
            }
            child_stat->flag = CHILD_STATE_HOLD;
                exit(127);
              }
            }
        }
        if(hist_summary)
        {
            thread_qtime_stop=time_so_far();
            hist_time =(thread_qtime_stop-thread_qtime_start);
            hist_insert(hist_time);
        }
        if(op_rate_flag)
        {
            thread_qtime_stop=time_so_far();
            desired_op_rate_time = ((double)1.0/(double)op_rate);
            actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
/*
printf("Desired rate %g  Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
    actual_rate, (desired_op_rate_time-actual_rate));
*/
            if( actual_rate < desired_op_rate_time)
                  my_unap((unsigned long long)((desired_op_rate_time-actual_rate)*1000000.0 ));
        }
        if(Q_flag)
        {
            thread_qtime_stop=time_so_far();
#ifdef NO_PRINT_LLD
            fprintf(thread_wqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#else
            fprintf(thread_wqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
#endif
        }
        w_traj_ops_completed++;
        w_traj_bytes_completed+=reclen;
        written_so_far+=reclen/1024;
        if(*stop_flag)
        {
            written_so_far-=reclen/1024;
            w_traj_bytes_completed-=reclen;
        }
        if(rlocking)
        {
            mylockr((int) fd, (int) 0, (int)0,
              lock_offset, reclen);
        }
    }
    

    if(file_lock)
        if(mylockf((int) fd, (int) 0, (int)0))
            printf("Write unlock failed. %d\n",errno);
    
#ifdef ASYNC_IO
    if(async_flag)
    {
        end_async(gc);
        gc=0;
    }
#endif
    if(!xflag)
    {
        *stop_flag=1;
        if(distributed && client_iozone)
            send_stop();
    }
    
    if(include_flush)
    {
        if(mmapflag)
            msync(maddr,(size_t)filebytes64,MS_SYNC);
        else
            fsync(fd);
    }
    if(include_close)
    {
        if(mmapflag)
            mmap_end(maddr,(unsigned long long)filebytes64);
#if defined(Windows)
        if(unbuffered)
            CloseHandle(hand);
        else
#endif
        close(fd);
    }
    if(!stopped){
        temp_time = time_so_far();
        child_stat->throughput = ((temp_time - starttime1)-time_res)
            -compute_val;
        if(child_stat->throughput < (double).000001) 
        {
            child_stat->throughput= time_res;
            if(rec_prob < reclen)
                rec_prob = reclen;
            res_prob=1;
        }

        if(OPS_flag){
           /*written_so_far=(written_so_far*1024)/reclen;*/
           written_so_far=w_traj_ops_completed;
        }
        child_stat->throughput =
            (double)written_so_far/child_stat->throughput;
        child_stat->actual = (double)written_so_far;
    }
    if(cdebug)
    {
        fprintf(newstdout,"Child %d: throughput %f actual %f \n",(int)chid, child_stat->throughput,
            child_stat->actual);
        fflush(newstdout);
    }
    if(cpuutilflag)
    {
        cputime = cputime_so_far() - cputime;
        if (cputime < cputime_res)
            cputime = 0.0;
        child_stat->cputime = cputime;
        walltime = time_so_far() - walltime;
        child_stat->walltime = walltime;
    }
    if(distributed && client_iozone)
        tell_master_stats(THREAD_WRITE_TEST, chid, child_stat->throughput, 
            child_stat->actual, 
            child_stat->cputime, child_stat->walltime,
            (char)*stop_flag,
            (long long)CHILD_STATE_HOLD);
            
    if (debug1) {
        printf(" child/slot: %lld, wall-cpu: %8.3f %8.3fC" " -> %6.2f%%\n",
            xx, walltime, cputime,
            cpu_util(cputime, walltime));
    }
    child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
    stopped=0;
    /*******************************************************************/
    /* End write performance test. *************************************/
    /*******************************************************************/
    if(debug1)
#ifdef NO_PRINT_LLD
        printf("\nChild finished %ld\n",xx);
#else
        printf("\nChild finished %lld\n",xx);
#endif
    if(!include_close)
    {
        if(mmapflag)
        {
            msync(maddr,(size_t)numrecs64*reclen,MS_SYNC); /*Clean up before read starts running*/ 
            mmap_end(maddr,(unsigned long long)numrecs64*reclen);
        }else
            fsync(fd);
            
#if defined(Windows)
        if(unbuffered)
            CloseHandle(hand);
        else
#endif
        close(fd);
    }
    if(Q_flag && (thread_wqfd !=0) )
        fclose(thread_wqfd);
    free(dummyfile[xx]);
    if(w_traj_flag)
        fclose(w_traj_fd);

    if(L_flag)
    {
        get_date(now_string);
        fprintf(thread_Lwqfd,"%-25s %s","Write test finished: ",now_string);
        fclose(thread_Lwqfd);
    }
    if(hist_summary)
       dump_hist("write",(int)xx);
    if(distributed && client_iozone)
        return(0);
#ifdef NO_THREADS
    exit(0);
#else
    if(use_thread)
        thread_exit();
    else
        exit(0);
#endif
return(0);
}

Here is the call graph for this function:

void throughput_test ( )

Definition at line 3530 of file iozone.c.

{
    char *unit;
    double starttime1 = 0;
    double jstarttime = 0;
    double jtime = 0;
    double walltime = 0;
    double cputime = 0;
    char *port;
    char getout;
    long long throughsize = KILOBYTES;
    long long xx,xy,i;
    long long xyz;
    double ptotal;
    off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far;
    VOLATILE char *temp;
    double min_throughput = 0;
    double max_throughput = 0;
    double avg_throughput = 0;
    double min_xfer = 0; 


    toutputindex=0;
    strcpy(&toutput[0][0],throughput_tests[0]);
    ptotal=written_so_far=read_so_far=re_written_so_far=re_read_so_far=0 ;

    if(OPS_flag)
        unit="ops";
    else
        unit="KB";

    if(!haveshm)
    {
        shmaddr=(struct child_stats *)alloc_mem((long long)SHMSIZE,(int)1);
#ifdef _64BIT_ARCH_
        if((long long)shmaddr==(long long)-1)
#else
        if((long )shmaddr==(long)-1)
#endif
        {
            printf("\nShared memory not working\n");
            exit(24);
        }
        haveshm=(char*)shmaddr;
    }
    else
        shmaddr=(struct child_stats *)haveshm;

    if(use_thread)
        stop_flag = &stoptime;
    else
    {
        temp = (char *)&shmaddr[0];
        stop_flag = (char *)&temp[(long long)SHMSIZE]-4;
    }
    for(xyz=0;xyz<num_child;xyz++){ /* all children to state 0 (HOLD) */
        child_stat = (struct child_stats *)&shmaddr[xyz];
        child_stat->flag=CHILD_STATE_HOLD;
        child_stat->actual=0;
        child_stat->throughput=0;
        child_stat->cputime=0;
        child_stat->walltime=0;
    }
    *stop_flag = 0;
    if(!sflag)
        kilobytes64=throughsize;
    if(!rflag)
            reclen=(long long)4096;
    if(aggflag)
        kilobytes64=orig_size/num_child;
        numrecs64 = (long long)(kilobytes64*1024)/reclen;
    buffer=mainbuffer;
    if(use_thread)
        port="thread";
    else
        port="process";
    if(w_traj_flag)
    {
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tEach %s writes a %ld Kbyte file in telemetry controlled records\n",
        port,kilobytes64);
#else
    if(!silent) printf("\tEach %s writes a %lld Kbyte file in telemetry controlled records\n",
        port,kilobytes64);
#endif
    }
    else
    {
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tEach %s writes a %ld Kbyte file in %ld Kbyte records\n",
        port,kilobytes64,reclen/1024);
#else
    if(!silent) printf("\tEach %s writes a %lld Kbyte file in %lld Kbyte records\n",
        port,kilobytes64,reclen/1024);
#endif
    }

    if(fflag)       /* Each child has a file name to write */
      for(xx=0;xx<num_child;xx++)
        filearray[xx] = filename;
    myid = (long long)getpid();

    /* rags: skip writer test */
    if(include_tflag)
        if(!(include_mask & (long long)WRITER_MASK))
        {
            store_dvalue( (double)0);
            store_dvalue( (double)0);
            toutputindex++;
            goto next0;
        }

    if((!distributed) || (distributed && master_iozone))
        start_monitor("Write");
    /* Hooks to start the distributed Iozone client/server code */
    if(distributed)
    {
        use_thread=0;  /* Turn of any Posix threads */
        if(master_iozone)
            master_listen_socket = start_master_listen();
        else
            become_client();
    }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        chid=xx;
        childids[xx] = start_child_proc(THREAD_WRITE_TEST,numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                if(!use_thread)
                    kill((pid_t)childids[xy],SIGTERM);
            }
            exit(25);
        }
        if(childids[xx]!=0 && debug1)
#ifdef NO_PRINT_LLD
            printf("Parent starting slot %ld\n",xx);    
#else
            printf("Parent starting slot %lld\n",xx);   
#endif
        if( childids[xx] == 0 ){
#ifdef _64BIT_ARCH_
          thread_write_test((void *)xx);
#else
          thread_write_test((void *)(long)xx);
#endif
        }else {
#ifdef NO_PRINT_LLD
          sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx], xx);
#else
          sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx], xx);
#endif
        }
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */

#ifdef NO_PRINT_LLD
        sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx], xx);
#else
        sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx], xx);
#endif
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }

#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create(thread_write_test,(void*)xx);
#else
        childids[xx] = mythread_create(thread_write_test,(void*)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("Thread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                kill((pid_t)myid,SIGTERM);
            }
            exit(27);
        }
       }
    }
#endif
    if((long long)getpid() == myid)
    {
        prepage(buffer,reclen);     /* Force copy on write */
                /* wait for children to start */
        if(distributed && master_iozone)
        {
            start_master_listen_loop((int) num_child);
        }
        for(i=0;i<num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i]; 
            while(child_stat->flag==CHILD_STATE_HOLD)
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++)   /* Start all children going */
        {
            if(delay_start!=0)
                Poll((long long)delay_start);
                        /* State "go" */
            child_stat = (struct child_stats *)&shmaddr[i]; 
            child_stat->flag=CHILD_STATE_BEGIN;
            if(distributed && master_iozone)
                tell_children_begin(i);
        }
        starttime1 = time_so_far(); /* Start parents timer */
        goto waitout;
    }

waitout:
    getout=0;
    if((long long)getpid() == myid) {   /* Parent only */
        starttime1 = time_so_far(); /* Wait for all children */
        for( i = 0; i < num_child; i++){
            child_stat = (struct child_stats *) &shmaddr[i];
            if(distributed && master_iozone)
            {
                printf("\n\tTest running:");
                wait_dist_join();
                break;
            }
            else
            {
             if(use_thread)
             {
                thread_join(childids[i],(void *)&pstatus);
             }
             else
             {
                wait(0);
             }
            }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res;
        if(jtime < (double).000001) 
        {
            jtime=time_res; 
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* get parents total time */
    if(total_time < (double).000001) 
    {
        total_time=time_res; 
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif

    total_kilos=0;
    ptotal=0;
    walltime = 0.0;
    cputime = 0.0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat = (struct child_stats *) &shmaddr[xyz];
        total_kilos += child_stat->throughput; /* add up the children */
        ptotal += child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        /* Add up the cpu times of all children */
        cputime += child_stat->cputime;

        /* and find the child with the longest wall time */
        /* Get the earliest start time and latest fini time to calc. elapsed time. */
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
        if (cputime < cputime_res)
            cputime = 0.0;
    }
    
    for(xyz=0;xyz<num_child;xyz++){
        child_stat = (struct child_stats *) &shmaddr[xyz];
        child_stat->flag = CHILD_STATE_HOLD; /* Start children at state 0 (HOLD) */
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %2ld initial writers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %2ld initial writers \t= %10.2f %s/sec\n",num_child,((double)(ptotal)/total_time),unit);
#else
    if(!silent) printf("\tChildren see throughput for %2lld initial writers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %2lld initial writers \t= %10.2f %s/sec\n",num_child,((double)(ptotal)/total_time),unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU Utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) 
                    printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Write");
    /**********************************************************/
    /*************** End of intitial writer *******************/
    /**********************************************************/
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
    *stop_flag=0;
    if(distributed && master_iozone)
    {
        stop_master_listen(master_listen_socket);
        cleanup_comm();
    }

    /**********************************************************/
    /* Re-write throughput performance test. ******************/
    /**********************************************************/
    walltime = 0.0;
    cputime = 0.0;
    jstarttime=0;
    total_kilos=0;
    toutputindex=1;
    strcpy(&toutput[1][0],throughput_tests[1]);
    if(noretest)
    {
        store_dvalue( (double)0);
        goto next0;
    }
    if((!distributed) || (distributed && master_iozone))
        start_monitor("Rewrite");
    /* Hooks to start the distributed Iozone client/server code */
    if(distributed)
    {
        use_thread=0;  /* Turn of any Posix threads */
        if(master_iozone)
            master_listen_socket = start_master_listen();
        else
            become_client();
    }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){
        chid=xx;
        childids[xx] = start_child_proc(THREAD_REWRITE_TEST,numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)childids[xy],(long long)SIGTERM);
            }
            exit(28);
        }
        if(childids[xx] == 0){
#ifdef _64BIT_ARCH_
            thread_rwrite_test((void *)xx);
#else
            thread_rwrite_test((void *)((long)xx));
#endif
        }   
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }
#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create( thread_rwrite_test,xx);
#else
        childids[xx] = mythread_create( thread_rwrite_test,(void *)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("\nThread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)myid,(long long)SIGTERM);
            }
            exit(29);
        }
       }
    }
#endif
    if((long long)myid == getpid())
    {
        if(distributed && master_iozone)
        {
            start_master_listen_loop((int) num_child);
        }
        for(i=0;i<num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i];
                    /* wait for children to start */
            while(child_stat->flag==CHILD_STATE_HOLD) 
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++)
        {
            child_stat = (struct child_stats *)&shmaddr[i];
            child_stat->flag = CHILD_STATE_BEGIN;   /* tell children to go */
            if(delay_start!=0)
                Poll((long long)delay_start);
            if(distributed && master_iozone)
                tell_children_begin(i);
        }
        starttime1 = time_so_far();
        goto jump3;
    }
    
jump3:
    getout=0;
    if((long long)myid == getpid()){    /* Parent only here */
        for( i = 0; i < num_child; i++){
            child_stat=(struct child_stats *)&shmaddr[i];
            if(distributed && master_iozone)
            {
                printf("\n\tTest running:");
                wait_dist_join();
                break;
            }
            else
            {
               if(use_thread)
               {
                thread_join(childids[i],(void *)&pstatus);
               }
               else
               {
                wait(0);
               }
            }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res;
        if(jtime < (double).000001) 
        {
            jtime=time_res;
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* Parents total time */
    if(total_time  < (double).000001) 
    {
        total_time=time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif
    

    total_kilos=0;
    ptotal=0;

    min_throughput=max_throughput=min_xfer=0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat=(struct child_stats *)&shmaddr[xyz];
        total_kilos+=child_stat->throughput;
        ptotal+=child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        cputime += child_stat->cputime;
        /* Get the earliest start time and latest fini time to calc. elapsed time. */
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
/*
        if (walltime < cputime_res)
            walltime = 0.0;
*/
        if (cputime < cputime_res)
            cputime = 0.0;
    }

    for(xyz=0;xyz<num_child;xyz++){ /* Reset state to 0 (HOLD) */
        child_stat=(struct child_stats *)&shmaddr[xyz];
        child_stat->flag = CHILD_STATE_HOLD;
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %2ld rewriters \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %2ld rewriters \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#else
    if(!silent) printf("\tChildren see throughput for %2lld rewriters \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %2lld rewriters \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    *stop_flag=0;
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Rewrite");
    /**********************************************************/
    /*************** End of rewrite throughput ****************/
    /**********************************************************/
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
    if(distributed && master_iozone)
    {
        stop_master_listen(master_listen_socket);
        cleanup_comm();
    }
next0:
    if(include_tflag)
        if(!(include_mask & (long long)READER_MASK))
            goto next1;
    /**************************************************************/
    /*** Reader throughput tests **********************************/
    /**************************************************************/
    if((!distributed) || (distributed && master_iozone))
        start_monitor("Read");
    toutputindex++;
    strcpy(&toutput[toutputindex][0],throughput_tests[2]);
    walltime = 0.0;
    cputime = 0.0;
    jstarttime=0;
    total_kilos=0;
    if(distributed)
    {
        use_thread=0;
        if(master_iozone)
            master_listen_socket=start_master_listen();
        else
            become_client();
    }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){
        chid=xx;
        childids[xx] = start_child_proc(THREAD_READ_TEST,numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)childids[xy],(long long)SIGTERM);
            }
            exit(30);
        }
        if(childids[xx]==0){
#ifdef _64BIT_ARCH_
            thread_read_test((void *)xx);
#else
            thread_read_test((void *)((long)xx));
#endif
        }   
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }
#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create( thread_read_test,xx);
#else
        childids[xx] = mythread_create( thread_read_test,(void *)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("\nThread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                kill((pid_t)myid,(int)SIGTERM);
            }
            exit(31);
        }
       }
    }
#endif
    if(myid == (long long)getpid()){
        if(distributed && master_iozone)
        {
            start_master_listen_loop((int) num_child);
        }
        for(i=0;i<num_child; i++){ /* wait for children to start */
            child_stat=(struct child_stats *)&shmaddr[i];
            while(child_stat->flag==CHILD_STATE_HOLD)
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++)
        {
            child_stat=(struct child_stats *)&shmaddr[i];
            child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
            if(delay_start!=0)
                Poll((long long)delay_start);
            if(distributed && master_iozone)
                tell_children_begin(i);
        }
        starttime1 = time_so_far();
        goto jumpend4;
    }
jumpend4:
    getout=0;
    if(myid == (long long)getpid()){    /* Parent here */
        for( i = 0; i < num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i];
            if(distributed && master_iozone)
            {
                printf("\n\tTest running:");
                wait_dist_join();
                break;
            }
            else
            {
               if(use_thread)
               {
                thread_join(childids[i],(void *)&pstatus);
               }
               else
               {
                wait(0);
               }
            }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res; 
        if(jtime < (double).000001)
        {
            jtime=time_res; 
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
    if(total_time < (double).000001) 
    {
        total_time=time_res; 
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif
    
    total_kilos=0;
    ptotal=0;
    min_throughput=max_throughput=min_xfer=0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat=(struct child_stats *)&shmaddr[xyz];
        total_kilos+=child_stat->throughput;
        ptotal+=child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        cputime += child_stat->cputime;
        /* Get the earliest start time and latest fini time to calc. elapsed time. */
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
        if (cputime < cputime_res)
            cputime = 0.0;
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %2ld readers \t\t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %2ld readers \t\t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#else
    if(!silent) printf("\tChildren see throughput for %2lld readers \t\t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %2lld readers \t\t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Read");
    /**********************************************************/
    /*************** End of readers throughput ****************/
    /**********************************************************/
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
    if(distributed && master_iozone)
    {
        stop_master_listen(master_listen_socket);
        cleanup_comm();
    }

    /**************************************************************/
    /*** ReReader throughput tests **********************************/
    /**************************************************************/
    toutputindex++;
    strcpy(&toutput[toutputindex][0],throughput_tests[3]);
    if(noretest)
    {
        store_dvalue( (double)0);
        goto next1;
    }
    if((!distributed) || (distributed && master_iozone))
        start_monitor("Reread");
    walltime = 0.0;
    cputime = 0.0;
    jstarttime=0;
    *stop_flag=0;
    total_kilos=0;
        /* Hooks to start the distributed Iozone client/server code */
        if(distributed)
        {
                use_thread=0;  /* Turn of any Posix threads */
                if(master_iozone)
                        master_listen_socket = start_master_listen();
                else
                        become_client();
        }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){
        chid=xx;
        childids[xx] = start_child_proc(THREAD_REREAD_TEST, numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)childids[xy],(long long)SIGTERM);
            }
            exit(32);
        }
        if(childids[xx]==0){
#ifdef _64BIT_ARCH_
            thread_rread_test((void *)xx);
#else
            thread_rread_test((void *)((long)xx));
#endif
        }   
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        chid=xx;
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }
#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create( thread_rread_test,xx);
#else
        childids[xx] = mythread_create( thread_rread_test,(void *)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("\nThread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                kill((pid_t)myid,(int)SIGTERM);
            }
            exit(33);
        }
       }
    }
#endif
    if(myid == (long long)getpid()){
                if(distributed && master_iozone)
                {
                        start_master_listen_loop((int) num_child);
                }
        for(i=0;i<num_child; i++){ /* wait for children to start */
            child_stat = (struct child_stats *)&shmaddr[i];
            while(child_stat->flag==CHILD_STATE_HOLD)
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i];
            child_stat->flag = CHILD_STATE_BEGIN;   /* tell children to go */
            if(delay_start!=0)
                Poll((long long)delay_start);
                       if(distributed && master_iozone)
                                tell_children_begin(i);
        }
        starttime1 = time_so_far();
        goto jumpend2;
    }
    
jumpend2:
    getout=0;
    if(myid == (long long)getpid()){     /* Parent here */
        for( i = 0; i < num_child; i++){ /* wait for children to stop */
            child_stat = (struct child_stats *)&shmaddr[i];
                        if(distributed && master_iozone)
                        {
                printf("\n\tTest running:");
                                wait_dist_join();
                                break;
                        }
                        else
                        {
               if(use_thread)
               {
                thread_join(childids[i],(void *)&pstatus);
               }
               else
               {
                wait(0);
               }
            }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res; 
        if(jtime < (double).000001)
        {
            jtime=time_res;
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
    if(total_time < (double).000001) 
    {
        total_time=time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif
    min_throughput=max_throughput=min_xfer=0;
    total_kilos=0;
    ptotal=0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat = (struct child_stats *)&shmaddr[xyz];
        total_kilos+=child_stat->throughput;
        ptotal+=child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        cputime += child_stat->cputime;
        /* Get the earliest start time and latest fini time to calc. elapsed time. */
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
/*
        if (walltime < cputime_res)
            walltime = 0.0;
*/
        if (cputime < cputime_res)
            cputime = 0.0;
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %ld re-readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %ld re-readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#else
    if(!silent) printf("\tChildren see throughput for %lld re-readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %lld re-readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Reread");
    /**********************************************************/
    /*************** End of re-readers throughput ****************/
    /**********************************************************/
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
        if(distributed && master_iozone)
    {
                stop_master_listen(master_listen_socket);
        cleanup_comm();
    }

next1:
    if(include_tflag)
        if(!(include_mask & (long long)REVERSE_MASK))
            goto next2;
    sync();
    sleep(2);

    /**************************************************************/
    /*** Reverse reader throughput tests **************************/
    /**************************************************************/
    toutputindex++;
    strcpy(&toutput[toutputindex][0],throughput_tests[4]);
    if((!distributed) || (distributed && master_iozone))
        start_monitor("Revread");
    walltime = 0.0;
    cputime = 0.0;
    jstarttime=0;
    *stop_flag=0;
    total_kilos=0;
        /* Hooks to start the distributed Iozone client/server code */
        if(distributed)
        {
                use_thread=0;  /* Turn of any Posix threads */
                if(master_iozone)
                        master_listen_socket = start_master_listen();
                else
                        become_client();
        }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){
        chid=xx;
        childids[xx] = start_child_proc(THREAD_REVERSE_READ_TEST,numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)childids[xy],(long long)SIGTERM);
            }
            exit(34);
        }
        if(childids[xx]==0){
#ifdef _64BIT_ARCH_
            thread_reverse_read_test((void *)xx);
#else
            thread_reverse_read_test((void *)((long)xx));
#endif
        }   
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        chid=xx;
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }
#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create( thread_reverse_read_test,xx);
#else
        childids[xx] = mythread_create( thread_reverse_read_test,(void *)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("\nThread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                kill((pid_t)myid,(int)SIGTERM);
            }
            exit(35);
        }
       }
    }
#endif
    if(myid == (long long)getpid()){
                if(distributed && master_iozone)
                {
                        start_master_listen_loop((int) num_child);
                }
        for(i=0;i<num_child; i++){ /* wait for children to start */
            child_stat = (struct child_stats *)&shmaddr[i];
            while(child_stat->flag==CHILD_STATE_HOLD)
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i];
            child_stat->flag = CHILD_STATE_BEGIN;   /* tell children to go */
            if(delay_start!=0)
                Poll((long long)delay_start);
                       if(distributed && master_iozone)
                                tell_children_begin(i);
        }
        starttime1 = time_so_far();
    }
    
    getout=0;
    if(myid == (long long)getpid()){     /* Parent here */
        for( i = 0; i < num_child; i++){ /* wait for children to stop */
            child_stat = (struct child_stats *)&shmaddr[i];
                        if(distributed && master_iozone)
                        {
                printf("\n\tTest running:");
                                wait_dist_join();
                                break;
                        }
                        else
                        {
                           if(use_thread)
                           {
                                thread_join(childids[i],(void *)&pstatus);
                           }
                           else
                           {
                                wait(0);
                           }
                        }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res;
        if(jtime < (double).000001)
        {
            jtime=time_res;
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
    if(total_time < (double).000001) 
    {
        total_time=time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif
    total_kilos=0;
    ptotal=0;
    min_throughput=max_throughput=min_xfer=0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat = (struct child_stats *)&shmaddr[xyz];
        total_kilos+=child_stat->throughput;
        ptotal+=child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        /* walltime += child_stat->walltime; */
        cputime += child_stat->cputime;
        /* Get the earliest start time and latest fini time to calc. elapsed time. */
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
/*
        if (walltime < cputime_res)
            walltime = 0.0;
*/
        if (cputime < cputime_res)
            cputime = 0.0;
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %ld reverse readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %ld reverse readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#else
    if(!silent) printf("\tChildren see throughput for %lld reverse readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %lld reverse readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Revread");
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
        if(distributed && master_iozone)
    {
                stop_master_listen(master_listen_socket);
        cleanup_comm();
    }
next2:
    if(include_tflag)
        if(!(include_mask & (long long)STRIDE_READ_MASK))
            goto next3;
    /**************************************************************/
    /*** stride reader throughput tests **************************/
    /**************************************************************/
    toutputindex++;
    strcpy(&toutput[toutputindex][0],throughput_tests[5]);
    if((!distributed) || (distributed && master_iozone))
        start_monitor("Strideread");
    walltime = 0.0;
    cputime = 0.0;
    jstarttime=0;
    sync();
    sleep(2);
    *stop_flag=0;
    total_kilos=0;
        /* Hooks to start the distributed Iozone client/server code */
        if(distributed)
        {
                use_thread=0;  /* Turn of any Posix threads */
                if(master_iozone)
                        master_listen_socket = start_master_listen();
                else
                        become_client();
        }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){
        chid=xx;
        childids[xx] = start_child_proc(THREAD_STRIDE_TEST,numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)childids[xy],(long long)SIGTERM);
            }
            exit(36);
        }
        if(childids[xx]==0){
#ifdef _64BIT_ARCH_
            thread_stride_read_test((void *)xx);
#else
            thread_stride_read_test((void *)((long)xx));
#endif
        }   
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        chid=xx;
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }
#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create( thread_stride_read_test,xx);
#else
        childids[xx] = mythread_create( thread_stride_read_test,(void *)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("\nThread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                kill((pid_t)myid,(int)SIGTERM);
            }
            exit(37);
        }
       }
    }
#endif
    if(myid == (long long)getpid()){
                if(distributed && master_iozone)
                {
                        start_master_listen_loop((int) num_child);
                }
        for(i=0;i<num_child; i++){ /* wait for children to start */
            child_stat = (struct child_stats *)&shmaddr[i];
            while(child_stat->flag==CHILD_STATE_HOLD)
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i];
            child_stat->flag = CHILD_STATE_BEGIN;   /* tell children to go */
            if(delay_start!=0)
                Poll((long long)delay_start);
                       if(distributed && master_iozone)
                                tell_children_begin(i);
        }
        starttime1 = time_so_far();
    }
    
    getout=0;
    if(myid == (long long)getpid()){     /* Parent here */
        for( i = 0; i < num_child; i++){ /* wait for children to stop */
            child_stat = (struct child_stats *)&shmaddr[i];
                        if(distributed && master_iozone)
                        {
                printf("\n\tTest running:");
                                wait_dist_join();
                                break;
                        }
                        else
                        {
                           if(use_thread)
                           {
                                thread_join(childids[i],(void *)&pstatus);
                           }
                           else
                           {
                                wait(0);
                           }
                        }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res;
        if(jtime < (double).000001) 
        {
            jtime=time_res; 
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
    if(total_time < (double).000001) 
    {
        total_time=time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif
    total_kilos=0;
    ptotal=0;
    min_throughput=max_throughput=min_xfer=0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat = (struct child_stats *)&shmaddr[xyz];
        total_kilos+=child_stat->throughput;
        ptotal+=child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        /* walltime += child_stat->walltime; */
        cputime += child_stat->cputime;
        /* Get the biggest walltime */
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
/*
        if (walltime < cputime_res)
            walltime = 0.0;
*/
        if (cputime < cputime_res)
            cputime = 0.0;
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %ld stride readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %ld stride readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#else
    if(!silent) printf("\tChildren see throughput for %lld stride readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %lld stride readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Strideread");
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
        if(distributed && master_iozone)
    {
                stop_master_listen(master_listen_socket);
        cleanup_comm();
    }
    /**************************************************************/
    /*** random reader throughput tests ***************************/
    /**************************************************************/
next3:
    if(include_tflag)
        if(!(include_mask & (long long)RANDOM_RW_MASK))
            goto next4;
    
    toutputindex++;
    strcpy(&toutput[toutputindex][0],throughput_tests[6]);
    if((!distributed) || (distributed && master_iozone))
        start_monitor("Randread");
    walltime = 0.0;
    cputime = 0.0;
    jstarttime=0;
    sync();
    sleep(2);
    *stop_flag=0;
    total_kilos=0;
        /* Hooks to start the distributed Iozone client/server code */
        if(distributed)
        {
                use_thread=0;  /* Turn of any Posix threads */
                if(master_iozone)
                        master_listen_socket = start_master_listen();
                else
                        become_client();
        }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){
        chid=xx;
        childids[xx] = start_child_proc(THREAD_RANDOM_READ_TEST,numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)childids[xy],(long long)SIGTERM);
            }
            exit(38);
        }
        if(childids[xx]==0){
#ifdef _64BIT_ARCH_
            thread_ranread_test((void *)xx);
#else
            thread_ranread_test((void *)((long)xx));
#endif
        }   
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        chid=xx;
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }
#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create( thread_ranread_test,xx);
#else
        childids[xx] = mythread_create( thread_ranread_test,(void *)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("\nThread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                kill((pid_t)myid,(int)SIGTERM);
            }
            exit(39);
        }
       }
    }
#endif
    if(myid == (long long)getpid()){
                if(distributed && master_iozone)
                {
                        start_master_listen_loop((int) num_child);
                }
        for(i=0;i<num_child; i++){ /* wait for children to start */
            child_stat = (struct child_stats *)&shmaddr[i];
            while(child_stat->flag==CHILD_STATE_HOLD)
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i];
            child_stat->flag = CHILD_STATE_BEGIN;   /* tell children to go */
            if(delay_start!=0)
                Poll((long long)delay_start);
                       if(distributed && master_iozone)
                                tell_children_begin(i);
        }
        starttime1 = time_so_far();
    }
    
    getout=0;
    if(myid == (long long)getpid()){     /* Parent here */
        for( i = 0; i < num_child; i++){ /* wait for children to stop */
            child_stat = (struct child_stats *)&shmaddr[i];
                        if(distributed && master_iozone)
                        {
                printf("\n\tTest running:");
                                wait_dist_join();
                                break;
                        }
                        else
                        {
                           if(use_thread)
                           {
                                thread_join(childids[i],(void *)&pstatus);
                           }
                           else
                           {
                                wait(0);
                           }
                        }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res;
        if(jtime < (double).000001) 
        {
            jtime=time_res; 
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
    if(total_time < (double).000001) 
    {
        total_time=time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif
    total_kilos=0;
    ptotal=0;
    min_throughput=max_throughput=min_xfer=0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat = (struct child_stats *)&shmaddr[xyz];
        total_kilos+=child_stat->throughput;
        ptotal+=child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        cputime += child_stat->cputime;
        /* Get the biggest walltime */
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
        if (cputime < cputime_res)
            cputime = 0.0;
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %ld random readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %ld random readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#else
    if(!silent) printf("\tChildren see throughput for %lld random readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %lld random readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Randread");
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
        if(distributed && master_iozone)
    {
                stop_master_listen(master_listen_socket);
        cleanup_comm();
    }
    /**************************************************************/
    /***  mixed workload throughput tests ***************************/
    /**************************************************************/
next4:
    if(include_tflag)
        if(!(include_mask & (long long)RANDOM_MIX_MASK))
            goto next5;
    
    toutputindex++;
    strcpy(&toutput[toutputindex][0],throughput_tests[7]);
    if((!distributed) || (distributed && master_iozone))
        start_monitor("Mixed");
    walltime = 0.0;
    cputime = 0.0;
    jstarttime=0;
    sync();
    sleep(2);
    *stop_flag=0;
    total_kilos=0;
        /* Hooks to start the distributed Iozone client/server code */
        if(distributed)
        {
                use_thread=0;  /* Turn of any Posix threads */
                if(master_iozone)
                        master_listen_socket = start_master_listen();
                else
                        become_client();
        }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){
        chid=xx;
        childids[xx] = start_child_proc(THREAD_RANDOM_MIX_TEST,numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)childids[xy],(long long)SIGTERM);
            }
            exit(38);
        }
        if(childids[xx]==0){
#ifdef _64BIT_ARCH_
            thread_mix_test((void *)xx);
#else
            thread_mix_test((void *)((long)xx));
#endif
        }   
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        chid=xx;
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }
#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create( thread_mix_test,xx);
#else
        childids[xx] = mythread_create( thread_mix_test,(void *)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("\nThread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                kill((pid_t)myid,(int)SIGTERM);
            }
            exit(39);
        }
       }
    }
#endif
    if(myid == (long long)getpid()){
                if(distributed && master_iozone)
                {
                        start_master_listen_loop((int) num_child);
                }
        for(i=0;i<num_child; i++){ /* wait for children to start */
            child_stat = (struct child_stats *)&shmaddr[i];
            while(child_stat->flag==CHILD_STATE_HOLD)
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i];
            child_stat->flag = CHILD_STATE_BEGIN;   /* tell children to go */
            if(delay_start!=0)
                Poll((long long)delay_start);
                       if(distributed && master_iozone)
                                tell_children_begin(i);
        }
        starttime1 = time_so_far();
    }
    
    getout=0;
    if(myid == (long long)getpid()){     /* Parent here */
        for( i = 0; i < num_child; i++){ /* wait for children to stop */
            child_stat = (struct child_stats *)&shmaddr[i];
                        if(distributed && master_iozone)
                        {
                printf("\n\tTest running:");
                                wait_dist_join();
                                break;
                        }
                        else
                        {
                           if(use_thread)
                           {
                                thread_join(childids[i],(void *)&pstatus);
                           }
                           else
                           {
                                wait(0);
                           }
                        }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res;
        if(jtime < (double).000001) 
        {
            jtime=time_res; 
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
    if(total_time < (double).000001) 
    {
        total_time=time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif
    total_kilos=0;
    ptotal=0;
    min_throughput=max_throughput=min_xfer=0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat = (struct child_stats *)&shmaddr[xyz];
        total_kilos+=child_stat->throughput;
        ptotal+=child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        cputime += child_stat->cputime;
        /* Get the biggest walltime */
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
        if (cputime < cputime_res)
            cputime = 0.0;
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %ld mixed workload \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %ld mixed workload \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#else
    if(!silent) printf("\tChildren see throughput for %lld mixed workload \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %lld mixed workload \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Mixed");
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
        if(distributed && master_iozone)
    {
                stop_master_listen(master_listen_socket);
        cleanup_comm();
    }
next5:
    /**************************************************************/
    /*** random writer throughput tests  **************************/
    /**************************************************************/
    if(include_tflag)
        if(!(include_mask & (long long)RANDOM_RW_MASK) || no_write)
            goto next6;
    
    toutputindex++;
    strcpy(&toutput[toutputindex][0],throughput_tests[8]);
    if((!distributed) || (distributed && master_iozone))
        start_monitor("Randwrite");
    walltime = 0.0;
    cputime = 0.0;
    jstarttime=0;
    sync();
    sleep(2);
    *stop_flag=0;
    total_kilos=0;
        /* Hooks to start the distributed Iozone client/server code */
        if(distributed)
        {
                use_thread=0;  /* Turn of any Posix threads */
                if(master_iozone)
                        master_listen_socket = start_master_listen();
                else
                        become_client();
        }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){
        chid=xx;
        childids[xx] = start_child_proc(THREAD_RANDOM_WRITE_TEST,numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)childids[xy],(long long)SIGTERM);
            }
            exit(38);
        }
        if(childids[xx]==0){
#ifdef _64BIT_ARCH_
            thread_ranwrite_test((void *)xx);
#else
            thread_ranwrite_test((void *)((long)xx));
#endif
        }   
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        chid=xx;
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }
#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create( thread_ranwrite_test,xx);
#else
        childids[xx] = mythread_create( thread_ranwrite_test,(void *)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("\nThread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                kill((pid_t)myid,(int)SIGTERM);
            }
            exit(39);
        }
       }
    }
#endif
    if(myid == (long long)getpid()){
                if(distributed && master_iozone)
                {
                        start_master_listen_loop((int) num_child);
                }
        for(i=0;i<num_child; i++){ /* wait for children to start */
            child_stat = (struct child_stats *)&shmaddr[i];
            while(child_stat->flag==CHILD_STATE_HOLD)
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i];
            child_stat->flag = CHILD_STATE_BEGIN;   /* tell children to go */
            if(delay_start!=0)
                Poll((long long)delay_start);
                       if(distributed && master_iozone)
                                tell_children_begin(i);
        }
        starttime1 = time_so_far();
    }
    
    getout=0;
    if(myid == (long long)getpid()){     /* Parent here */
        for( i = 0; i < num_child; i++){ /* wait for children to stop */
            child_stat = (struct child_stats *)&shmaddr[i];
                        if(distributed && master_iozone)
                        {
                printf("\n\tTest running:");
                                wait_dist_join();
                                break;
                        }
                        else
                        {
                           if(use_thread)
                           {
                                thread_join(childids[i],(void *)&pstatus);
                           }
                           else
                           {
                                wait(0);
                           }
                        }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res;
        if(jtime < (double).000001) 
        {
            jtime=time_res; 
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
    if(total_time < (double).000001) 
    {
        total_time=time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif
    total_kilos=0;
    ptotal=0;
    min_throughput=max_throughput=min_xfer=0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat = (struct child_stats *)&shmaddr[xyz];
        total_kilos+=child_stat->throughput;
        ptotal+=child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        cputime += child_stat->cputime;
        /* Get the biggest walltime */
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
        if (cputime < cputime_res)
            cputime = 0.0;
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %ld random writers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %ld random writers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#else
    if(!silent) printf("\tChildren see throughput for %lld random writers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %lld random writers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Randwrite");
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
        if(distributed && master_iozone)
    {
                stop_master_listen(master_listen_socket);
        cleanup_comm();
    }
next6:
    /**************************************************************/
    /*** Pwrite writer throughput tests  **************************/
    /**************************************************************/
#ifndef HAVE_PREAD
        goto next7;
#else
    if(include_tflag)
        if(!(include_mask & (long long)PWRITER_MASK))
            goto next7;
    
    toutputindex++;
    strcpy(&toutput[toutputindex][0],throughput_tests[9]);
    if((!distributed) || (distributed && master_iozone))
        start_monitor("Pwrite");
    walltime = 0.0;
    cputime = 0.0;
    jstarttime=0;
    sync();
    sleep(2);
    *stop_flag=0;
    total_kilos=0;
        /* Hooks to start the distributed Iozone client/server code */
        if(distributed)
        {
                use_thread=0;  /* Turn of any Posix threads */
                if(master_iozone)
                        master_listen_socket = start_master_listen();
                else
                        become_client();
        }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){
        chid=xx;
        childids[xx] = start_child_proc(THREAD_PWRITE_TEST,numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)childids[xy],(long long)SIGTERM);
            }
            exit(38);
        }
        if(childids[xx]==0){
#ifdef _64BIT_ARCH_
            thread_pwrite_test((void *)xx);
#else
            thread_pwrite_test((void *)((long)xx));
#endif
        }   
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        chid=xx;
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }
#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create( thread_pwrite_test,xx);
#else
        childids[xx] = mythread_create( thread_pwrite_test,(void *)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("\nThread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                kill((pid_t)myid,(int)SIGTERM);
            }
            exit(39);
        }
       }
    }
#endif
    if(myid == (long long)getpid()){
                if(distributed && master_iozone)
                {
                        start_master_listen_loop((int) num_child);
                }
        for(i=0;i<num_child; i++){ /* wait for children to start */
            child_stat = (struct child_stats *)&shmaddr[i];
            while(child_stat->flag==CHILD_STATE_HOLD)
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i];
            child_stat->flag = CHILD_STATE_BEGIN;   /* tell children to go */
            if(delay_start!=0)
                Poll((long long)delay_start);
                       if(distributed && master_iozone)
                                tell_children_begin(i);
        }
        starttime1 = time_so_far();
    }
    
    getout=0;
    if(myid == (long long)getpid()){     /* Parent here */
        for( i = 0; i < num_child; i++){ /* wait for children to stop */
            child_stat = (struct child_stats *)&shmaddr[i];
                        if(distributed && master_iozone)
                        {
                printf("\n\tTest running:");
                                wait_dist_join();
                                break;
                        }
                        else
                        {
                           if(use_thread)
                           {
                                thread_join(childids[i],(void *)&pstatus);
                           }
                           else
                           {
                                wait(0);
                           }
                        }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res;
        if(jtime < (double).000001) 
        {
            jtime=time_res; 
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
    if(total_time < (double).000001) 
    {
        total_time=time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif
    total_kilos=0;
    ptotal=0;
    min_throughput=max_throughput=min_xfer=0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat = (struct child_stats *)&shmaddr[xyz];
        total_kilos+=child_stat->throughput;
        ptotal+=child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        cputime += child_stat->cputime;
        /* Get the biggest walltime*/
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
        if (cputime < cputime_res)
            cputime = 0.0;
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %ld pwrite writers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %ld pwrite writers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#else
    if(!silent) printf("\tChildren see throughput for %lld pwrite writers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %lld pwrite writers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Pwrite");
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
        if(distributed && master_iozone)
    {
                stop_master_listen(master_listen_socket);
        cleanup_comm();
    }
#endif
    /**************************************************************/
    /*** Pread reader throughput tests  **************************/
    /**************************************************************/
next7:

#ifndef HAVE_PREAD
        goto next8;
#else
    if(include_tflag)
        if(!(include_mask & (long long)PREADER_MASK))
            goto next8;
    
    toutputindex++;
    strcpy(&toutput[toutputindex][0],throughput_tests[10]);
    if((!distributed) || (distributed && master_iozone))
        start_monitor("Pread");
    walltime = 0.0;
    cputime = 0.0;
    jstarttime=0;
    sync();
    sleep(2);
    *stop_flag=0;
    total_kilos=0;
        /* Hooks to start the distributed Iozone client/server code */
        if(distributed)
        {
                use_thread=0;  /* Turn of any Posix threads */
                if(master_iozone)
                        master_listen_socket = start_master_listen();
                else
                        become_client();
        }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){
        chid=xx;
        childids[xx] = start_child_proc(THREAD_PREAD_TEST,numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)childids[xy],(long long)SIGTERM);
            }
            exit(38);
        }
        if(childids[xx]==0){
#ifdef _64BIT_ARCH_
            thread_pread_test((void *)xx);
#else
            thread_pread_test((void *)((long)xx));
#endif
        }   
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        chid=xx;
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }
#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create( thread_pread_test,xx);
#else
        childids[xx] = mythread_create( thread_pread_test,(void *)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("\nThread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                kill((pid_t)myid,(int)SIGTERM);
            }
            exit(39);
        }
       }
    }
#endif
    if(myid == (long long)getpid()){
                if(distributed && master_iozone)
                {
                        start_master_listen_loop((int) num_child);
                }
        for(i=0;i<num_child; i++){ /* wait for children to start */
            child_stat = (struct child_stats *)&shmaddr[i];
            while(child_stat->flag==CHILD_STATE_HOLD)
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i];
            child_stat->flag = CHILD_STATE_BEGIN;   /* tell children to go */
            if(delay_start!=0)
                Poll((long long)delay_start);
                       if(distributed && master_iozone)
                                tell_children_begin(i);
        }
        starttime1 = time_so_far();
    }
    
    getout=0;
    if(myid == (long long)getpid()){     /* Parent here */
        for( i = 0; i < num_child; i++){ /* wait for children to stop */
            child_stat = (struct child_stats *)&shmaddr[i];
                        if(distributed && master_iozone)
                        {
                printf("\n\tTest running:");
                                wait_dist_join();
                                break;
                        }
                        else
                        {
                           if(use_thread)
                           {
                                thread_join(childids[i],(void *)&pstatus);
                           }
                           else
                           {
                                wait(0);
                           }
                        }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res;
        if(jtime < (double).000001) 
        {
            jtime=time_res; 
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
    if(total_time < (double).000001) 
    {
        total_time=time_res;
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif
    total_kilos=0;
    ptotal=0;
    min_throughput=max_throughput=min_xfer=0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat = (struct child_stats *)&shmaddr[xyz];
        total_kilos+=child_stat->throughput;
        ptotal+=child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        cputime += child_stat->cputime;
        /* Get the biggest walltime*/
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
        if (cputime < cputime_res)
            cputime = 0.0;
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %ld pread readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %ld pread readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#else
    if(!silent) printf("\tChildren see throughput for %lld pread readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %lld pread readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Pread");
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
        if(distributed && master_iozone)
    {
                stop_master_listen(master_listen_socket);
        cleanup_comm();
    }
#endif
next8:
    if(include_tflag)
        if(!(include_mask & (long long)FWRITER_MASK))
            goto next9;
    /**************************************************************/
    /*** fwriter throughput tests *********************************/
    /**************************************************************/
    if((!distributed) || (distributed && master_iozone))
        start_monitor("Fwrite");
    toutputindex++;
    strcpy(&toutput[toutputindex][0],throughput_tests[11]);
    walltime = 0.0;
    cputime = 0.0;
    jstarttime=0;
    total_kilos=0;
    if(distributed)
    {
        use_thread=0;
        if(master_iozone)
            master_listen_socket=start_master_listen();
        else
            become_client();
    }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){
        chid=xx;
        childids[xx] = start_child_proc(THREAD_FWRITE_TEST,numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)childids[xy],(long long)SIGTERM);
            }
            exit(30);
        }
        if(childids[xx]==0){
#ifdef _64BIT_ARCH_
            thread_fwrite_test((void *)xx);
#else
            thread_fwrite_test((void *)((long)xx));
#endif
        }   
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }
#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create( thread_fwrite_test,xx);
#else
        childids[xx] = mythread_create( thread_fwrite_test,(void *)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("\nThread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                kill((pid_t)myid,(int)SIGTERM);
            }
            exit(31);
        }
       }
    }
#endif
    if(myid == (long long)getpid()){
        if(distributed && master_iozone)
        {
            start_master_listen_loop((int) num_child);
        }
        for(i=0;i<num_child; i++){ /* wait for children to start */
            child_stat=(struct child_stats *)&shmaddr[i];
            while(child_stat->flag==CHILD_STATE_HOLD)
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++)
        {
            child_stat=(struct child_stats *)&shmaddr[i];
            child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
            if(delay_start!=0)
                Poll((long long)delay_start);
            if(distributed && master_iozone)
                tell_children_begin(i);
        }
        starttime1 = time_so_far();
        goto jumpend1;
    }
jumpend1:
    getout=0;
    if(myid == (long long)getpid()){    /* Parent here */
        for( i = 0; i < num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i];
            if(distributed && master_iozone)
            {
                printf("\n\tTest running:");
                wait_dist_join();
                break;
            }
            else
            {
               if(use_thread)
               {
                thread_join(childids[i],(void *)&pstatus);
               }
               else
               {
                wait(0);
               }
            }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res; 
        if(jtime < (double).000001)
        {
            jtime=time_res; 
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
    if(total_time < (double).000001) 
    {
        total_time=time_res; 
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif
    
    total_kilos=0;
    ptotal=0;
    min_throughput=max_throughput=min_xfer=0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat=(struct child_stats *)&shmaddr[xyz];
        total_kilos+=child_stat->throughput;
        ptotal+=child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        cputime += child_stat->cputime;
        /* Get the earliest start time and latest fini time to calc. elapsed time. */
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
        if (cputime < cputime_res)
            cputime = 0.0;
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %2ld fwriters \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %2ld fwriters \t\t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#else
    if(!silent) printf("\tChildren see throughput for %2lld fwriters \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %2lld fwriters \t\t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Fwrite");
    /**********************************************************/
    /*************** End of fwrite throughput ****************/
    /**********************************************************/
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
    if(distributed && master_iozone)
    {
        stop_master_listen(master_listen_socket);
        cleanup_comm();
    }
next9:
    if(include_tflag)
        if(!(include_mask & (long long)FREADER_MASK))
            goto next10;
    /**************************************************************/
    /*** freader throughput tests *********************************/
    /**************************************************************/
    if((!distributed) || (distributed && master_iozone))
        start_monitor("Fread");
    toutputindex++;
    strcpy(&toutput[toutputindex][0],throughput_tests[12]);
    walltime = 0.0;
    cputime = 0.0;
    jstarttime=0;
    total_kilos=0;
    if(distributed)
    {
        use_thread=0;
        if(master_iozone)
            master_listen_socket=start_master_listen();
        else
            become_client();
    }
    if(!use_thread)
    {
       for(xx = 0; xx< num_child ; xx++){
        chid=xx;
        childids[xx] = start_child_proc(THREAD_FREAD_TEST,numrecs64,reclen);
        if(childids[xx]==-1){
            printf("\nFork failed\n");
            for(xy = 0; xy< xx ; xy++){
                Kill((long long)childids[xy],(long long)SIGTERM);
            }
            exit(30);
        }
        if(childids[xx]==0){
#ifdef _64BIT_ARCH_
            thread_fread_test((void *)xx);
#else
            thread_fread_test((void *)((long)xx));
#endif
        }   
       }
    }
#ifndef NO_THREADS
    else
    {
       for(xx = 0; xx< num_child ; xx++){   /* Create the children */
        if(!barray[xx])
        {
            barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
            if(barray[xx] == 0) {
                   perror("Memory allocation failed:");
                   exit(26);
                }
                barray[xx] =(char *)(((long)barray[xx] + cache_size ) & 
            ~(cache_size-1));
        }
#ifdef _64BIT_ARCH_
        childids[xx] = mythread_create( thread_fread_test,xx);
#else
        childids[xx] = mythread_create( thread_fread_test,(void *)(long)xx);
#endif
        if(childids[xx]==-1){
            printf("\nThread create failed\n");
            for(xy = 0; xy< xx ; xy++){
                kill((pid_t)myid,(int)SIGTERM);
            }
            exit(31);
        }
       }
    }
#endif
    if(myid == (long long)getpid()){
        if(distributed && master_iozone)
        {
            start_master_listen_loop((int) num_child);
        }
        for(i=0;i<num_child; i++){ /* wait for children to start */
            child_stat=(struct child_stats *)&shmaddr[i];
            while(child_stat->flag==CHILD_STATE_HOLD)
                Poll((long long)1);
        }
        for(i=0;i<num_child; i++)
        {
            child_stat=(struct child_stats *)&shmaddr[i];
            child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
            if(delay_start!=0)
                Poll((long long)delay_start);
            if(distributed && master_iozone)
                tell_children_begin(i);
        }
        starttime1 = time_so_far();
        goto jumpend3;
    }
jumpend3:
    getout=0;
    if(myid == (long long)getpid()){    /* Parent here */
        for( i = 0; i < num_child; i++){
            child_stat = (struct child_stats *)&shmaddr[i];
            if(distributed && master_iozone)
            {
                printf("\n\tTest running:");
                wait_dist_join();
                break;
            }
            else
            {
               if(use_thread)
               {
                thread_join(childids[i],(void *)&pstatus);
               }
               else
               {
                wait(0);
               }
            }
            if(!jstarttime)
                jstarttime = time_so_far(); 
        }
        jtime = (time_so_far()-jstarttime)-time_res; 
        if(jtime < (double).000001)
        {
            jtime=time_res; 
        }
    }
    total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
    if(total_time < (double).000001) 
    {
        total_time=time_res; 
        if(rec_prob < reclen)
            rec_prob = reclen;
        res_prob=1;
    }
#ifdef JTIME
    total_time=total_time-jtime;/* Remove the join time */
    if(!silent) printf("\nJoin time %10.2f\n",jtime);
#endif
    
    total_kilos=0;
    ptotal=0;
    min_throughput=max_throughput=min_xfer=0;
    if(!silent) printf("\n");
    for(xyz=0;xyz<num_child;xyz++){
        child_stat=(struct child_stats *)&shmaddr[xyz];
        total_kilos+=child_stat->throughput;
        ptotal+=child_stat->actual;
        if(!min_xfer)
            min_xfer=child_stat->actual;
        if(child_stat->actual < min_xfer)
            min_xfer=child_stat->actual;
        if(!min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput < min_throughput)
            min_throughput=child_stat->throughput;
        if(child_stat->throughput > max_throughput)
            max_throughput=child_stat->throughput;
        cputime += child_stat->cputime;
        /* Get the earliest start time and latest fini time to calc. elapsed time. */
        if (child_stat->walltime < child_stat->cputime)
            child_stat->walltime = child_stat->cputime;
        if (child_stat->walltime > walltime)
            walltime = child_stat->walltime;
    }
    avg_throughput=total_kilos/num_child;
    if(cpuutilflag)
    {
        if (cputime < cputime_res)
            cputime = 0.0;
    }
    if(cpuutilflag)
        store_times (walltime, cputime);    /* Must be Before store_dvalue(). */
    store_dvalue(total_kilos);
#ifdef NO_PRINT_LLD
    if(!silent) printf("\tChildren see throughput for %2ld freaders \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %2ld freaders \t\t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#else
    if(!silent) printf("\tChildren see throughput for %2lld freaders \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
    if(!silent && !distributed) printf("\tParent sees throughput for %2lld freaders \t\t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
#endif
    if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
    if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
    if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
    if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
    /* CPU% can be > 100.0 for multiple CPUs */
    if(cpuutilflag)
    {
        if(walltime == 0.0)
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 0.0);
        }
        else
        {
            if(!silent) printf("\tCPU utilization: Wall time %8.3f    CPU time %8.3f    CPU utilization %6.2f %%\n\n",
                walltime, cputime, 100.0 * cputime / walltime);
        }
    }
    if(Cflag)
    {
        for(xyz=0;xyz<num_child;xyz++)
        {
            child_stat = (struct child_stats *) &shmaddr[xyz];
            if(cpuutilflag)
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime, 
                    child_stat->cputime, cpu_util(child_stat->cputime, child_stat->walltime));
            }
            else
            {
                if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
                    (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
            }
        }
    }
    if((!distributed) || (distributed && master_iozone))
        stop_monitor("Fread");
    /**********************************************************/
    /*************** End of fread throughput ******************/
    /**********************************************************/
    sync();
    sleep(2);
    if(restf)
        sleep((int)rest_val);
    if(distributed && master_iozone)
    {
        stop_master_listen(master_listen_socket);
        cleanup_comm();
    }
next10:
    sleep(2); /* You need this. If you stop and restart the 
             master_listen it will fail on Linux */
    if (!no_unlink) {
        /**********************************************************/
        /* Cleanup all of the temporary files             */
        /* This is not really a test. It behaves like a test so   */
        /* it can unlink all of the same files that the other     */
        /* tests left hanging around.                 */
        /**********************************************************/
        /* Hooks to start the distributed Iozone client/server code */
        if(distributed)
        {
            use_thread=0;  /* Turn of any Posix threads */
            if(master_iozone)
                master_listen_socket = start_master_listen();
            else
                become_client();
        }
        if(!use_thread)
        {
           for(xx = 0; xx< num_child ; xx++){
            chid=xx;
            childids[xx] = start_child_proc(THREAD_CLEANUP_TEST,numrecs64,reclen);
            if(childids[xx]==-1){
                printf("\nFork failed\n");
                for(xy = 0; xy< xx ; xy++){
                    Kill((long long)childids[xy],(long long)SIGTERM);
                }
                exit(28);
            }
            if(childids[xx] == 0){
#ifdef _64BIT_ARCH_
                thread_cleanup_test((void *)xx);
#else
                thread_cleanup_test((void *)((long)xx));
#endif
            }   
           }
        }
#ifndef NO_THREADS
        else
        {
           for(xx = 0; xx< num_child ; xx++){   /* Create the children */
#ifdef _64BIT_ARCH_
            childids[xx] = mythread_create( thread_cleanup_test,xx);
#else
            childids[xx] = mythread_create( thread_cleanup_test,(void *)(long)xx);
#endif
            if(childids[xx]==-1){
                printf("\nThread create failed\n");
                for(xy = 0; xy< xx ; xy++){
                    Kill((long long)myid,(long long)SIGTERM);
                }
                exit(29);
            }
           }
        }
#endif
        if((long long)myid == getpid())
        {
            if(distributed && master_iozone)
            {
                start_master_listen_loop((int) num_child);
            }
            for(i=0;i<num_child; i++){
                child_stat = (struct child_stats *)&shmaddr[i];
                        /* wait for children to start */
                while(child_stat->flag==CHILD_STATE_HOLD) 
                    Poll((long long)1);
            }
            for(i=0;i<num_child; i++)
            {
                child_stat = (struct child_stats *)&shmaddr[i];
                child_stat->flag = CHILD_STATE_BEGIN;   /* tell children to go */
                if(delay_start!=0)
                    Poll((long long)delay_start);
                if(distributed && master_iozone)
                    tell_children_begin(i);
            }
        }
    
        getout=0;
        if((long long)myid == getpid()){    /* Parent only here */
            for( i = 0; i < num_child; i++){
                child_stat=(struct child_stats *)&shmaddr[i];
                if(distributed && master_iozone)
                {
                    printf("\n\tTest cleanup:");
                    wait_dist_join();
                    break;
                }
                else
                {
                   if(use_thread)
                   {
                    thread_join(childids[i],(void *)&pstatus);
                   }
                   else
                   {
                    wait(0);
                   }
                }
            }
        }

        for(xyz=0;xyz<num_child;xyz++){ /* Reset state to 0 (HOLD) */
            child_stat=(struct child_stats *)&shmaddr[xyz];
            child_stat->flag = CHILD_STATE_HOLD;
        }
        sync();
        sleep(2);
        if(distributed && master_iozone)
        {
            stop_master_listen(master_listen_socket);
#ifdef Windows
            /* windows needs time before shutting down sockets */
            sleep(1);
#endif
            cleanup_comm();
        }
    }
    /********************************************************/
    /* End of cleanup                   */
    /********************************************************/
    sync();
    if(!silent) printf("\n");
    if(!silent) printf("\n");
    return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static double time_so_far ( void  ) [static]

Definition at line 6844 of file iozone.c.

{
#ifdef Windows
   LARGE_INTEGER freq,counter;
   double wintime,bigcounter;
   struct timeval tp;
   /* For Windows the time_of_day() is useless. It increments in 55 milli 
    * second increments. By using the Win32api one can get access to the 
    * high performance measurement interfaces. With this one can get back 
    * into the 8 to 9 microsecond resolution.
    */
   if(pit_hostname[0]){
     if (pit_gettimeofday(&tp, (struct timezone *) NULL, pit_hostname, 
        pit_service) == -1)
         perror("pit_gettimeofday");
     return ((double) (tp.tv_sec)) + (((double) tp.tv_usec) * 0.000001 );
   }
   else
   {
        QueryPerformanceFrequency(&freq);
        QueryPerformanceCounter(&counter);
        bigcounter=(double)counter.HighPart *(double)0xffffffff +
                (double)counter.LowPart;
        wintime = (double)(bigcounter/(double)freq.LowPart);
        return((double)wintime);
   }
#else
#if defined (OSFV4) || defined(OSFV3) || defined(OSFV5)
  struct timespec gp;

  if (getclock(TIMEOFDAY, (struct timespec *) &gp) == -1)
    perror("getclock");
  return (( (double) (gp.tv_sec)) +
    ( ((float)(gp.tv_nsec)) * 0.000000001 ));
#else
  struct timeval tp;

  if(pit_hostname[0]){
     if (pit_gettimeofday(&tp, (struct timezone *) NULL, pit_hostname, pit_service) == -1)
         perror("pit_gettimeofday");
     return ((double) (tp.tv_sec)) + (((double) tp.tv_usec) * 0.000001 );
  }
  else
  {
     if (gettimeofday(&tp, (struct timezone *) NULL) == -1)
         perror("gettimeofday");
     return ((double) (tp.tv_sec)) + (((double) tp.tv_usec) * 0.000001 );
  }
#endif
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

static double time_so_far1 ( ) [static]

Definition at line 19207 of file iozone.c.

{
     /* For Windows the time_of_day() is useless. It increments in 
        55 milli second  increments. By using the Win32api one can 
    get access to the high performance measurement interfaces. 
    With this one can get back into the 8 to 9 microsecond resolution
      */
#ifdef Windows
    LARGE_INTEGER freq,counter;
    double wintime;
    double bigcounter;
    struct timeval tp;

    if(pit_hostname[0]){
       pit_gettimeofday(&tp, (struct timezone *) NULL, pit_hostname, 
        pit_service);
       return ((double) (tp.tv_sec)*1000000.0)+(((double)tp.tv_usec));
    }
    else
    {   

           QueryPerformanceFrequency(&freq);
           QueryPerformanceCounter(&counter);
           bigcounter=(double)counter.HighPart *(double)0xffffffff +
                   (double)counter.LowPart;
           wintime = (double)(bigcounter/(double)freq.LowPart);
           return((double)wintime*1000000.0);
    }
#else
#if defined (OSFV4) || defined(OSFV3) || defined(OSFV5)
  struct timespec gp;

  if (getclock(TIMEOFDAY, (struct timespec *) &gp) == -1)
    perror("getclock");
  return (( (double) (gp.tv_sec)*1000000.0) +
    ( ((float)(gp.tv_nsec)) * 0.001 ));
#else
  struct timeval tp;

  if(pit_hostname[0]){
     if (pit_gettimeofday(&tp, (struct timezone *) NULL, pit_hostname, 
        pit_service) == -1)
        perror("pit_gettimeofday");
     return ((double) (tp.tv_sec)*1000000.0) + (((double) tp.tv_usec) );
  }
  else
  {
     if (gettimeofday(&tp, (struct timezone *) NULL) == -1)
        perror("gettimeofday");
     return ((double) (tp.tv_sec)*1000000.0) + (((double) tp.tv_usec) );
  }
#endif
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void touch_dedup ( )

Here is the caller graph for this function:

void touch_dedup ( char *  i,
int  size 
)

Definition at line 23804 of file iozone.c.

{
    register int x;
    register long *ip;
    ip = (long *)i;
    srand(DEDUPSEED);
    for(x=0;x<size/sizeof(long);x++)
    {
        *ip=rand(); /* fill initial buffer */
        ip++;
    }
}

Here is the call graph for this function:

void traj_vers ( )

Definition at line 19916 of file iozone.c.

{
    FILE *fd;
    char *where;
    char buf[200];
    int things;
    char *ret1;
    
    if(r_traj_flag)
    {
        things=0;
        fd=fopen(read_traj_filename,"r");
        if(fd == (FILE *)0)
        {   
            printf("Unable to open read telemetry file \"%s\"\n", read_traj_filename);
            exit(174);
        }
loop1:
        ret1=fgets(buf,200,fd);
        if(ret1==(char *)0)
        {
            fclose(fd);
            return;
        }
        where=(char *)&buf[0];
        if((*where=='#') || (*where=='\n'))
            goto loop1;
        things++;
        strtok(where," ");
        while( (char *)(strtok( (char *)0," ")) != (char *)0)
        {
            things++;
        }
        r_traj_items=things;
#ifdef DEBUG
        printf("Found %d items in the read telemetry file\n",things);
#endif
    }
    if(w_traj_flag)
    {
        things=0;
        fd=fopen(write_traj_filename,"r");
        if(fd == (FILE *)0)
        {   
            printf("Unable to open write telemetry file \"%s\"\n", write_traj_filename);
            exit(174);
        }
loop2:
        ret1=fgets(buf,200,fd);
        if(ret1==(char *)0)
        {
            fclose(fd);
            return;
        }
        where=(char *)&buf[0];
        if((*where=='#') || (*where=='\n'))
            goto loop2;
        things++;
        strtok(where," ");
        while( (char *)(strtok( (char *)0," ")) != (char *)0)
        {
            things++;
        }
        fclose(fd);
        w_traj_items=things;
#ifdef DEBUG
        printf("Found %d items in the write telemetry file\n",things);
#endif
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int unlink ( )

Here is the caller graph for this function:

long long verify_buffer ( char *  buffer,
long long  length,
off64_t  recnum,
long long  recsize,
unsigned long long  patt,
char  sverify 
)

Definition at line 6940 of file iozone.c.

{
    volatile unsigned long long *where;
    volatile unsigned long long dummy;
    long *de_ibuf, *de_obuf;
    long long j,k;
    off64_t file_position=0;
    off64_t i;
    char *where2;
    char *pattern_ptr;
    long long mpattern,xx2;
    unsigned int seed;
    unsigned long x;
    unsigned long long value,value1;
    unsigned long long a= 0x01020304;
    unsigned long long b = 0x05060708;
    unsigned long long c= 0x01010101;
    unsigned long long d = 0x01010101;
    unsigned long long pattern_buf;
    int lite = 1;   /* Only validate 1 long when running 
               de-deup validation */

    value = (a<<32) | b;
    value1 = (c<<32) | d;

    /* printf("Verify Sverify %d verify %d diag_v %d\n",sverify,verify,diag_v); */
    x=0;
    xx2=chid;
    if(share_file)
        xx2=(long long)0;
    mpattern=patt;
    pattern_buf=patt;
    where=(unsigned long long *)buffer;
    if(sverify == 2)
    {
      for(i=0;i<(length);i+=page_size)
      {
          dummy = *where;
          where+=(page_size/sizeof(long long));
      }
      return(0);
    }
    if(dedup)
    {
        gen_new_buf((char *)dedup_ibuf,(char *)dedup_temp, (long)recnum, (int)length,(int)dedup, (int) dedup_interior, dedup_compress, 0);
        de_ibuf = (long *)buffer;
        de_obuf = (long *)dedup_temp;
        if(lite)    /* short touch to reduce intrusion */
            length = (long) sizeof(long);
        for(i=0;i<length/sizeof(long);i++)
        {
            if(de_ibuf[i]!= de_obuf[i])
            {
                if(!silent)
#ifdef NO_PRINT_LLD
                   printf("\nDedup mis-compare at %ld\n",
                    (long long)((recnum*recsize)+(i*sizeof(long))) );
#else
                   printf("\nDedup mis-compare at %lld\n",
                    (long long)((recnum*recsize)+(i*sizeof(long))) );
                   printf("Found %.lx Expecting %.lx \n",de_ibuf[i], de_obuf[i]);
#endif
                return(1);
            }
        }
        return(0);
    }
    if(diag_v)
    {
        if(no_unlink)
            base_time=0;
        seed= (unsigned int)(base_time+xx2+recnum);
            srand(seed);
            mpattern=(long long)rand();
            mpattern=(mpattern<<48) | (mpattern<<32) | (mpattern<<16) | mpattern;
        mpattern=mpattern+value;
    }

    /* printf("verify patt %llx CHid %d\n",mpattern,chid);*/

    where=(unsigned long long *)buffer;

    if(!verify)
        printf("\nOOPS You have entered verify_buffer unexpectedly !!! \n");

    if(sverify == 1)
    {
      for(i=0;i<(length);i+=page_size)
      {
          if((unsigned long long)(*where) != (unsigned long long)((pattern_buf<<32) | pattern_buf))
          {
           file_position = (off64_t)( (recnum * recsize)+ i);
    printf("\n\n");
#ifdef NO_PRINT_LLD
    printf("Error in file: Found ?%lx? Expecting ?%lx? addr %lx\n",*where, (long long)((pattern_buf<<32)|pattern_buf),where);
    printf("Error in file: Position %ld \n",file_position);
    printf("Record # %ld Record size %ld kb \n",recnum,recsize/1024);
    printf("where %8.8llx loop %ld\n",where,i);
#else
    printf("Error in file: Found ?%llx? Expecting ?%llx? addr %lx\n",*where, (long long)((pattern_buf<<32)|pattern_buf),((long)where));
    printf("Error in file: Position %lld \n",file_position);
    printf("Record # %lld Record size %lld kb \n",recnum,recsize/1024);
    printf("where %8.8lx loop %lld\n",(long)where,(long long)i);
#endif
           return(1);
          }
          where+=(page_size/sizeof(long long));
      }
    }
    if(sverify == 0)
    {
      for(i=0;i<(length/cache_line_size);i++)
      {
       for(j=0;j<(cache_line_size/sizeof(long long));j++)
       {
              if(diag_v)
          {
         pattern_buf=mpattern;
          }
          else
              {
        pattern_buf= mpattern<<32 | mpattern;
          }

          pattern_ptr =(char *)&pattern_buf;

          if(*where != (unsigned long long)pattern_buf)
          {
           file_position = (off64_t)( (recnum * recsize))+
            ((i*cache_line_size)+(j*sizeof(long long)));
           where2=(char *)where;
           for(k=0;k<sizeof(long long);k++){
            if(*where2 != *pattern_ptr)
                break;
            where2++;
            pattern_ptr++;
           }
           file_position+=k;
    printf("\n\n");
#ifdef NO_PRINT_LLD
    printf("Error in file: Position %ld %ld %ld \n",i,j,k);
    printf("Error in file: Position %ld \n",file_position);
    printf("Record # %ld Record size %ld kb \n",recnum,recsize/1024);
#else
    printf("Error in file: Position %lld %lld %lld \n",i,j,k);
    printf("Error in file: Position %lld \n",file_position);
    printf("Record # %lld Record size %lld kb \n",recnum,recsize/1024);
#endif
    printf("Found pattern: Char >>%c<< Expecting >>%c<<\n", *where2,*pattern_ptr);
    printf("Found pattern: Hex >>%x<< Expecting >>%x<<\n", *where2,*pattern_ptr);
           return(1);
          }
          where++;
          if(diag_v)
             mpattern=mpattern+value1;
       }    
      }
    }
    return(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

long long w_traj_size ( )

Definition at line 19825 of file iozone.c.

{
    FILE *fd;
    int ret;
    long long traj_offset = 0;
    long long traj_size = 0;
    long long max_offset = 0;
    int dummy;
    int tokens,lines;
    char *ret1;
    char buf[200];
    char sbuf[200];
    char *where;

    lines=0;

    fd=fopen(write_traj_filename,"r");
    if(fd == (FILE *)0)
    {
        printf("Unable to open write telemetry file \"%s\"\n",
            write_traj_filename);
        exit(174);
    }
    while(1)
    {
        tokens=0;
        ret1=fgets(buf,200,fd);
        if(ret1==(char *)0)
            break;
        lines++;
        where=(char *)&buf[0];
        strcpy(sbuf,buf);
        if((*where=='#') || (*where=='\n'))
            continue;
        tokens++;
        strtok(where," ");
        while( (char *)(strtok( (char *)0," ")) != (char *)0)
        {
            tokens++;
        }
        if(tokens==1)
        {
            printf("\n\tInvalid write telemetry file entry. Line %d\n",
                lines);
            signal_handler();
        }
        if(tokens==3)
        {
#ifdef NO_PRINT_LLD
            ret=sscanf(sbuf,"%ld %ld %d\n",&traj_offset,&traj_size,&dummy);
#else
            ret=sscanf(sbuf,"%lld %lld %d",&traj_offset,&traj_size,&dummy);
#endif
        }
        if(tokens==2)
        {
#ifdef NO_PRINT_LLD
            ret=sscanf(sbuf,"%ld %ld\n",&traj_offset,&traj_size);
#else
            ret=sscanf(sbuf,"%lld %lld\n",&traj_offset,&traj_size);
#endif
        }
        if(tokens > 3)
        {
            printf("\n\tInvalid write telemetry file entry. Line %d\n",
                lines);
            exit(174);
        }
        if(traj_offset + traj_size > max_offset)
            max_offset=traj_offset + traj_size;
        
        w_traj_ops++;
    }   
    w_traj_fsize=max_offset;
#ifdef DEBUG
    printf("File size of write %lld Item count %lld\n",w_traj_fsize,w_traj_ops);
#endif
    fclose(fd);
    return(max_offset);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int wait ( )

Here is the caller graph for this function:

void wait_dist_join ( )

Definition at line 22391 of file iozone.c.

{
    wait(0);
    if(mdebug)
        printf("Master: All children have finished. Sending terminate\n");
    terminate_child_async(); /* All children are done, so terminate their async channel */
    current_client_number=0; /* start again */
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

void wait_for_master_go ( long long  chid)

Definition at line 22111 of file iozone.c.

{
    struct client_neutral_command *cnc;
    struct client_command cc;
    bzero(&cc,sizeof(struct client_command));
    child_listen(l_sock,sizeof(struct client_neutral_command));
    cnc = (struct client_neutral_command *)child_rcv_buf;
    sscanf(cnc->c_command,"%d",&cc.c_command);
    if(cc.c_command == R_TERMINATE || cc.c_command==R_DEATH)
    {
        if(cdebug)
        {
            fprintf(newstdout,"Child %d received terminate on sync channel at barrier !!\n",(int)chid);
            fflush(newstdout);
        }
        exit(1);
    }
    if(cdebug>=1)
    {
        fprintf(newstdout,"Child %d return from wait_for_master_go\n",(int)chid);
        fflush(newstdout);
    }
}

Here is the call graph for this function:

void write_perf_test ( )
void write_perf_test ( off64_t  kilo64,
long long  reclen,
long long *  data1,
long long *  data2 
)

Definition at line 7258 of file iozone.c.

{
    double starttime1;
    double writetime[2];
    double walltime[2], cputime[2];
    double qtime_start,qtime_stop;
    double hist_time;
    double compute_val = (double)0;
#ifdef unix
    double qtime_u_start,qtime_u_stop;
    double qtime_s_start,qtime_s_stop;
#endif
    long long i,j;
    off64_t numrecs64,traj_offset;
    off64_t lock_offset=0;
    long long Index = 0;
    long long file_flags = 0;
    long long traj_size;
    unsigned long long writerate[2];
    off64_t filebytes64;
    int ltest;
    char *maddr;
    char *wmaddr,*free_addr;
    char *pbuff;
    char *nbuff;
    int fd,wval;
#ifdef ASYNC_IO
    struct cache *gc=0;
#else
    long long *gc=0;
#endif

    int test_foo;

#ifdef unix
    qtime_u_start=qtime_u_stop=0;
    qtime_s_start=qtime_s_stop=0;
#endif
    nbuff=wmaddr=free_addr=0;
    traj_offset=0;
    test_foo=0;
    hist_time=qtime_start=qtime_stop=0;
    maddr=0;
    pbuff=mainbuffer;
    if(w_traj_flag)
    {
        filebytes64 = w_traj_fsize;
        numrecs64=w_traj_ops;
    }
    else
    {
        numrecs64 = (kilo64*1024)/reclen;
        filebytes64 = numrecs64*reclen;
    }

    if(Q_flag && (!wol_opened))
    {
        wol_opened++;
        wqfd=fopen("wol.dat","a");
        if(wqfd==0)
        {
            printf("Unable to open wol.dat\n");
            exit(40);
        }
        fprintf(wqfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
        rwqfd=fopen("rwol.dat","a");
        if(rwqfd==0)
        {
            printf("Unable to open rwol.dat\n");
            exit(41);
        }
        fprintf(rwqfd,"Offset in Kbytes   Latency in microseconds  Transfer size in bytes\n");
    }
    fd = 0;
    if(oflag)
        file_flags = O_RDWR|O_SYNC;
    else
        file_flags = O_RDWR;
#if defined(O_DSYNC)
    if(odsync)
        file_flags |= O_DSYNC;
#endif
#if defined(_HPUX_SOURCE) || defined(linux) || defined(__FreeBSD__) || defined(__DragonFly__)
    if(read_sync)
        file_flags |=O_RSYNC|O_SYNC;
#endif

#if ! defined(DONT_HAVE_O_DIRECT)
#if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
    if(direct_flag)
        file_flags |=O_DIRECT;
#endif
#if defined(TRU64)
    if(direct_flag)
        file_flags |=O_DIRECTIO;
#endif
#endif

/* Sanity check */
/* Some filesystems do not behave correctly and fail
 * when this sequence is performned. This is a very
 * bad thing. It breaks many applications and lurks
 * around quietly. This code should never get
 * triggered, but in the case of running iozone on
 * an NFS client, the filesystem type on the server
 * that is being exported can cause this failure.
 * If this failure happens, then the NFS client is
 * going to going to have problems, but the acutal
 * problem is the filesystem on the NFS server.
 * It's not NFS, it's the local filesystem on the
 * NFS server that is not correctly permitting
 * the sequence to function.
 */
/* _SUA_ Services for Unix Applications, under Windows
    does not have a truncate, so this must be skipped */
#if !defined(_SUA_)
        if((fd = I_OPEN(filename, (int)O_CREAT|O_WRONLY,0))<0)
        {
                printf("\nCan not open temp file: %s\n",
                        filename);
                perror("open");
                exit(44);
        }
        if(!notruncate)
        {
            if(check_filename(filename))
            {
                wval=ftruncate(fd,0);
                if(wval < 0)
                {
                    printf("\n\nSanity check failed. Do not deploy this filesystem in a production environment !\n");
                    exit(44);
                }
            }
            close(fd);

            if(check_filename(filename))
                unlink(filename);
        }
/* Sanity check */

#endif
    if(noretest)
        ltest=1;
    else
        ltest=2;

    for( j=0; j<ltest; j++)
    {
        if(cpuutilflag)
        {
            walltime[j] = time_so_far();
            cputime[j]  = cputime_so_far();
        }
        if(Uflag) /* Unmount and re-mount the mountpoint */
        {
            purge_buffer_cache();
        }
        if(j==0)
        {
#if defined(Windows)
                if(unbuffered)
                {
                    hand=CreateFile(filename,
                  GENERIC_READ|GENERIC_WRITE,
                      FILE_SHARE_WRITE|FILE_SHARE_READ,
                  NULL,OPEN_ALWAYS,FILE_FLAG_NO_BUFFERING|
                  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
                  NULL);
                    }
                else
                {
#endif
                if(!notruncate)
                {
                    if((fd = I_CREAT(filename, 0640))<0)
                    {
                        printf("\nCan not create temp file: %s\n", 
                            filename);
                        perror("creat");
                        exit(42);
                    }
                }
#if defined(Windows)
            }
#endif
        }
#if defined(Windows)
        if(unbuffered)
            CloseHandle(hand);
        else
        {
#endif
          if(fd) 
            close(fd);
#if defined(Windows)
        }
#endif

#if defined(Windows)
            if(unbuffered)
            {
                hand=CreateFile(filename,
              GENERIC_READ|GENERIC_WRITE,
                  FILE_SHARE_WRITE|FILE_SHARE_READ,
              NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
              FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
              NULL);
                }
            else
            {
#endif
           if((fd = I_OPEN(filename, (int)file_flags,0))<0)
           {
            printf("\nCan not open temp file: %s\n", 
                filename);
            perror("open");
            exit(44);
           }
#if defined(Windows)
        }
#endif
#ifdef VXFS
        if(direct_flag)
        {
            ioctl(fd,VX_SETCACHE,VX_DIRECT);
            ioctl(fd,VX_GETCACHE,&test_foo);
            if(test_foo == 0)
            {
                if(!client_iozone)
                  printf("\nVxFS advanced setcache feature not available.\n");
                exit(3);
            }
        }
#endif
#if defined(solaris)
               if(direct_flag)
               {
                       test_foo = directio(fd, DIRECTIO_ON);
                       if(test_foo != 0)
                       {
                               if(!client_iozone)
                                 printf("\ndirectio not available.\n");
                               exit(3);
                       }
               }
#endif

        if(file_lock)
            if(mylockf((int) fd, (int) 1, (int)0)!=0)
                printf("File lock for write failed. %d\n",errno);
        if(mmapflag)
        {
            maddr=(char *)initfile(fd,filebytes64,1,PROT_READ|PROT_WRITE);
        }
        if(mmap_mix)
        {
            wval=write(fd, pbuff, (size_t) page_size);
            if(wval != page_size)
            {
#ifdef NO_PRINT_LLD
                    printf("\nError writing block %ld, fd= %d\n", (long long)0, fd);
#else
                    printf("\nError writing block %lld, fd= %d\n", (long long)0, fd);
#endif
                if(wval==-1)
                    perror("write");
                signal_handler();
            }
            I_LSEEK(fd,0,SEEK_SET);
        };
        wval=fsync(fd);
        if(wval==-1){
            perror("fsync");
            signal_handler();
        }
#ifdef ASYNC_IO
        if(async_flag)
            async_init(&gc,fd,direct_flag);
#endif
        pbuff=mainbuffer;
        if(fetchon)
            fetchit(pbuff,reclen);
        if(verify || dedup || dedup_interior)
            fill_buffer(pbuff,reclen,(long long)pattern,sverify,(long long)0);
        starttime1 = time_so_far();
#ifdef unix
        if(Q_flag)
        {
            qtime_u_start=utime_so_far();
            qtime_s_start=stime_so_far();
        }
#endif
        if(w_traj_flag)
        {
            rewind(w_traj_fd);
        }
        compute_val=(double)0;
        w_traj_ops_completed=0;
        w_traj_bytes_completed=0;
        for(i=0; i<numrecs64; i++){
            if(w_traj_flag)
            {
                traj_offset=get_traj(w_traj_fd, (long long *)&traj_size,(float *)&compute_time,(long)1);
                reclen=traj_size;
#if defined(Windows)
            if(unbuffered)
              SetFilePointer(hand,(LONG)traj_offset,0,FILE_BEGIN);
            else
#endif
                I_LSEEK(fd,traj_offset,SEEK_SET);
            }
            if(Q_flag)
            {
#if defined(Windows)
            if(unbuffered)
              traj_offset=SetFilePointer(hand,(LONG)0,0,FILE_CURRENT);
            else
#endif
                traj_offset=I_LSEEK(fd,0,SEEK_CUR);
            }
            if(rlocking)
            {
                lock_offset=I_LSEEK(fd,0,SEEK_CUR);
                mylockr((int) fd, (int) 1, (int)0,
                  lock_offset, reclen);
            }
            if((verify && diag_v) || dedup || dedup_interior)
                fill_buffer(pbuff,reclen,(long long)pattern,sverify,i);
            if(compute_flag)
                compute_val+=do_compute(compute_time);
            if(multi_buffer)
            {
                Index +=reclen;
                if(Index > (MAXBUFFERSIZE-reclen))
                    Index=0;
                pbuff = mbuffer + Index;    
                if(verify || dedup || dedup_interior)
                    fill_buffer(pbuff,reclen,(long long)pattern,sverify,(long long)0);
            }
            if(async_flag && no_copy_flag)
            {
                free_addr=nbuff=(char *)malloc((size_t)reclen+page_size);
                nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
                if(verify || dedup || dedup_interior)
                    fill_buffer(nbuff,reclen,(long long)pattern,sverify,i);
                if(purge)
                    purgeit(nbuff,reclen);
            }
            if(purge)
                purgeit(pbuff,reclen);
            if(Q_flag || hist_summary)
            {
                qtime_start=time_so_far();
            }
            if(mmapflag)
            {
                wmaddr = &maddr[i*reclen];
                fill_area((long long*)pbuff,(long long*)wmaddr,(long long)reclen);
                if(!mmapnsflag)
                {
                  if(mmapasflag)
                    msync(wmaddr,(size_t)reclen,MS_ASYNC);
                  if(mmapssflag)
                    msync(wmaddr,(size_t)reclen,MS_SYNC);
                }
            }
            else
            {
              if(async_flag)
              {
                 if(no_copy_flag)
                   async_write_no_copy(gc, (long long)fd, nbuff, reclen, (i*reclen), depth,free_addr);
                 else
                   async_write(gc, (long long)fd, pbuff, reclen, (i*reclen), depth);
              }
              else
              {
#if defined(Windows)
                    if(unbuffered)
                    {
                WriteFile(hand, pbuff, reclen,(LPDWORD)&wval,
                    0);
                }
                else
                {
#endif
                wval=write(fd, pbuff, (size_t ) reclen);
                if(wval != reclen)
                {
#ifdef NO_PRINT_LLD
                    printf("\nError writing block %ld, fd= %d\n", i,
                     fd);
#else
                    printf("\nError writing block %lld, fd= %d\n", i,
                     fd);
#endif
                    if(wval == -1)
                    perror("write");
                signal_handler();
                }
#if defined(Windows)
                }
#endif
              }
            }
            if(hist_summary)
            {
                qtime_stop=time_so_far();
                hist_time =(qtime_stop-qtime_start-time_res);
                hist_insert(hist_time);
            }
            if(Q_flag)
            {
                qtime_stop=time_so_far();
                if(j==0)
#ifdef NO_PRINT_LLD
                fprintf(wqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((qtime_stop-qtime_start-time_res))*1000000,reclen);
                else
                fprintf(rwqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((qtime_stop-qtime_start-time_res))*1000000,reclen);
#else
                fprintf(wqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((qtime_stop-qtime_start-time_res))*1000000,reclen);
                else
                fprintf(rwqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((qtime_stop-qtime_start-time_res))*1000000,reclen);
#endif
            }
            w_traj_ops_completed++;
            w_traj_bytes_completed+=reclen;
            if(rlocking)
            {
                mylockr((int) fd, (int) 0, (int)0,
                  lock_offset, reclen);
            }
        }
#ifdef unix
        if(Q_flag)
        {
           qtime_u_stop=utime_so_far();
           qtime_s_stop=stime_so_far();
           if(j==0)
             fprintf(wqfd,"\nSystem time %10.3f User time %10.3f Real %10.3f  (seconds)\n",
                (qtime_s_stop-qtime_s_start)/sc_clk_tck,
                (qtime_u_stop-qtime_u_start)/sc_clk_tck,
                time_so_far()-starttime1);
           else
            fprintf(rwqfd,"\nSystem time %10.3f User time %10.3f Real %10.3f  (seconds)\n",
                (qtime_s_stop-qtime_s_start)/sc_clk_tck,
                (qtime_u_stop-qtime_u_start)/sc_clk_tck,
                time_so_far()-starttime1);
        }
#endif

#ifdef ASYNC_IO
        if(async_flag)
        {
            end_async(gc);
            gc=0;
        }
#endif
        if(include_flush)
        {
            if(mmapflag){
                msync(maddr,(size_t)filebytes64,MS_SYNC);
            }
            else
            {
                wval=fsync(fd);
                if(wval==-1){
                    perror("fsync");
                    signal_handler();
                }
            }
        }
        if(file_lock)
            if(mylockf((int) fd,(int)0,(int)0))
                printf("Unlock failed %d\n",errno);
        if(include_close)
        {
            if(mmapflag)
            {
                mmap_end(maddr,(unsigned long long)filebytes64);
            }
#if defined(Windows)
            if(unbuffered)
                CloseHandle(hand);
            else
#endif
               wval=close(fd);
               if(wval==-1){
                perror("close");
                signal_handler();
               }
        }
        writetime[j] = ((time_so_far() - starttime1)-time_res)
            -compute_val;
        if(writetime[j] < (double).000001) 
        {
            writetime[j]=time_res;
            if(rec_prob < reclen)
                rec_prob = reclen;
            res_prob=1;
        }
        if(!include_close)
        {
            if(mmapflag)
                msync(maddr,(size_t)filebytes64,MS_SYNC);/* Clean up before read starts */
            else
            {
                wval=fsync(fd);
                if(wval==-1){
                    perror("fsync");
                    signal_handler();
                }
            }
            if(mmapflag)
            {
                mmap_end(maddr,(unsigned long long)filebytes64);
            }
#if defined(Windows)
            if(unbuffered)
                CloseHandle(hand);
            else
#endif
            wval=close(fd);
            if(wval==-1){
                perror("close");
                signal_handler();
            }
        }
        if(cpuutilflag)
        {
            cputime[j]  = cputime_so_far() - cputime[j];
            if (cputime[j] < cputime_res)
                cputime[j] = 0.0;
            walltime[j] = time_so_far() - walltime[j];
            if (walltime[j] < cputime[j])
               walltime[j] = cputime[j];
        }
        if(restf)
            sleep((int)rest_val);
    }
    if(OPS_flag || MS_flag){
       filebytes64=w_traj_ops_completed;
       /*filebytes64=filebytes64/reclen;*/
    }else
       filebytes64=w_traj_bytes_completed;
        
        for(j=0;j<ltest;j++)
        {
        if(MS_flag)
        {
            writerate[j]=1000000.0*(writetime[j] / (double)filebytes64);
            continue;
        }
              else
            {
                  writerate[j] = 
                    (unsigned long long) ((double) filebytes64 / writetime[j]);
            }
        if(!(OPS_flag || MS_flag))
           writerate[j] >>= 10;
    }
    data1[0]=writerate[0];
    if(noretest)
    {   
        writerate[1]=(long long) 0;
        if(cpuutilflag)
        {
            walltime[1]=0.0;
            cputime[1]=0.0;
        }
    }
    /* Must save walltime & cputime before calling store_value() for each/any cell.*/
    if(cpuutilflag)
        store_times(walltime[0], cputime[0]);
    store_value((off64_t)writerate[0]);
    if(cpuutilflag)
        store_times(walltime[1], cputime[1]);
    store_value((off64_t)writerate[1]);
#ifdef NO_PRINT_LLD
    if(!silent) printf("%8ld",writerate[0]);
    if(!silent) printf("%8ld",writerate[1]);
    if(!silent) fflush(stdout);
#else
    if(!silent) printf("%8lld",writerate[0]);
    if(!silent) printf("%8lld",writerate[1]);
    if(!silent) fflush(stdout);
#endif
}

Here is the call graph for this function:


Variable Documentation

int a_port

Definition at line 1454 of file iozone.c.

Definition at line 1526 of file iozone.c.

int advise_op

Definition at line 1526 of file iozone.c.

char aflag

Definition at line 1303 of file iozone.c.

int aggflag

Definition at line 1480 of file iozone.c.

int argcsave

Definition at line 1392 of file iozone.c.

char** argvsave

Definition at line 1393 of file iozone.c.

char async_flag

Definition at line 1512 of file iozone.c.

long long auto_mode

Definition at line 1290 of file iozone.c.

char* barray[256]

Definition at line 1287 of file iozone.c.

long base_time

Definition at line 1323 of file iozone.c.

Definition at line 1293 of file iozone.c.

Definition at line 1298 of file iozone.c.

int bif_fd

Definition at line 1297 of file iozone.c.

char bif_filename[1000]

Definition at line 1359 of file iozone.c.

char bif_flag

Definition at line 1307 of file iozone.c.

int bif_row

Definition at line 1298 of file iozone.c.

long long bucket_val[40]
Initial value:
    { 20,40,60,80,100,
    200,400,600,800,1000,
    2000,4000,6000,8000,10000,
    12000,14000,16000,18000,20000,
    40000,60000,80000,100000,
    200000,400000,600000,800000,1000000,
    2000000,4000000,6000000,8000000,10000000,
    20000000,30000000,60000000,90000000,120000000,120000001}

Definition at line 24213 of file iozone.c.

long long buckets[40]

Definition at line 24212 of file iozone.c.

char* buffer

Definition at line 1366 of file iozone.c.

char * buffer1

Definition at line 1366 of file iozone.c.

char* build_name = NAME

Definition at line 1316 of file iozone.c.

int c_port

Definition at line 1454 of file iozone.c.

unsigned long cache_line_size = 32

Definition at line 1376 of file iozone.c.

unsigned long cache_size = ( 1024 * 1024 )

Definition at line 1375 of file iozone.c.

int cdebug = 0

Definition at line 1478 of file iozone.c.

char Cflag

Definition at line 1371 of file iozone.c.

long long chid

Definition at line 1529 of file iozone.c.

Definition at line 1456 of file iozone.c.

char child_async_rcv_buf[4096]

Definition at line 1464 of file iozone.c.

struct sockaddr_in child_sync_sock child_async_sock

Definition at line 1481 of file iozone.c.

struct child_ident child_idents[ 256 ]

Definition at line 1467 of file iozone.c.

Definition at line 1468 of file iozone.c.

Definition at line 1455 of file iozone.c.

char child_rcv_buf[4096]

Definition at line 1463 of file iozone.c.

char child_send_buf[4096]

Definition at line 1465 of file iozone.c.

Definition at line 1466 of file iozone.c.

long long childids[256+1]

Definition at line 1335 of file iozone.c.

Definition at line 1398 of file iozone.c.

char client_filename[256]

Definition at line 1396 of file iozone.c.

Definition at line 1296 of file iozone.c.

Definition at line 1457 of file iozone.c.

Definition at line 1474 of file iozone.c.

char command_line[1024] = "\0"

Definition at line 1387 of file iozone.c.

Definition at line 1520 of file iozone.c.

float compute_time

Definition at line 1538 of file iozone.c.

Definition at line 1493 of file iozone.c.

int controlling_host_port = 20000

Definition at line 1410 of file iozone.c.

double cputime_res

Definition at line 1271 of file iozone.c.

Definition at line 1321 of file iozone.c.

Definition at line 1528 of file iozone.c.

short current_x

Definition at line 1273 of file iozone.c.

short current_y

Definition at line 1273 of file iozone.c.

long long debug = 0

Definition at line 1374 of file iozone.c.

long long debug1 = 0

Definition at line 1373 of file iozone.c.

char dedup

Definition at line 1304 of file iozone.c.

Definition at line 1304 of file iozone.c.

char* dedup_ibuf

Definition at line 1305 of file iozone.c.

Definition at line 1304 of file iozone.c.

int dedup_mseed = 1

Definition at line 1299 of file iozone.c.

char* dedup_temp

Definition at line 1306 of file iozone.c.

char* default_filename = "iozone.tmp"

Definition at line 1369 of file iozone.c.

long long delay

Definition at line 1533 of file iozone.c.

long long delay_start

Definition at line 1536 of file iozone.c.

long long depth

Definition at line 1536 of file iozone.c.

char diag_v

Definition at line 1304 of file iozone.c.

Definition at line 1527 of file iozone.c.

Definition at line 1520 of file iozone.c.

Definition at line 1296 of file iozone.c.

char dummyfile[256][1000]

Definition at line 1362 of file iozone.c.

char dummyfile1[1000]

Definition at line 1363 of file iozone.c.

int ecount

Definition at line 1310 of file iozone.c.

char Eflag

Definition at line 1303 of file iozone.c.

int errno
int fd

Definition at line 1291 of file iozone.c.

long long fetchon

Definition at line 1533 of file iozone.c.

char fflag

Definition at line 1329 of file iozone.c.

int file_lock

Definition at line 1530 of file iozone.c.

char* filearray[256]

Definition at line 1364 of file iozone.c.

Definition at line 1281 of file iozone.c.

char filename[1000]

Definition at line 1360 of file iozone.c.

char gflag

Definition at line 1311 of file iozone.c.

unsigned long long goodkilos

Definition at line 1276 of file iozone.c.

long long goodrecl

Definition at line 1278 of file iozone.c.

int h_errno
char h_flag

Definition at line 1509 of file iozone.c.

char* haveshm

Definition at line 1288 of file iozone.c.

char* head1[]
Initial value:
 {
  "       'Iozone' Filesystem Benchmark Program",
  " ",
 "        Version $Revision$" ,
   "\tCompiled for 32 bit mode." ,
  " ",
  "       Original Author: William Norcott (wnorcott@us.oracle.com)",
  "               4 Dunlap Drive",
  "               Nashua, NH 03060",
  " ",
  "       Enhancements: Don Capps (capps@iozone.org)",
  "           7417 Crenshaw",
  "           Plano, TX 75025",
  " ",
  "  Copyright 1991, 1992, 1994, 1998, 1999, 2002   William D. Norcott",
  " ",
  "  License to freely use and distribute this software is hereby granted ",
  "  by the author, subject to the condition that this copyright notice ",
  "  remains intact.  The author retains the exclusive right to publish ",
  "  derivative works based on this work, including, but not limited to, ",
  "  revised versions of this work",
  " ",
  "  Other contributors:",
  " ",
  "  Don Capps       (Network Appliance)    capps@iozone.org",
  " ",
  ""}

Definition at line 246 of file iozone.c.

char* help[]

Definition at line 129 of file iozone.c.

char hflag

Definition at line 1303 of file iozone.c.

Definition at line 1300 of file iozone.c.

char imon_start[256]

Definition at line 1318 of file iozone.c.

char imon_stop[256]

Definition at line 1318 of file iozone.c.

char imon_sync

Definition at line 1319 of file iozone.c.

Definition at line 1519 of file iozone.c.

Definition at line 1519 of file iozone.c.

long long include_mask

Definition at line 1332 of file iozone.c.

long long include_test[50]

Definition at line 1331 of file iozone.c.

Definition at line 1329 of file iozone.c.

Definition at line 1293 of file iozone.c.

char jflag

Definition at line 1509 of file iozone.c.

int junk

Definition at line 1402 of file iozone.c.

char k_flag

Definition at line 1509 of file iozone.c.

Definition at line 1277 of file iozone.c.

char Kplus_flag

Definition at line 1509 of file iozone.c.

Definition at line 1506 of file iozone.c.

Definition at line 1459 of file iozone.c.

char L_flag = 0

Definition at line 1518 of file iozone.c.

int l_sock

Definition at line 1459 of file iozone.c.

char lflag

Definition at line 1329 of file iozone.c.

struct sockaddr_in listener_sync_sock

Definition at line 20343 of file iozone.c.

char * mainbuffer

Definition at line 1366 of file iozone.c.

Definition at line 1296 of file iozone.c.

Definition at line 1458 of file iozone.c.

Definition at line 1461 of file iozone.c.

Definition at line 1472 of file iozone.c.

Definition at line 1473 of file iozone.c.

char master_rcv_buf[4096]

Definition at line 1460 of file iozone.c.

Definition at line 1471 of file iozone.c.

char master_send_buf[4096]

Definition at line 1462 of file iozone.c.

Definition at line 1469 of file iozone.c.

Definition at line 1470 of file iozone.c.

off64_t max_file_size = (1024*512)

Definition at line 1379 of file iozone.c.

long long max_rec_size = ( (16*1024*1024) )

Definition at line 1381 of file iozone.c.

long long max_x

Definition at line 1275 of file iozone.c.

long long max_y

Definition at line 1275 of file iozone.c.

Definition at line 1356 of file iozone.c.

long long maxt

Definition at line 1324 of file iozone.c.

char * mbuffer

Definition at line 1366 of file iozone.c.

int mdebug = 0

Definition at line 1479 of file iozone.c.

char mfflag

Definition at line 1334 of file iozone.c.

char mflag

Definition at line 1509 of file iozone.c.

Definition at line 1378 of file iozone.c.

long long min_rec_size = 4096

Definition at line 1380 of file iozone.c.

Definition at line 1357 of file iozone.c.

long long mint

Definition at line 1324 of file iozone.c.

char mmap_mix

Definition at line 1512 of file iozone.c.

char mmapasflag

Definition at line 1512 of file iozone.c.

char mmapflag

Definition at line 1512 of file iozone.c.

char mmapnsflag

Definition at line 1512 of file iozone.c.

char mmapssflag

Definition at line 1512 of file iozone.c.

char mountname[1000]

Definition at line 1361 of file iozone.c.

char MS_flag

Definition at line 1525 of file iozone.c.

unsigned long long mt[312] [static]

Definition at line 23882 of file iozone.c.

int mti = 312 +1 [static]

Definition at line 23884 of file iozone.c.

long long multi_buffer

Definition at line 1290 of file iozone.c.

int multiplier = 2

Definition at line 1539 of file iozone.c.

int mygen

Definition at line 1524 of file iozone.c.

long long myid

Definition at line 1335 of file iozone.c.

int nap_once

Definition at line 19086 of file iozone.c.

double nap_res

Definition at line 19087 of file iozone.c.

FILE * newstderr

Definition at line 1475 of file iozone.c.

FILE* newstdin

Definition at line 1475 of file iozone.c.

FILE * newstdout

Definition at line 1475 of file iozone.c.

Definition at line 1340 of file iozone.c.

char nflag

Definition at line 1311 of file iozone.c.

Definition at line 1519 of file iozone.c.

int no_unlink = 0

Definition at line 1521 of file iozone.c.

int no_write = 0

Definition at line 1522 of file iozone.c.

Definition at line 1333 of file iozone.c.

char noretest

Definition at line 1510 of file iozone.c.

char notruncate

Definition at line 1511 of file iozone.c.

long long num_child

Definition at line 1335 of file iozone.c.

Definition at line 1293 of file iozone.c.

off64_t numrecs64 = (off64_t) ( 512 *1024) / 1024

Definition at line 1534 of file iozone.c.

char odsync = 0

Definition at line 1516 of file iozone.c.

Definition at line 1279 of file iozone.c.

Definition at line 1280 of file iozone.c.

char oflag

Definition at line 1509 of file iozone.c.

long long onetime

Definition at line 1290 of file iozone.c.

int op_rate

Definition at line 1301 of file iozone.c.

Definition at line 1302 of file iozone.c.

char OPS_flag

Definition at line 1517 of file iozone.c.

char* optarg
int optind
long long orig_max_rec_size = ( (16*1024*1024) )

Definition at line 1383 of file iozone.c.

long long orig_min_rec_size = 4096

Definition at line 1382 of file iozone.c.

long long orig_size

Definition at line 1274 of file iozone.c.

Definition at line 1338 of file iozone.c.

long long page_size = 4096

Definition at line 428 of file iozone.c.

unsigned int pattern

Definition at line 1531 of file iozone.c.

char* pbuffer

Definition at line 1368 of file iozone.c.

int pct_read

Definition at line 1336 of file iozone.c.

char pflag

Definition at line 1509 of file iozone.c.

FILE* pi

Definition at line 1367 of file iozone.c.

char pit_hostname[40]

Definition at line 1400 of file iozone.c.

char pit_service[8]

Definition at line 1401 of file iozone.c.

int proto_version = 25

Definition at line 1486 of file iozone.c.

long long* pstatus

Definition at line 1377 of file iozone.c.

long long purge

Definition at line 1533 of file iozone.c.

char Q_flag

Definition at line 1517 of file iozone.c.

char qflag

Definition at line 1312 of file iozone.c.

int r_count

Definition at line 1286 of file iozone.c.

Definition at line 1282 of file iozone.c.

Definition at line 1326 of file iozone.c.

FILE * r_traj_fd

Definition at line 1367 of file iozone.c.

Definition at line 1523 of file iozone.c.

long long r_traj_fsize

Definition at line 1325 of file iozone.c.

Definition at line 1328 of file iozone.c.

long long r_traj_ops

Definition at line 1325 of file iozone.c.

Definition at line 1326 of file iozone.c.

char read_sync

Definition at line 1295 of file iozone.c.

char read_traj_filename[1000]

Definition at line 1508 of file iozone.c.

long long rec_prob

Definition at line 1294 of file iozone.c.

Definition at line 1355 of file iozone.c.

long long reclen = 1024

Definition at line 1535 of file iozone.c.

char remote_shell[256]

Definition at line 1397 of file iozone.c.

off64_t report_array[100][512]

Definition at line 1269 of file iozone.c.

double report_darray[100][256]

Definition at line 1270 of file iozone.c.

long long res_prob

Definition at line 1294 of file iozone.c.

long long rest_val

Definition at line 1540 of file iozone.c.

int restf

Definition at line 1514 of file iozone.c.

long long ret

Definition at line 1346 of file iozone.c.

char rflag

Definition at line 1303 of file iozone.c.

char Rflag

Definition at line 1303 of file iozone.c.

int rlocking

Definition at line 1308 of file iozone.c.

char rol_opened

Definition at line 1341 of file iozone.c.

FILE * rqfd

Definition at line 1342 of file iozone.c.

FILE * rrqfd

Definition at line 1342 of file iozone.c.

struct runtime runtimes[100][512]

Definition at line 1330 of file iozone.c.

char RWONLYflag

Definition at line 1333 of file iozone.c.

FILE * rwqfd

Definition at line 1342 of file iozone.c.

int s_count

Definition at line 1286 of file iozone.c.

Definition at line 1283 of file iozone.c.

char sent_stop

Definition at line 1304 of file iozone.c.

char seq_mix

Definition at line 1322 of file iozone.c.

long long sfd

Definition at line 1290 of file iozone.c.

char sflag

Definition at line 1303 of file iozone.c.

Definition at line 1309 of file iozone.c.

Definition at line 1267 of file iozone.c.

char silent

Definition at line 1295 of file iozone.c.

struct size_entry* size_list = 0

Definition at line 1354 of file iozone.c.

char* sp_buf

Definition at line 22795 of file iozone.c.

struct sockaddr_in sp_child_sync_sock sp_child_async_sock

Definition at line 22793 of file iozone.c.

int sp_child_esend_port = ( 31000 +10)

Definition at line 22784 of file iozone.c.

int sp_child_listen_port = 31000

Definition at line 22783 of file iozone.c.

Definition at line 22798 of file iozone.c.

char sp_command[1024]

Definition at line 22796 of file iozone.c.

int sp_count

Definition at line 22799 of file iozone.c.

int sp_cret

Definition at line 22807 of file iozone.c.

int sp_crfd

Definition at line 1292 of file iozone.c.

int sp_csfd

Definition at line 1292 of file iozone.c.

char* sp_dest

Definition at line 22781 of file iozone.c.

Definition at line 22801 of file iozone.c.

char sp_location[256]

Definition at line 22810 of file iozone.c.

struct sockaddr_in sp_master_sync_sock sp_master_async_sock

Definition at line 22794 of file iozone.c.

int sp_master_esend_port = ( ( ( 31000 +10) +10) +10)

Definition at line 22787 of file iozone.c.

char sp_master_host[256]

Definition at line 22809 of file iozone.c.

int sp_master_listen_port = ( ( 31000 +10) +10)

Definition at line 22786 of file iozone.c.

int sp_master_results_port = ( ( ( ( 31000 +10) +10) +10) +10)

Definition at line 22789 of file iozone.c.

int sp_mrfd

Definition at line 1292 of file iozone.c.

int sp_msfd

Definition at line 1292 of file iozone.c.

int sp_msize

Definition at line 22799 of file iozone.c.

struct in_addr sp_my_cs_addr

Definition at line 22791 of file iozone.c.

struct in_addr sp_my_ms_addr

Definition at line 22792 of file iozone.c.

int sp_once

Definition at line 22799 of file iozone.c.

char sp_remote_host[256]

Definition at line 22808 of file iozone.c.

char sp_remote_shell[100]

Definition at line 22797 of file iozone.c.

double sp_start_time

Definition at line 22801 of file iozone.c.

int sp_tcount

Definition at line 22800 of file iozone.c.

Definition at line 1336 of file iozone.c.

void splash

Definition at line 1394 of file iozone.c.

Definition at line 1395 of file iozone.c.

long long status

Definition at line 1335 of file iozone.c.

char* stop_flag

Definition at line 1537 of file iozone.c.

char stoptime

Definition at line 1370 of file iozone.c.

long long stride = 17

Definition at line 1532 of file iozone.c.

Definition at line 1512 of file iozone.c.

char sverify = 1

Definition at line 1515 of file iozone.c.

int t_count = 0

Definition at line 1285 of file iozone.c.

int t_range[100]

Definition at line 1284 of file iozone.c.

double temp_time

Definition at line 1268 of file iozone.c.

char* test_output[]
Initial value:
 {"                ",
              "                  ",
              "                ",
              "        ",
              "        ",
              "        ",
              "                  ",
              "                ",
              "",
              "                 ",
              "                   ",
              "                   ",
              "                   ",
              "                   ",
              "                   ",
              "                   \n" }

Definition at line 1234 of file iozone.c.

long long test_soutput[] = {2,2,2,1,1,1,2,2,2,2,2,2,2,2}

Definition at line 1250 of file iozone.c.

char tfile[] = "iozone"

Definition at line 1365 of file iozone.c.

long long throughput_array[100]

Definition at line 1272 of file iozone.c.

Initial value:
 {"Initial write","Rewrite","Read","Re-read",
    "Reverse Read","Stride read","Random read","Mixed workload","Random write","Pwrite","Pread","Fwrite","Fread"}

Definition at line 1385 of file iozone.c.

double time_res

Definition at line 1271 of file iozone.c.

double total_kilos

Definition at line 1268 of file iozone.c.

double total_time

Definition at line 1268 of file iozone.c.

double totaltime

Definition at line 1268 of file iozone.c.

char toutput[20][20]

Definition at line 1476 of file iozone.c.

Definition at line 1477 of file iozone.c.

char trflag

Definition at line 1320 of file iozone.c.

char uflag

Definition at line 1329 of file iozone.c.

char Uflag

Definition at line 1329 of file iozone.c.

char unbuffered

Definition at line 1509 of file iozone.c.

char use_thread = 0

Definition at line 1372 of file iozone.c.

char verify = 1

Definition at line 1513 of file iozone.c.

Definition at line 1327 of file iozone.c.

FILE * w_traj_fd

Definition at line 1367 of file iozone.c.

Definition at line 1523 of file iozone.c.

long long w_traj_fsize

Definition at line 1325 of file iozone.c.

Definition at line 1328 of file iozone.c.

long long w_traj_ops

Definition at line 1325 of file iozone.c.

Definition at line 1327 of file iozone.c.

char wol_opened

Definition at line 1341 of file iozone.c.

FILE* wqfd

Definition at line 1342 of file iozone.c.

char write_traj_filename[1000]

Definition at line 1507 of file iozone.c.

long long x

Definition at line 1335 of file iozone.c.

char X_flag

Definition at line 1520 of file iozone.c.

char xflag

Definition at line 1520 of file iozone.c.

long long xover = (16*1024)

Definition at line 1384 of file iozone.c.

long long y

Definition at line 1335 of file iozone.c.

char yflag

Definition at line 1312 of file iozone.c.

char Z_flag

Definition at line 1520 of file iozone.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines