PAPI  5.7.0.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
 

Macros

#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 (long long 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}
 
VOLATILE struct child_statsshmaddr
 
double totaltime
 
double total_time
 
double temp_time
 
double total_kilos
 
off64_t report_array [MAX_X][MAX_Y]
 
double report_darray [MAX_X][MAXSTREAMS]
 
double time_res
 
double cputime_res
 
long long throughput_array [MAX_X]
 
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)KILOBYTES
 
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 [MAXSTREAMS]
 
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 [MAX_X][MAX_Y]
 
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 [MAXSTREAMS+1]
 
long long myid
 
long long num_child
 
int pct_read
 
int speed_code
 
pthread_t p_childids [MAXSTREAMS+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 [MAXNAMESIZE]
 
char filename [MAXNAMESIZE]
 
char mountname [MAXNAMESIZE]
 
char dummyfile [MAXSTREAMS][MAXNAMESIZE]
 
char dummyfile1 [MAXNAMESIZE]
 
char * filearray [MAXSTREAMS]
 
char tfile [] = "iozone"
 
char * buffer
 
char * buffer1
 
char * mbuffer
 
char * mainbuffer
 
FILE * pi
 
FILE * r_traj_fd
 
FILE * w_traj_fd
 
VOLATILE char * pbuffer
 
char * default_filename ="iozone.tmp"
 
VOLATILE char stoptime
 
char Cflag
 
char use_thread = 0
 
long long debug1 =0
 
long long debug =0
 
unsigned long cache_size =CACHE_SIZE
 
unsigned long cache_line_size =CACHE_LINE_SIZE
 
long long * pstatus
 
off64_t min_file_size = KILOBYTES_START
 
off64_t max_file_size = KILOBYTES_END
 
long long min_rec_size = RECLEN_START
 
long long max_rec_size = RECLEN_END
 
long long orig_min_rec_size = RECLEN_START
 
long long orig_max_rec_size = RECLEN_END
 
long long xover = CROSSOVER
 
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 = HOST_LIST_PORT
 
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 [MAXSTREAMS]
 
int master_send_async_sockets [MAXSTREAMS]
 
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 [MAXSTREAMS]
 
int Kplus_readers
 
char write_traj_filename [MAXNAMESIZE]
 
char read_traj_filename [MAXNAMESIZE]
 
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 = STRIDE
 
long long delay
 
long long purge
 
long long fetchon
 
off64_t numrecs64 = (off64_t)NUMRECS
 
long long reclen = RECLEN
 
long long delay_start
 
long long depth
 
VOLATILE char * stop_flag
 
float compute_time
 
int multiplier = MULTIPLIER
 
long long rest_val
 
int nap_once
 
double nap_res
 
struct sockaddr_in listener_sync_sock
 
char * sp_dest
 
int sp_child_listen_port = SP_CHILD_LISTEN_PORT
 
int sp_child_esend_port = SP_CHILD_ESEND_PORT
 
int sp_master_listen_port = SP_MASTER_LISTEN_PORT
 
int sp_master_esend_port = SP_MASTER_ESEND_PORT
 
int sp_master_results_port = SP_MASTER_RESULTS_PORT
 
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 [NN]
 
static int mti =NN+1
 
long long buckets [BUCKETS]
 
long long bucket_val [BUCKETS]
 

Macro Definition Documentation

◆ BUCKETS

#define BUCKETS   40

Definition at line 24211 of file iozone.c.

◆ C_STATE_WAIT_BARRIER

#define C_STATE_WAIT_BARRIER   3

Definition at line 1451 of file iozone.c.

◆ C_STATE_WAIT_WHO

#define C_STATE_WAIT_WHO   2

Definition at line 1450 of file iozone.c.

◆ C_STATE_ZERO

#define C_STATE_ZERO   1

Definition at line 1449 of file iozone.c.

◆ CACHE_LINE_SIZE

#define CACHE_LINE_SIZE   32

Definition at line 750 of file iozone.c.

◆ CACHE_SIZE

#define CACHE_SIZE   ( 1024 * 1024 )

Definition at line 751 of file iozone.c.

◆ CHILD_ALIST_PORT

#define CHILD_ALIST_PORT   (CHILD_LIST_PORT+MAXSTREAMS)

Definition at line 1419 of file iozone.c.

◆ CHILD_ESEND_PORT

#define CHILD_ESEND_PORT   (HOST_ASEND_PORT+MAXSTREAMS)

Definition at line 1415 of file iozone.c.

◆ CHILD_LIST_PORT

#define CHILD_LIST_PORT   (CHILD_ESEND_PORT+MAXSTREAMS)

Definition at line 1416 of file iozone.c.

◆ CHILD_STATE_BEGIN

#define CHILD_STATE_BEGIN   2

Definition at line 946 of file iozone.c.

◆ CHILD_STATE_DONE

#define CHILD_STATE_DONE   3

Definition at line 948 of file iozone.c.

◆ CHILD_STATE_HOLD

#define CHILD_STATE_HOLD   0

Definition at line 942 of file iozone.c.

◆ CHILD_STATE_READY

#define CHILD_STATE_READY   1

Definition at line 944 of file iozone.c.

◆ CONTROL_STRING1

#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.

◆ CONTROL_STRING2

#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.

◆ CONTROL_STRING3

#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.

◆ CONTROL_STRING4

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

Definition at line 879 of file iozone.c.

◆ cputime_so_far

#define cputime_so_far ( )    time_so_far()

Definition at line 973 of file iozone.c.

◆ CROSSOVER

#define CROSSOVER   (16*1024)

Definition at line 807 of file iozone.c.

◆ DEDUPSEED

#define DEDUPSEED   0x2719362

Definition at line 449 of file iozone.c.

◆ DFLT_SERVICE

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

Definition at line 24038 of file iozone.c.

◆ DISRUPT

#define DISRUPT   100

Definition at line 779 of file iozone.c.

◆ FILESIZE

#define FILESIZE   (KILOBYTES*1024)

Definition at line 795 of file iozone.c.

◆ FREADER_MASK

#define FREADER_MASK   (1 << FREADER_TEST)

Definition at line 928 of file iozone.c.

◆ FREADER_TEST

#define FREADER_TEST   7

Definition at line 909 of file iozone.c.

◆ FWRITER_MASK

#define FWRITER_MASK   (1 << FWRITER_TEST)

Definition at line 927 of file iozone.c.

◆ FWRITER_TEST

#define FWRITER_TEST   6

Definition at line 908 of file iozone.c.

◆ HOST_ASEND_PORT

#define HOST_ASEND_PORT   (HOST_ESEND_PORT+MAXSTREAMS)

Definition at line 1409 of file iozone.c.

◆ HOST_ESEND_PORT

#define HOST_ESEND_PORT   (HOST_LIST_PORT+MAXSTREAMS)

Definition at line 1408 of file iozone.c.

◆ HOST_LIST_PORT

#define HOST_LIST_PORT   20000

Definition at line 1407 of file iozone.c.

◆ I_CREAT

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

Definition at line 1184 of file iozone.c.

◆ I_FOPEN

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

Definition at line 1185 of file iozone.c.

◆ I_LSEEK

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

Definition at line 1182 of file iozone.c.

◆ I_MMAP

#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.

◆ I_OPEN

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

Definition at line 1183 of file iozone.c.

◆ I_STAT

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

Definition at line 1186 of file iozone.c.

◆ IBUFSIZE

#define IBUFSIZE   100

Definition at line 775 of file iozone.c.

◆ INVALID_DESC

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

Definition at line 24039 of file iozone.c.

◆ KILOBYTES

#define KILOBYTES   512

Definition at line 789 of file iozone.c.

◆ KILOBYTES_END

#define KILOBYTES_END   (1024*512)

Definition at line 891 of file iozone.c.

◆ KILOBYTES_START

#define KILOBYTES_START   64

Definition at line 889 of file iozone.c.

◆ LARGE_REC

#define LARGE_REC   65536

Definition at line 786 of file iozone.c.

◆ LM

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

Definition at line 23878 of file iozone.c.

◆ MAP_FAILED

#define MAP_FAILED   -1

Definition at line 336 of file iozone.c.

◆ MATRIX_A

#define MATRIX_A   0xB5026F5AA96619E9ULL

Definition at line 23876 of file iozone.c.

◆ MAX_X

#define MAX_X   100

Definition at line 825 of file iozone.c.

◆ MAX_Y

#define MAX_Y   512

Definition at line 827 of file iozone.c.

◆ MAXBFRSIZE

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

Definition at line 24040 of file iozone.c.

◆ MAXBUFFERSIZE

#define MAXBUFFERSIZE   (16*1024*1024)

Definition at line 809 of file iozone.c.

◆ MAXNAMESIZE

#define MAXNAMESIZE   1000

Definition at line 833 of file iozone.c.

◆ MAXSTREAMS

#define MAXSTREAMS   256

Definition at line 813 of file iozone.c.

◆ MAXTESTS

#define MAXTESTS   12

Definition at line 820 of file iozone.c.

◆ MEG

#define MEG   (1024 * 1024)

Definition at line 754 of file iozone.c.

◆ MERSENNE

#define MERSENNE

Definition at line 950 of file iozone.c.

◆ MINBUFFERSIZE

#define MINBUFFERSIZE   128

Definition at line 816 of file iozone.c.

◆ MM

#define MM   156

Definition at line 23875 of file iozone.c.

◆ MODE

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

Definition at line 88 of file iozone.c.

◆ MULTIPLIER

#define MULTIPLIER   2

Definition at line 897 of file iozone.c.

◆ NN

#define NN   312

Definition at line 23874 of file iozone.c.

◆ NUMRECS

#define NUMRECS   FILESIZE/RECLEN

Definition at line 798 of file iozone.c.

◆ PATTERN

#define PATTERN   get_pattern();

Definition at line 822 of file iozone.c.

◆ PATTERN1

#define PATTERN1   0xBB

Definition at line 823 of file iozone.c.

◆ R_CHILD_JOIN

#define R_CHILD_JOIN   1

Definition at line 731 of file iozone.c.

◆ R_DEATH

#define R_DEATH   7

Definition at line 744 of file iozone.c.

◆ R_FLAG_DATA

#define R_FLAG_DATA   3

Definition at line 733 of file iozone.c.

◆ R_JOIN_ACK

#define R_JOIN_ACK   4

Definition at line 741 of file iozone.c.

◆ R_STAT_DATA

#define R_STAT_DATA   2

Definition at line 732 of file iozone.c.

◆ R_STOP_FLAG

#define R_STOP_FLAG   5

Definition at line 742 of file iozone.c.

◆ R_TERMINATE

#define R_TERMINATE   6

Definition at line 743 of file iozone.c.

◆ RANDOM_MIX_MASK

#define RANDOM_MIX_MASK   (1 << RANDOM_MIX_TEST)

Definition at line 923 of file iozone.c.

◆ RANDOM_MIX_TEST

#define RANDOM_MIX_TEST   8

Definition at line 910 of file iozone.c.

◆ RANDOM_RW_MASK

#define RANDOM_RW_MASK   (1 << RANDOM_RW_TEST)

Definition at line 922 of file iozone.c.

◆ RANDOM_RW_TEST

#define RANDOM_RW_TEST   2

Definition at line 904 of file iozone.c.

◆ READER_MASK

#define READER_MASK   (1 << READER_TEST)

Definition at line 921 of file iozone.c.

◆ READER_TEST

#define READER_TEST   1

Definition at line 903 of file iozone.c.

◆ RECLEN

#define RECLEN   1024

Definition at line 792 of file iozone.c.

◆ RECLEN_END

#define RECLEN_END   (MAXBUFFERSIZE)

Definition at line 895 of file iozone.c.

◆ RECLEN_START

#define RECLEN_START   4096

Definition at line 893 of file iozone.c.

◆ REVERSE_MASK

#define REVERSE_MASK   (1 << REVERSE_TEST)

Definition at line 924 of file iozone.c.

◆ REVERSE_TEST

#define REVERSE_TEST   3

Definition at line 905 of file iozone.c.

◆ REWRITE_REC_MASK

#define REWRITE_REC_MASK   (1 << REWRITE_REC_TEST)

Definition at line 925 of file iozone.c.

◆ REWRITE_REC_TEST

#define REWRITE_REC_TEST   4

Definition at line 906 of file iozone.c.

◆ SHMSIZE

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

Definition at line 1263 of file iozone.c.

◆ SP_CHILD_ESEND_PORT

#define SP_CHILD_ESEND_PORT   (SP_CHILD_LISTEN_PORT+10)

Definition at line 1423 of file iozone.c.

◆ SP_CHILD_LISTEN_PORT

#define SP_CHILD_LISTEN_PORT   31000

Definition at line 1422 of file iozone.c.

◆ SP_MASTER_ESEND_PORT

#define SP_MASTER_ESEND_PORT   (SP_MASTER_LISTEN_PORT+10)

Definition at line 1425 of file iozone.c.

◆ SP_MASTER_LISTEN_PORT

#define SP_MASTER_LISTEN_PORT   (SP_CHILD_ESEND_PORT+10)

Definition at line 1424 of file iozone.c.

◆ SP_MASTER_RESULTS_PORT

#define SP_MASTER_RESULTS_PORT   (SP_MASTER_ESEND_PORT+10)

Definition at line 1426 of file iozone.c.

◆ STRIDE

#define STRIDE   17

Definition at line 760 of file iozone.c.

◆ STRIDE_READ_MASK

#define STRIDE_READ_MASK   (1 << STRIDE_READ_TEST)

Definition at line 926 of file iozone.c.

◆ STRIDE_READ_TEST

#define STRIDE_READ_TEST   5

Definition at line 907 of file iozone.c.

◆ THISVERSION

#define THISVERSION   " Version $Revision$"

Definition at line 63 of file iozone.c.

◆ THREAD_CLEANUP_TEST

#define THREAD_CLEANUP_TEST   14

Definition at line 1442 of file iozone.c.

◆ THREAD_FREAD_TEST

#define THREAD_FREAD_TEST   13

Definition at line 1441 of file iozone.c.

◆ THREAD_FWRITE_TEST

#define THREAD_FWRITE_TEST   12

Definition at line 1440 of file iozone.c.

◆ THREAD_PREAD_TEST

#define THREAD_PREAD_TEST   11

Definition at line 1439 of file iozone.c.

◆ THREAD_PWRITE_TEST

#define THREAD_PWRITE_TEST   10

Definition at line 1438 of file iozone.c.

◆ THREAD_RANDOM_MIX_TEST

#define THREAD_RANDOM_MIX_TEST   9

Definition at line 1437 of file iozone.c.

◆ THREAD_RANDOM_READ_TEST

#define THREAD_RANDOM_READ_TEST   6

Definition at line 1434 of file iozone.c.

◆ THREAD_RANDOM_WRITE_TEST

#define THREAD_RANDOM_WRITE_TEST   7

Definition at line 1435 of file iozone.c.

◆ THREAD_READ_TEST

#define THREAD_READ_TEST   3

Definition at line 1431 of file iozone.c.

◆ THREAD_REREAD_TEST

#define THREAD_REREAD_TEST   4

Definition at line 1432 of file iozone.c.

◆ THREAD_REVERSE_READ_TEST

#define THREAD_REVERSE_READ_TEST   8

Definition at line 1436 of file iozone.c.

◆ THREAD_REWRITE_TEST

#define THREAD_REWRITE_TEST   2

Definition at line 1430 of file iozone.c.

◆ THREAD_STRIDE_TEST

#define THREAD_STRIDE_TEST   5

Definition at line 1433 of file iozone.c.

◆ THREAD_WRITE_TEST

#define THREAD_WRITE_TEST   1

Definition at line 1429 of file iozone.c.

◆ TOOFAST

#define TOOFAST   10

Definition at line 818 of file iozone.c.

◆ UM

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

Definition at line 23877 of file iozone.c.

◆ USAGE

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

Definition at line 829 of file iozone.c.

◆ VOLATILE

#define VOLATILE

Definition at line 395 of file iozone.c.

◆ WRITER_MASK

#define WRITER_MASK   (1 << WRITER_TEST)

Definition at line 920 of file iozone.c.

◆ WRITER_TEST

#define WRITER_TEST   0

Definition at line 902 of file iozone.c.

Typedef Documentation

◆ off64_t

typedef long long off64_t

Definition at line 357 of file iozone.c.

◆ sockaddr_in6_t

typedef struct sockaddr_in6 sockaddr_in6_t

Definition at line 24052 of file iozone.c.

◆ sockaddr_in_t

typedef struct sockaddr_in sockaddr_in_t

Definition at line 24051 of file iozone.c.

Enumeration Type Documentation

◆ boolean

enum boolean
Enumerator
false 
true 

Definition at line 24049 of file iozone.c.

24049 { false = 0, true } boolean;
boolean
Definition: iozone.c:24049

Function Documentation

◆ add_file_size() [1/2]

void add_file_size ( )
Here is the caller graph for this function:

◆ add_file_size() [2/2]

void add_file_size ( off64_t  size)

Definition at line 20032 of file iozone.c.

20035 {
20036  struct size_entry *size_listp;
20037  struct size_entry *nsize_list;
20038 
20039  size_listp=size_list;
20040 
20041  if(size_list)
20042  {
20043  if(size_listp->next)
20044  while(size_listp->next!=0)
20045  size_listp=size_listp->next;
20046  }
20047  nsize_list=(struct size_entry *)malloc(sizeof(struct size_entry));
20048  if(nsize_list==0)
20049  {
20050  printf("Malloc failed in add_file_size\n");
20051  exit(180);
20052  }
20053  nsize_list->next=0;
20054  nsize_list->size=size;
20055  if(size_list == 0)
20056  size_list=nsize_list;
20057  else
20058  size_listp->next=nsize_list;
20059  size_listp=size_list;
20060 }
Definition: iozone.c:1350
struct size_entry * size_list
Definition: iozone.c:1354
off64_t size
Definition: iozone.c:1352
struct size_entry * next
Definition: iozone.c:1351
void exit()
Here is the call graph for this function:

◆ add_record_size() [1/2]

void add_record_size ( )
Here is the caller graph for this function:

◆ add_record_size() [2/2]

void add_record_size ( off64_t  size)

Definition at line 20155 of file iozone.c.

20158 {
20159  struct size_entry *size_listp;
20160  struct size_entry *nsize_list;
20161 
20162  size_listp=rec_size_list;
20163 
20164  if(rec_size_list)
20165  {
20166  if(size_listp->next)
20167  while(size_listp->next!=0)
20168  size_listp=size_listp->next;
20169  }
20170  nsize_list=(struct size_entry *)malloc(sizeof(struct size_entry));
20171  if(nsize_list==0)
20172  {
20173  printf("Malloc failed in add_file_size\n");
20174  exit(180);
20175  }
20176  nsize_list->next=0;
20177  nsize_list->size=size;
20178  if(rec_size_list == 0)
20179  rec_size_list=nsize_list;
20180  else
20181  size_listp->next=nsize_list;
20182  size_listp=rec_size_list;
20183 }
Definition: iozone.c:1350
struct size_entry * rec_size_list
Definition: iozone.c:1355
off64_t size
Definition: iozone.c:1352
struct size_entry * next
Definition: iozone.c:1351
void exit()
Here is the call graph for this function:

◆ alloc_mem() [1/2]

char* alloc_mem ( )
Here is the caller graph for this function:

◆ alloc_mem() [2/2]

char* alloc_mem ( long long  size,
int  shared_flag 
)

Definition at line 12022 of file iozone.c.

12026 {
12027  long long size1;
12028  char *addr,*dumb;
12029  int shmid;
12030  int tfd;
12031  long long tmp;
12032 #if defined(solaris)
12033  char mmapFileName[]="mmap_tmp_XXXXXX";
12034 #endif
12035 
12036  tmp = 0;
12037  dumb = (char *)0;
12038  tfd=0;
12039  size1=l_max(size,page_size);
12040  if(!distributed)
12041  {
12042  if(!trflag)
12043  {
12044  addr=(char *)malloc((size_t)size1);
12045  return(addr);
12046  }
12047  if(use_thread)
12048  {
12049  addr=(char *)malloc((size_t)size1);
12050  return(addr);
12051  }
12052  }
12053  if(!shared_flag)
12054  {
12055  addr=(char *)malloc((size_t)size1);
12056  return(addr);
12057  }
12058 #ifdef SHARED_MEM
12059  size1=l_max(size,page_size);
12060  size1=(size1 +page_size) & ~(page_size-1);
12061  shmid=(int)shmget((key_t)(IPC_PRIVATE), (size_t)size1 , (int)(IPC_CREAT|0666));
12062  if(shmid < (int)0)
12063  {
12064  printf("\nUnable to get shared memory segment(shmget)\n");
12065 #ifdef NO_PRINT_LLD
12066  printf("shmid = %d, size = %ld, size1 = %lu, Error %d\n",shmid,size,(size_t)size1,errno);
12067 #else
12068  printf("shmid = %d, size = %lld, size1 = %lu, Error %d\n",shmid,size,(unsigned long)size1,errno);
12069 #endif
12070  exit(119);
12071  }
12072  /*addr = (char *)shmat(shmid, 0, SHM_W);*/
12073  /* Some systems will not take the above but
12074  * will default to read/write if no flags
12075  * are provided. (AIX)
12076  * The POSIX standard states that if SHM_RDONLY
12077  * is not specified then it will be read/write.
12078  */
12079  addr = (char *)shmat((int)shmid, 0, 0);
12080 #ifdef _64BIT_ARCH_
12081  if((long long)addr == (long long)-1)
12082 #else
12083  if((long)addr == (long)-1)
12084 #endif
12085  {
12086  printf("\nUnable to get shared memory segment\n");
12087  printf("..Error %d\n",errno);
12088  exit(120);
12089  }
12090  shmctl(shmid, IPC_RMID, 0);
12091  return(addr);
12092 #else
12093 
12094  size1=l_max(size,page_size);
12095  size1=(size1 +page_size) & ~(page_size-1);
12096 #if defined(bsd4_2) && !defined(macosx)
12097  if((tfd = creat("mmap.tmp", 0666))<0)
12098  {
12099  printf("Unable to create tmp file\n");
12100  exit(121);
12101  }
12102  addr=(char *)mmap(0,&size1,PROT_WRITE|PROT_READ,
12103  MAP_ANON|MAP_SHARED, tfd, 0);
12104  unlink("mmap.tmp");
12105 #else
12106 
12107 
12108 #if defined(solaris)
12109  tfd=mkstemp(mmapFileName);
12110  if(tfd < 0)
12111  {
12112  printf("Unable to create tmp file\n");
12113  exit(121);
12114  }
12115  dumb=(char *)malloc((size_t)size1);
12116  bzero(dumb,size1);
12117  write(tfd,dumb,size1);
12118  free(dumb);
12119  addr=(char *)mmap(0,(size_t)size1,PROT_WRITE|PROT_READ,
12120  MAP_SHARED, tfd, 0);
12121  unlink(mmapFileName);
12122 #else
12123 #if defined(SCO) || defined(SCO_Unixware_gcc) || defined(Windows)
12124  char mmapFileName[]="mmap_tmp_XXXXXX";
12125  tfd=mkstemp(mmapFileName);
12126  if(tfd < 0)
12127  {
12128  printf("Unable to create tmp file\n");
12129  exit(121);
12130  }
12131  dumb=(char *)malloc((size_t)size1);
12132  bzero(dumb,size1);
12133  write(tfd,dumb,size1);
12134  free(dumb);
12135  addr=(char *)mmap(0,(size_t)size1,PROT_WRITE|PROT_READ,
12136  MAP_SHARED, tfd, 0);
12137  unlink(mmapFileName);
12138 #else
12139  addr=(char *)mmap(0,(size_t)size1,PROT_WRITE|PROT_READ,
12140  MAP_ANONYMOUS|MAP_SHARED, -1, 0);
12141 #endif
12142 #endif
12143 #endif
12144  if((char *)addr == (char *)-1)
12145  {
12146  printf("\nUnable to get memory segment\n");
12147  printf("Error %d\n",errno);
12148  exit(122);
12149  }
12150  if(debug1)
12151  printf("Got shared memory for size %d\n",size1);
12152 
12153  return(addr);
12154 #endif
12155 }
void bzero()
char trflag
Definition: iozone.c:1320
double tmp
char distributed
Definition: iozone.c:1296
char use_thread
Definition: iozone.c:1372
long long debug1
Definition: iozone.c:1373
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
long long page_size
Definition: iozone.c:428
off64_t size
Definition: iozone.c:1352
long long l_max()
int unlink()
void exit()
int errno
Here is the call graph for this function:

◆ alloc_pbuf()

alloc_pbuf ( void  )

Definition at line 23620 of file iozone.c.

23622 {
23623  pbuffer = (char *) alloc_mem((long long)(3 * cache_size),(int)0);
23624  if(pbuffer == 0) {
23625  perror("Memory allocation failed:");
23626  exit(9);
23627  }
23628 #ifdef _64BIT_ARCH_
23629  pbuffer = (char *)
23630  (((unsigned long long)pbuffer + cache_size )
23631  & ~(cache_size-1));
23632 #else
23633  pbuffer = (char *)
23634  (((long)pbuffer + (long)cache_size )
23635  & ~((long)cache_size-1));
23636 #endif
23637 }
VOLATILE char * pbuffer
Definition: iozone.c:1368
char * alloc_mem()
void exit()
unsigned long cache_size
Definition: iozone.c:1375
Here is the call graph for this function:
Here is the caller graph for this function:

◆ async_init()

void async_init ( )

Definition at line 19044 of file iozone.c.

19045 {
19046  printf("Your system does not support async I/O\n");
19047  exit(172);
19048 }
void exit()
Here is the call graph for this function:

◆ async_read()

int async_read ( )

Definition at line 19026 of file iozone.c.

19027 {
19028  printf("Your system does not support async I/O\n");
19029  exit(169);
19030 }
void exit()
Here is the call graph for this function:

◆ async_read_no_copy()

int async_read_no_copy ( )

Definition at line 19050 of file iozone.c.

19051 {
19052  printf("Your system does not support async I/O\n");
19053  exit(172);
19054 }
void exit()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ async_release()

void async_release ( )

Definition at line 19056 of file iozone.c.

19057 {
19058  printf("Your system does not support async I/O\n");
19059  exit(173);
19060 }
void exit()
Here is the call graph for this function:

◆ async_write()

size_t async_write ( )

Definition at line 19038 of file iozone.c.

19039 {
19040  printf("Your system does not support async I/O\n");
19041  exit(171);
19042 }
void exit()
Here is the call graph for this function:

◆ async_write_no_copy()

size_t async_write_no_copy ( )

Definition at line 19032 of file iozone.c.

19033 {
19034  printf("Your system does not support async I/O\n");
19035  exit(170);
19036 }
void exit()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atoi()

int atoi ( )
Here is the caller graph for this function:

◆ auto_test()

void auto_test ( )

Definition at line 3404 of file iozone.c.

3406 {
3407  off64_t kilosi;
3408  long long recszi,count1;
3409  long long mult;
3410  long long xx;
3411 
3412  /****************************************************************/
3413  /* Start with file size of 1 megabyte and repeat the test */
3414  /* KILOBYTES_ITER_LIMIT */
3415  /* times. Each time we run, the file size is doubled */
3416  /****************************************************************/
3417 /*
3418  if(sflag) {
3419  min_file_size = kilobytes64;
3420  max_file_size = kilobytes64;
3421  }
3422  if(rflag) {
3423  min_rec_size = reclen;
3424  max_rec_size = reclen;
3425  }
3426 */
3427  if(gflag)
3429  if(nflag)
3431 
3432  if (min_rec_size > (long long)(min_file_size*1024)) {
3433 #ifdef NO_PRINT_LLD
3434  printf("Error: record length %ld is greater than filesize %ld KB\n ",
3436 #else
3437  printf("Error: record length %lld is greater than filesize %lld KB\n ",
3439 #endif
3440  exit(23);
3441  }
3442 
3444 
3446  del_record_sizes();
3450 
3451  for(kilosi=get_next_file_size((off64_t)0); kilosi>0; kilosi=get_next_file_size(kilosi))
3452  {
3453  /****************************************************************/
3454  /* Start with record size of min_rec_size bytes and repeat the */
3455  /* test, multiplying the record size by MULTIPLIER each time, */
3456  /* until we reach max_rec_size. At the CROSSOVER we stop doing */
3457  /* small buffers as it takes forever and becomes very */
3458  /* un-interesting. */
3459  /****************************************************************/
3460  if(!rflag && !sflag && !yflag && !qflag)
3461  if(kilosi > xover){
3463  mult = orig_min_rec_size/1024;
3464  del_record_sizes();
3466  /************************************/
3467  /* Generate dummy entries in the */
3468  /* Excel buffer for skipped */
3469  /* record sizes */
3470  /************************************/
3471  for(count1=min_rec_size;
3472  (count1 != orig_min_rec_size) && (
3473  mult <= (kilosi*1024)) ;
3474  count1=(count1>>1))
3475  {
3476  current_x=0;
3477  store_value((off64_t)kilosi);
3478  store_value((off64_t)mult);
3479  for(xx=0;xx<20;xx++)
3480  store_value((off64_t)0);
3481  mult=mult*2;
3482  current_y++;
3483  if(current_y>max_y)
3484  max_y=current_y;
3485  current_x=0;
3486  }
3487  }
3488 
3489  for (recszi=get_next_record_size((off64_t)0);recszi!=0;recszi=get_next_record_size(recszi))
3490  {
3491  if(recszi > (kilosi*1024))
3492  break;
3493  begin(kilosi, recszi );
3494  current_x=0;
3495  current_y++;
3496  }
3497  }
3498 }
long long orig_max_rec_size
Definition: iozone.c:1383
long long xover
Definition: iozone.c:1384
store_value(off64_t value)
Definition: iozone.c:11518
char sflag
Definition: iozone.c:1303
off64_t get_next_file_size()
char rflag
Definition: iozone.c:1303
long long max_y
Definition: iozone.c:1275
char nflag
Definition: iozone.c:1311
off64_t get_next_record_size()
void del_record_sizes()
Definition: iozone.c:20128
char gflag
Definition: iozone.c:1311
off64_t maximum_file_size
Definition: iozone.c:1356
char NOCROSSflag
Definition: iozone.c:1333
char qflag
Definition: iozone.c:1312
off64_t minimum_file_size
Definition: iozone.c:1357
short current_x
Definition: iozone.c:1273
#define LARGE_REC
Definition: iozone.c:786
void init_record_sizes()
void init_file_sizes()
char yflag
Definition: iozone.c:1312
long long min_rec_size
Definition: iozone.c:1380
off64_t min_file_size
Definition: iozone.c:1378
long long max_rec_size
Definition: iozone.c:1381
off64_t max_file_size
Definition: iozone.c:1379
void exit()
long long off64_t
Definition: iozone.c:357
void begin()
long long orig_min_rec_size
Definition: iozone.c:1382
short current_y
Definition: iozone.c:1273
Here is the call graph for this function:
Here is the caller graph for this function:

◆ become_client()

void become_client ( )

Definition at line 21555 of file iozone.c.

21557 {
21558  int x,testnum;
21559  struct master_command mc;
21560  struct client_command cc;
21561  struct client_neutral_command *cnc;
21562  char client_name[100];
21563  char *workdir;
21564 
21565  bzero(&mc,sizeof(struct master_command));
21566  x=fork(); /* Become a daemon so that remote shell will return. */
21567  if(x != 0)
21568  exit(0);
21569  /*
21570  * I am the child
21571  */
21572  (void)gethostname(client_name,100);
21573 
21574  fflush(stdout);
21575  fflush(stderr);
21576  if(cdebug)
21577  {
21578  newstdin=freopen("/tmp/don_in","r+",stdin);
21579  newstdout=freopen("/tmp/don_out","a+",stdout);
21580  newstderr=freopen("/tmp/don_err","a+",stderr);
21581  }
21582  else
21583  {
21584  fclose(stdin);
21585  fclose(stdout);
21586  fclose(stderr);
21587  }
21588  if(cdebug>=1)
21589  {
21590  fprintf(newstdout,"My name = %s, Controller's name = %s\n",client_name, controlling_host_name);
21591  fflush(newstdout);
21592  }
21593 
21594  /* 1. Start client receive channel */
21595 
21598 
21599  /* 2. Send message to controller saying I'm joining. */
21600 
21601  strcpy(mc.m_host_name,controlling_host_name);
21602  strcpy(mc.m_client_name,client_name);
21603  mc.m_child_port = child_port;
21604  mc.m_child_async_port = child_async_port;
21605  mc.m_command = R_CHILD_JOIN;
21606  mc.m_version = proto_version;
21607 
21608  if(cdebug)
21609  {
21610  fprintf(newstdout,"Child %s sends JOIN to master %s Host Port %d\n",
21612  fflush(newstdout);
21613  }
21614  child_send(controlling_host_name,(struct master_command *)&mc, sizeof(struct master_command));
21615 
21618 
21619  /* 4. Go into a loop and get all instructions from */
21620  /* the controlling process. */
21621 
21622  if(cdebug>=1)
21623  {
21624  fprintf(newstdout,"Child %s waiting for who am I\n",client_name);
21625  fflush(newstdout);
21626  }
21627  child_listen(l_sock,sizeof(struct client_neutral_command));
21628  cnc = (struct client_neutral_command *)&child_rcv_buf;
21629  bzero(&cc, sizeof(struct client_command));
21630 
21631  /* Convert from string format to arch format */
21632  sscanf(cnc->c_command,"%d",&cc.c_command);
21633  sscanf(cnc->c_client_name,"%s",cc.c_client_name);
21634  sscanf(cnc->c_client_number,"%d",&cc.c_client_number);
21635  sscanf(cnc->c_host_name,"%s",cc.c_host_name);
21636  sscanf(cnc->c_pit_hostname,"%s",cc.c_pit_hostname);
21637 
21638  if(cc.c_command == R_TERMINATE || cc.c_command==R_DEATH)
21639  {
21640  if(cdebug)
21641  {
21642  fprintf(newstdout,"Child %d received terminate on sync channel !!\n",(int)chid);
21643  fflush(newstdout);
21644  }
21645  exit(1);
21646  }
21647 
21648  if(cdebug)
21649  {
21650  fprintf(newstdout,"Child sees: \n Client name %s \n Client_num # %d \n Host_name %s\n"
21651  ,cc.c_client_name,cc.c_client_number,cc.c_host_name);
21652  fflush(newstdout);
21653  }
21654 
21655  /*
21656  * Now import all of the values of the flags that the child on this
21657  * machine needs to be able to run the test requested.
21658  */
21659 
21660  /* 5. Get state information from the master */
21661 
21662 #ifdef NO_PRINT_LLD
21663  sscanf(cnc->c_numrecs64,"%ld",&cc.c_numrecs64);
21664  sscanf(cnc->c_reclen,"%ld",&cc.c_reclen);
21665  sscanf(cnc->c_fetchon,"%ld",&cc.c_fetchon);
21666  sscanf(cnc->c_purge,"%ld",&cc.c_purge);
21667  sscanf(cnc->c_delay,"%ld",&cc.c_delay);
21668  sscanf(cnc->c_stride,"%ld",&cc.c_stride);
21669  sscanf(cnc->c_rest_val,"%ld",&cc.c_rest_val);
21670  sscanf(cnc->c_delay_start,"%ld",&cc.c_delay_start);
21671  sscanf(cnc->c_depth,"%ld",&cc.c_depth);
21672 #else
21673  sscanf(cnc->c_numrecs64,"%lld",&cc.c_numrecs64);
21674  sscanf(cnc->c_reclen,"%lld",&cc.c_reclen);
21675  sscanf(cnc->c_fetchon,"%lld",&cc.c_fetchon);
21676  sscanf(cnc->c_purge,"%lld",&cc.c_purge);
21677  sscanf(cnc->c_delay,"%lld",&cc.c_delay);
21678  sscanf(cnc->c_stride,"%lld",&cc.c_stride);
21679  sscanf(cnc->c_rest_val,"%lld",&cc.c_rest_val);
21680  sscanf(cnc->c_delay_start,"%lld",&cc.c_delay_start);
21681  sscanf(cnc->c_depth,"%lld",&cc.c_depth);
21682 #endif
21683  sscanf(cnc->c_pit_hostname,"%s",cc.c_pit_hostname);
21684  sscanf(cnc->c_pit_service,"%s",cc.c_pit_service);
21685  sscanf(cnc->c_testnum,"%d",&cc.c_testnum);
21686  sscanf(cnc->c_client_number,"%d",&cc.c_client_number);
21687  sscanf(cnc->c_working_dir,"%s",cc.c_working_dir);
21688  sscanf(cnc->c_file_name,"%s",cc.c_file_name);
21689  sscanf(cnc->c_write_traj_filename,"%s",cc.c_write_traj_filename);
21690  sscanf(cnc->c_read_traj_filename,"%s",cc.c_read_traj_filename);
21691  sscanf(cnc->c_noretest,"%d",&cc.c_noretest);
21692  sscanf(cnc->c_notruncate,"%d",&cc.c_notruncate);
21693  sscanf(cnc->c_read_sync,"%d",&cc.c_read_sync);
21694  sscanf(cnc->c_jflag,"%d",&cc.c_jflag);
21695  sscanf(cnc->c_direct_flag,"%d",&cc.c_direct_flag);
21696  sscanf(cnc->c_cpuutilflag,"%d",&cc.c_cpuutilflag);
21697  sscanf(cnc->c_seq_mix,"%d",&cc.c_seq_mix);
21698  sscanf(cnc->c_async_flag,"%d",&cc.c_async_flag);
21699  sscanf(cnc->c_k_flag,"%d",&cc.c_k_flag);
21700  sscanf(cnc->c_h_flag,"%d",&cc.c_h_flag);
21701  sscanf(cnc->c_mflag,"%d",&cc.c_mflag);
21702  sscanf(cnc->c_pflag,"%d",&cc.c_pflag);
21703  sscanf(cnc->c_stride_flag,"%d",&cc.c_stride_flag);
21704  sscanf(cnc->c_verify,"%d",&cc.c_verify);
21705  sscanf(cnc->c_sverify,"%d",&cc.c_sverify);
21706  sscanf(cnc->c_odsync,"%d",&cc.c_odsync);
21707  sscanf(cnc->c_diag_v,"%d",&cc.c_diag_v);
21708  sscanf(cnc->c_dedup,"%d",&cc.c_dedup);
21709  sscanf(cnc->c_dedup_interior,"%d",&cc.c_dedup_interior);
21710  sscanf(cnc->c_dedup_compress,"%d",&cc.c_dedup_compress);
21711  sscanf(cnc->c_dedup_mseed,"%d",&cc.c_dedup_mseed);
21712  sscanf(cnc->c_hist_summary,"%d",&cc.c_hist_summary);
21713  sscanf(cnc->c_op_rate,"%d",&cc.c_op_rate);
21714  sscanf(cnc->c_op_rate_flag,"%d",&cc.c_op_rate_flag);
21715  sscanf(cnc->c_file_lock,"%d",&cc.c_file_lock);
21716  sscanf(cnc->c_rec_lock,"%d",&cc.c_rec_lock);
21717  sscanf(cnc->c_Kplus_readers,"%d",&cc.c_Kplus_readers);
21718  sscanf(cnc->c_multiplier,"%d",&cc.c_multiplier);
21719  sscanf(cnc->c_share_file,"%d",&cc.c_share_file);
21720  sscanf(cnc->c_pattern,"%d",&cc.c_pattern);
21721  sscanf(cnc->c_version,"%d",&cc.c_version);
21722  sscanf(cnc->c_base_time,"%d",&cc.c_base_time);
21723  sscanf(cnc->c_num_child,"%d",&cc.c_num_child);
21724  sscanf(cnc->c_pct_read,"%d",&cc.c_pct_read);
21725  sscanf(cnc->c_advise_op,"%d",&cc.c_advise_op);
21726  sscanf(cnc->c_advise_flag,"%d",&cc.c_advise_flag);
21727  sscanf(cnc->c_restf,"%d",&cc.c_restf);
21728  sscanf(cnc->c_mygen,"%d",&cc.c_mygen);
21729  sscanf(cnc->c_oflag,"%d",&cc.c_oflag);
21730  sscanf(cnc->c_mfflag,"%d",&cc.c_mfflag);
21731  sscanf(cnc->c_unbuffered,"%d",&cc.c_unbuffered);
21732  sscanf(cnc->c_Q_flag,"%d",&cc.c_Q_flag);
21733  sscanf(cnc->c_L_flag,"%d",&cc.c_L_flag);
21734  sscanf(cnc->c_xflag,"%d",&cc.c_xflag);
21735  sscanf(cnc->c_include_flush,"%d",&cc.c_include_flush);
21736  sscanf(cnc->c_OPS_flag,"%d",&cc.c_OPS_flag);
21737  sscanf(cnc->c_mmapflag,"%d",&cc.c_mmapflag);
21738  sscanf(cnc->c_mmapasflag,"%d",&cc.c_mmapasflag);
21739  sscanf(cnc->c_mmapnsflag,"%d",&cc.c_mmapnsflag);
21740  sscanf(cnc->c_mmapssflag,"%d",&cc.c_mmapssflag);
21741  sscanf(cnc->c_no_copy_flag,"%d",&cc.c_no_copy_flag);
21742  sscanf(cnc->c_w_traj_flag,"%d",&cc.c_w_traj_flag);
21743  sscanf(cnc->c_r_traj_flag,"%d",&cc.c_r_traj_flag);
21744  sscanf(cnc->c_no_unlink,"%d",&cc.c_no_unlink);
21745  sscanf(cnc->c_no_write,"%d",&cc.c_no_write);
21746  sscanf(cnc->c_include_close,"%d",&cc.c_include_close);
21747  sscanf(cnc->c_disrupt_flag,"%d",&cc.c_disrupt_flag);
21748  sscanf(cnc->c_compute_flag,"%d",&cc.c_compute_flag);
21749  sscanf(cnc->c_MS_flag,"%d",&cc.c_MS_flag);
21750  sscanf(cnc->c_mmap_mix,"%d",&cc.c_mmap_mix);
21751  sscanf(cnc->c_Kplus_flag,"%d",&cc.c_Kplus_flag);
21752  sscanf(cnc->c_compute_time,"%f",&cc.c_compute_time);
21753 
21754  strcpy(write_traj_filename,cc.c_write_traj_filename);
21755  strcpy(read_traj_filename,cc.c_read_traj_filename);
21756  numrecs64 = cc.c_numrecs64;
21757  strcpy(pit_hostname,cc.c_pit_hostname);
21758  strcpy(pit_service,cc.c_pit_service);
21759  reclen = cc.c_reclen;
21760  testnum = cc.c_testnum;
21761  chid = cc.c_client_number;
21762  workdir=cc.c_working_dir;
21763  oflag = cc.c_oflag;
21764  /* Child's absolute filename to use is provided */
21765  mfflag = cc.c_mfflag;
21766  if(mfflag)
21767  strcpy(filearray[chid],cc.c_file_name);
21768  if(cdebug)
21769  {
21770  fprintf(newstdout,"File name given %s\n",cc.c_file_name);
21771  fflush(newstdout);
21772  }
21773  unbuffered = cc.c_unbuffered;
21774  noretest = cc.c_noretest;
21775  notruncate = cc.c_notruncate;
21776  read_sync = cc.c_read_sync;
21777  jflag = cc.c_jflag;
21778  direct_flag = cc.c_direct_flag;
21779  cpuutilflag = cc.c_cpuutilflag;
21780  seq_mix = cc.c_seq_mix;
21781  async_flag = cc.c_async_flag;
21782  k_flag = cc.c_k_flag;
21783  h_flag = cc.c_h_flag;
21784  mflag = cc.c_mflag;
21785  pflag = cc.c_pflag;
21786  stride_flag = cc.c_stride_flag;
21787  fetchon = cc.c_fetchon;
21788  verify = cc.c_verify;
21789  diag_v = cc.c_diag_v;
21790  dedup = cc.c_dedup;
21791  dedup_interior = cc.c_dedup_interior;
21792  dedup_compress = cc.c_dedup_compress;
21793  dedup_mseed = cc.c_dedup_mseed;
21794  hist_summary = cc.c_hist_summary;
21795  op_rate = cc.c_op_rate;
21796  op_rate_flag = cc.c_op_rate_flag;
21797  if(diag_v)
21798  sverify = 0;
21799  else
21800  sverify = cc.c_sverify;
21801  file_lock = cc.c_file_lock;
21802  rlocking = cc.c_rec_lock;
21803  Kplus_readers = cc.c_Kplus_readers;
21804  multiplier = cc.c_multiplier;
21805  share_file = cc.c_share_file;
21806  pattern = cc.c_pattern;
21807  /* proto_version = cc.c_version; Don't copy it back. */
21808  base_time=cc.c_base_time;
21809  num_child=(long long)cc.c_num_child;
21810  pct_read=cc.c_pct_read;
21811  advise_op=cc.c_advise_op;
21812  advise_flag=cc.c_advise_flag;
21813  restf=cc.c_restf;
21814  mygen=cc.c_mygen;
21815  Q_flag = cc.c_Q_flag;
21816  L_flag = cc.c_L_flag;
21817  xflag = cc.c_xflag;
21818  w_traj_flag = cc.c_w_traj_flag;
21819  r_traj_flag = cc.c_r_traj_flag;
21820  include_flush = cc.c_include_flush;
21821  OPS_flag = cc.c_OPS_flag;
21822  purge = cc.c_purge;
21823  mmapflag = cc.c_mmapflag;
21824  mmapasflag = cc.c_mmapasflag;
21825  mmapnsflag = cc.c_mmapnsflag;
21826  mmapssflag = cc.c_mmapssflag;
21827  no_copy_flag = cc.c_no_copy_flag;
21828  no_unlink = cc.c_no_unlink;
21829  no_write = cc.c_no_write;
21830  include_close = cc.c_include_close;
21831  disrupt_flag = cc.c_disrupt_flag;
21832  compute_flag = cc.c_compute_flag;
21833  MS_flag = cc.c_MS_flag;
21834  mmap_mix = cc.c_mmap_mix;
21835  Kplus_flag = cc.c_Kplus_flag;
21836  delay = cc.c_delay;
21837  stride = cc.c_stride;
21838  rest_val = cc.c_rest_val;
21839  depth = cc.c_depth;
21840  delay_start = cc.c_delay_start;
21841  compute_time = cc.c_compute_time;
21842  if(cdebug)
21843  {
21844  fprintf(newstdout,"Child %d change directory to %s\n",(int)chid,workdir);
21845  fflush(newstdout);
21846  }
21847  if(purge)
21848  alloc_pbuf();
21849 
21850  /* 6. Change to the working directory */
21851 
21852  if(chdir(workdir)<0)
21854  start_child_listen_loop(); /* The async channel listener */
21855 
21856  /* Need to start this after getting into the correct directory */
21857  if(w_traj_flag)
21858  w_traj_size();
21859  if(r_traj_flag)
21860  r_traj_size();
21861 
21862  get_resolution(); /* Get my clock resolution */
21863  if(hist_summary)
21864  {
21865  printf("Child got HISTORY flag\n");
21866  }
21867 
21868  /* 7. Run the test */
21869  switch(testnum) {
21870 
21871  case THREAD_WRITE_TEST :
21872  if(cdebug>=1)
21873  {
21874  fprintf(newstdout,"Child %d running thread_write_test\n",(int)chid);
21875  fflush(newstdout);
21876  }
21877  thread_write_test((long)0);
21878  break;
21879 #ifdef HAVE_PREAD
21880  case THREAD_PWRITE_TEST :
21881  if(cdebug>=1)
21882  {
21883  fprintf(newstdout,"Child %d running thread_pwrite_test\n",(int)chid);
21884  fflush(newstdout);
21885  }
21886  thread_pwrite_test((long)0);
21887  break;
21888 #endif
21889  case THREAD_REWRITE_TEST :
21890  if(cdebug>=1)
21891  {
21892  fprintf(newstdout,"Child %d running thread_rewrite_test\n",(int)chid);
21893  fflush(newstdout);
21894  }
21895  thread_rwrite_test((long)0);
21896  break;
21897  case THREAD_READ_TEST :
21898  if(cdebug>=1)
21899  {
21900  fprintf(newstdout,"Child %d running thread_read_test\n",(int)chid);
21901  fflush(newstdout);
21902  }
21903  thread_read_test((long)0);
21904  break;
21905 #ifdef HAVE_PREAD
21906  case THREAD_PREAD_TEST :
21907  if(cdebug>=1)
21908  {
21909  fprintf(newstdout,"Child %d running thread_read_test\n",(int)chid);
21910  fflush(newstdout);
21911  }
21912  thread_pread_test((long)0);
21913  break;
21914 #endif
21915  case THREAD_REREAD_TEST :
21916  if(cdebug>=1)
21917  {
21918  fprintf(newstdout,"Child %d running thread_reread_test\n",(int)chid);
21919  fflush(newstdout);
21920  }
21921  thread_rread_test((long)0);
21922  break;
21923  case THREAD_STRIDE_TEST :
21924  if(cdebug>=1)
21925  {
21926  fprintf(newstdout,"Child %d running thread_stride_read_test\n",(int)chid);
21927  fflush(newstdout);
21928  }
21929  thread_stride_read_test((long)0);
21930  break;
21931  case THREAD_RANDOM_READ_TEST :
21932  if(cdebug>=1)
21933  {
21934  fprintf(newstdout,"Child %d running random read test\n",(int)chid);
21935  fflush(newstdout);
21936  }
21937  thread_ranread_test((long)0);
21938  break;
21939  case THREAD_RANDOM_WRITE_TEST :
21940  if(cdebug>=1)
21941  {
21942  fprintf(newstdout,"Child %d running random write test\n",(int)chid);
21943  fflush(newstdout);
21944  }
21945  thread_ranwrite_test((long)0);
21946  break;
21947  case THREAD_REVERSE_READ_TEST :
21948  if(cdebug>=1)
21949  {
21950  fprintf(newstdout,"Child %d running reverse read test\n",(int)chid);
21951  fflush(newstdout);
21952  }
21953  thread_reverse_read_test((long)0);
21954  break;
21955  case THREAD_RANDOM_MIX_TEST :
21956  if(cdebug>=1)
21957  {
21958  fprintf(newstdout,"Child %d running mixed workload test\n",(int)chid);
21959  fflush(newstdout);
21960  }
21961  thread_mix_test((long)0);
21962  break;
21963  case THREAD_FWRITE_TEST :
21964  if(cdebug>=1)
21965  {
21966  fprintf(newstdout,"Child %d running thread_fwrite_test\n",(int)chid);
21967  fflush(newstdout);
21968  }
21969  thread_fwrite_test((long)0);
21970  break;
21971  case THREAD_FREAD_TEST :
21972  if(cdebug>=1)
21973  {
21974  fprintf(newstdout,"Child %d running thread_fread_test\n",(int)chid);
21975  fflush(newstdout);
21976  }
21977  thread_fread_test((long)0);
21978  break;
21979  case THREAD_CLEANUP_TEST :
21980  if(cdebug>=1)
21981  {
21982  fprintf(newstdout,"Child %d running cleanup\n",(int)chid);
21983  fflush(newstdout);
21984  }
21985  thread_cleanup_test((long)0);
21986  break;
21987  };
21988  if(cdebug>=1)
21989  {
21990  fprintf(newstdout,"Child %d finished running test.\n",(int)chid);
21991  fflush(newstdout);
21992  }
21993 
21994  /* 8. Release the listen and send sockets to the master */
21996 
21997  exit(0);
21998 }
long long depth
Definition: iozone.c:1536
char c_dedup_compress[4]
Definition: iozone.c:619
char pit_hostname[40]
Definition: iozone.c:1400
char c_r_traj_flag[2]
Definition: iozone.c:642
int w_traj_flag
Definition: iozone.c:1523
char compute_flag
Definition: iozone.c:1520
char diag_v
Definition: iozone.c:1304
int controlling_host_port
Definition: iozone.c:1410
void *() thread_rread_test()
char controlling_host_name[100]
Definition: iozone.c:1493
char verify
Definition: iozone.c:1513
char Kplus_flag
Definition: iozone.c:1509
long long stride
Definition: iozone.c:1532
char c_version[20]
Definition: iozone.c:661
char c_testnum[20]
Definition: iozone.c:657
char c_advise_flag[4]
Definition: iozone.c:666
void *() thread_reverse_read_test()
int no_unlink
Definition: iozone.c:1521
#define THREAD_PWRITE_TEST
Definition: iozone.c:1438
void bzero()
int no_write
Definition: iozone.c:1522
void *() thread_fread_test()
char c_mmapasflag[2]
Definition: iozone.c:628
FILE * newstdin
Definition: iozone.c:1475
char c_mmapssflag[2]
Definition: iozone.c:630
char c_no_copy_flag[2]
Definition: iozone.c:631
char mmapflag
Definition: iozone.c:1512
char k_flag
Definition: iozone.c:1509
char child_rcv_buf[4096]
Definition: iozone.c:1463
int child_async_port
Definition: iozone.c:1456
void *() thread_stride_read_test()
char dedup_compress
Definition: iozone.c:1304
char c_num_child[20]
Definition: iozone.c:663
#define THREAD_PREAD_TEST
Definition: iozone.c:1439
#define THREAD_RANDOM_WRITE_TEST
Definition: iozone.c:1435
int restf
Definition: iozone.c:1514
void *() thread_fwrite_test()
void *() thread_rwrite_test()
char c_Kplus_readers[10]
Definition: iozone.c:654
char c_hist_summary[4]
Definition: iozone.c:621
void child_send()
long long w_traj_size()
Definition: iozone.c:19825
int advise_op
Definition: iozone.c:1526
char stride_flag
Definition: iozone.c:1512
#define THREAD_REREAD_TEST
Definition: iozone.c:1432
#define THREAD_WRITE_TEST
Definition: iozone.c:1429
int dedup_mseed
Definition: iozone.c:1299
#define THREAD_FREAD_TEST
Definition: iozone.c:1441
#define R_DEATH
Definition: iozone.c:744
char disrupt_flag
Definition: iozone.c:1520
int advise_flag
Definition: iozone.c:1526
char c_op_rate_flag[2]
Definition: iozone.c:623
char c_host_name[100]
Definition: iozone.c:590
int l_async_sock
Definition: iozone.c:1459
char c_cpuutilflag[2]
Definition: iozone.c:644
char c_compute_time[80]
Definition: iozone.c:675
long long reclen
Definition: iozone.c:1535
char c_notruncate[2]
Definition: iozone.c:604
char c_base_time[20]
Definition: iozone.c:662
char c_numrecs64[80]
Definition: iozone.c:672
char read_sync
Definition: iozone.c:1295
char c_rest_val[10]
Definition: iozone.c:647
char c_compute_flag[2]
Definition: iozone.c:635
int op_rate
Definition: iozone.c:1301
void *() thread_ranread_test()
char c_read_traj_filename[200]
Definition: iozone.c:599
float compute_time
Definition: iozone.c:1538
FILE * newstderr
Definition: iozone.c:1475
#define THREAD_RANDOM_READ_TEST
Definition: iozone.c:1434
char c_working_dir[200]
Definition: iozone.c:594
long base_time
Definition: iozone.c:1323
#define THREAD_REVERSE_READ_TEST
Definition: iozone.c:1436
char c_pattern[20]
Definition: iozone.c:660
char c_fetchon[10]
Definition: iozone.c:649
#define R_TERMINATE
Definition: iozone.c:743
char noretest
Definition: iozone.c:1510
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
void *() thread_ranwrite_test()
char include_flush
Definition: iozone.c:1519
char c_command[20]
Definition: iozone.c:656
char sverify
Definition: iozone.c:1515
long long delay_start
Definition: iozone.c:1536
int multiplier
Definition: iozone.c:1539
char unbuffered
Definition: iozone.c:1509
char jflag
Definition: iozone.c:1509
int l_sock
Definition: iozone.c:1459
char c_include_flush[2]
Definition: iozone.c:633
long long delay
Definition: iozone.c:1533
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char mmapasflag
Definition: iozone.c:1512
char c_async_flag[2]
Definition: iozone.c:607
char c_disrupt_flag[2]
Definition: iozone.c:634
char c_file_lock[10]
Definition: iozone.c:652
int pct_read
Definition: iozone.c:1336
void get_resolution()
Definition: iozone.c:19131
int cdebug
Definition: iozone.c:1478
void alloc_pbuf()
Definition: iozone.c:23620
int op_rate_flag
Definition: iozone.c:1302
char c_client_number[20]
Definition: iozone.c:655
char c_stride_flag[2]
Definition: iozone.c:612
char dedup
Definition: iozone.c:1304
long long num_child
Definition: iozone.c:1335
char c_dedup_interior[4]
Definition: iozone.c:618
long long chid
Definition: iozone.c:1529
void *() thread_mix_test()
char c_mmapnsflag[2]
Definition: iozone.c:629
char L_flag
Definition: iozone.c:1518
#define THREAD_RANDOM_MIX_TEST
Definition: iozone.c:1437
char c_client_name[100]
Definition: iozone.c:593
char c_file_name[200]
Definition: iozone.c:595
void start_child_listen_loop()
Definition: iozone.c:22287
char c_w_traj_flag[2]
Definition: iozone.c:641
char mfflag
Definition: iozone.c:1334
#define THREAD_FWRITE_TEST
Definition: iozone.c:1440
long long x
Definition: iozone.c:1335
char c_share_file[10]
Definition: iozone.c:651
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
off64_t numrecs64
Definition: iozone.c:1534
char notruncate
Definition: iozone.c:1511
#define THREAD_CLEANUP_TEST
Definition: iozone.c:1442
char mmapssflag
Definition: iozone.c:1512
int share_file
Definition: iozone.c:1309
char write_traj_filename[MAXNAMESIZE]
Definition: iozone.c:1507
char dedup_interior
Definition: iozone.c:1304
int child_port
Definition: iozone.c:1455
long long fetchon
Definition: iozone.c:1533
char c_dedup_mseed[4]
Definition: iozone.c:620
void stop_child_listen()
char c_write_traj_filename[200]
Definition: iozone.c:598
char pflag
Definition: iozone.c:1509
unsigned int pattern
Definition: iozone.c:1531
char xflag
Definition: iozone.c:1520
char c_pit_service[8]
Definition: iozone.c:592
char mflag
Definition: iozone.c:1509
FILE * newstdout
Definition: iozone.c:1475
char oflag
Definition: iozone.c:1509
char c_rec_lock[10]
Definition: iozone.c:653
int proto_version
Definition: iozone.c:1486
void child_listen()
void *() thread_read_test()
#define THREAD_READ_TEST
Definition: iozone.c:1431
#define THREAD_REWRITE_TEST
Definition: iozone.c:1430
int r_traj_flag
Definition: iozone.c:1523
void *() thread_write_test()
char c_pit_hostname[40]
Definition: iozone.c:591
void r_traj_size()
Definition: iozone.c:19732
char h_flag
Definition: iozone.c:1509
char seq_mix
Definition: iozone.c:1322
char read_traj_filename[MAXNAMESIZE]
Definition: iozone.c:1508
char Q_flag
Definition: iozone.c:1517
char pit_service[8]
Definition: iozone.c:1401
char no_copy_flag
Definition: iozone.c:1519
char c_direct_flag[2]
Definition: iozone.c:643
char include_close
Definition: iozone.c:1519
int start_child_listen()
char OPS_flag
Definition: iozone.c:1517
#define THREAD_STRIDE_TEST
Definition: iozone.c:1433
void *() thread_cleanup_test()
char c_unbuffered[2]
Definition: iozone.c:602
char c_delay_start[80]
Definition: iozone.c:674
int mygen
Definition: iozone.c:1524
int client_error
Definition: iozone.c:1398
void exit()
int rlocking
Definition: iozone.c:1308
char c_multiplier[10]
Definition: iozone.c:650
int child_attach(int s, int flag)
Definition: iozone.c:20831
char c_include_close[2]
Definition: iozone.c:632
char mmapnsflag
Definition: iozone.c:1512
char c_Kplus_flag[2]
Definition: iozone.c:640
int start_child_listen_async()
long long rest_val
Definition: iozone.c:1540
int Kplus_readers
Definition: iozone.c:1506
char mmap_mix
Definition: iozone.c:1512
int errno
#define R_CHILD_JOIN
Definition: iozone.c:731
int direct_flag
Definition: iozone.c:1527
int hist_summary
Definition: iozone.c:1300
Here is the call graph for this function:
Here is the caller graph for this function:

◆ begin() [1/2]

void begin ( )
Here is the caller graph for this function:

◆ begin() [2/2]

void begin ( off64_t  kilos64,
long long  reclength 
)

Definition at line 3179 of file iozone.c.

3183 {
3184  long long num_tests,test_num,i,j;
3185  long long data1[MAXTESTS], data2[MAXTESTS];
3186  num_tests = sizeof(func)/sizeof(char *);
3187 #if defined(HAVE_PREAD)
3188  if(!Eflag)
3189  {
3190 #if defined(HAVE_PREAD) && defined(HAVE_PREADV)
3191  num_tests -= 4;
3192 #else
3193  num_tests -= 2;
3194 #endif
3195  if(mmapflag || async_flag)
3196  {
3197  num_tests -= 2;
3198  }
3199  }
3200  else
3201  {
3202  if(mmapflag || async_flag)
3203 #if defined(HAVE_PREAD) && defined(HAVE_PREADV)
3204  num_tests -= 6;
3205 #else
3206  num_tests -= 4;
3207 #endif
3208  }
3209 #else
3210  if(mmapflag || async_flag)
3211  {
3212  num_tests -= 2;
3213  }
3214 #endif
3215 
3216  if(RWONLYflag) num_tests = 2; /* kcollins 8-21-96*/
3217  sync(); /* just in case there were some dirty */
3218  sync();
3219  kilobytes64=kilos64;
3220  reclen=reclength;
3221  numrecs64 = (kilobytes64*1024)/reclen;
3223  if(r_traj_flag || w_traj_flag)
3224  store_value((off64_t)0);
3225  else
3226  store_value((off64_t)(reclen/1024));
3227 
3228 #ifdef NO_PRINT_LLD
3229  if(!silent) printf("%16ld",kilobytes64);
3230  if(r_traj_flag || w_traj_flag)
3231  {
3232  if(!silent) printf("%8ld",0);
3233  }
3234  else
3235  {
3236  if(!silent) printf("%8ld",reclen/1024);
3237  }
3238 #else
3239  if(!silent) printf("%16lld",kilobytes64);
3240  if(r_traj_flag || w_traj_flag)
3241  {
3242  if(!silent) printf("%8lld",(long long )0);
3243  }
3244  else
3245  {
3246  if(!silent) printf("%8lld",reclen/1024);
3247  }
3248 #endif
3249  if(include_tflag)
3250  {
3251  for(i=0;i<num_tests;i++)
3252  {
3253  if(include_mask & (long long)(1<<i))
3254  func[i](kilobytes64,reclen,&data1[i],&data2[i]);
3255  else
3256  {
3257  if(!silent) printf("%s",test_output[i]);
3258  fflush(stdout);
3259  for(j=0;j<test_soutput[i];j++)
3260  store_value((off64_t)0);
3261  }
3262  }
3263  }
3264  else
3265  {
3266  for(test_num=0;test_num < num_tests;test_num++)
3267  {
3268  func[test_num](kilobytes64,reclen,&data1[test_num],&data2[test_num]);
3269  };
3270  }
3271  if(!silent) printf("\n");
3272  if(!OPS_flag && !include_tflag){ /* Report in ops/sec ? */
3273  if(data1[1]!=0 && data2[1] != 0)
3274  {
3275  totaltime = data1[1] + data1[0];
3276  if (totaltime < TOOFAST)
3277  {
3279  printf("\nThe test completed too quickly to give a good result\n");
3280  printf("You will get a more precise measure of this machine's\n");
3281  printf("performance by re-running iozone using the command:\n");
3282 #ifdef NO_PRINT_LLD
3283  printf("\n\tiozone %ld ", goodkilos);
3284  printf("\t(i.e., file size = %ld kilobytes64)\n", goodkilos);
3285 #else
3286  printf("\n\tiozone %lld ", goodkilos);
3287  printf("\t(i.e., file size = %lld kilobytes64)\n", goodkilos);
3288 #endif
3289  }
3290  } else {
3291  goodrecl = reclen/2;
3292  printf("\nI/O error during read. Try again with the command:\n");
3293 #ifdef NO_PRINT_LLD
3294  printf("\n\tiozone %ld %ld ", kilobytes64, goodrecl);
3295  printf("\t(i.e. record size = %ld bytes)\n", goodrecl);
3296 #else
3297  printf("\n\tiozone %lld %lld ", kilobytes64, goodrecl);
3298  printf("\t(i.e. record size = %lld bytes)\n", goodrecl);
3299 #endif
3300  }
3301  }
3302  if (!no_unlink)
3303  {
3305  unlink(filename); /* delete the file */
3306  }
3307  /*stop timer*/
3308  return ;
3309 }
int check_filename()
char * test_output[]
Definition: iozone.c:1234
int w_traj_flag
Definition: iozone.c:1523
store_value(off64_t value)
Definition: iozone.c:11518
int no_unlink
Definition: iozone.c:1521
char mmapflag
Definition: iozone.c:1512
#define TOOFAST
Definition: iozone.c:818
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
long long reclen
Definition: iozone.c:1535
void(* func[])()
Definition: iozone.c:1198
char include_tflag
Definition: iozone.c:1329
char Eflag
Definition: iozone.c:1303
char async_flag
Definition: iozone.c:1512
unsigned long long goodkilos
Definition: iozone.c:1276
long long include_mask
Definition: iozone.c:1332
double totaltime
Definition: iozone.c:1268
long long test_soutput[]
Definition: iozone.c:1250
int num_tests
Definition: zero_fork.c:53
off64_t numrecs64
Definition: iozone.c:1534
off64_t kilobytes64
Definition: iozone.c:1277
int r_traj_flag
Definition: iozone.c:1523
char silent
Definition: iozone.c:1295
#define MAXTESTS
Definition: iozone.c:820
long long goodrecl
Definition: iozone.c:1278
char RWONLYflag
Definition: iozone.c:1333
char OPS_flag
Definition: iozone.c:1517
int unlink()
long long off64_t
Definition: iozone.c:357
int i
Definition: fileop.c:140
Here is the call graph for this function:

◆ check_filename() [1/2]

int check_filename ( )
Here is the caller graph for this function:

◆ check_filename() [2/2]

check_filename ( char *  name)

Definition at line 23647 of file iozone.c.

23650 {
23651 #ifdef _LARGEFILE64_SOURCE
23652  struct stat64 mystat;
23653 #else
23654  struct stat mystat;
23655 #endif
23656  int x;
23657  if(strlen(name)==0)
23658  return(0);
23659  /* Lets try stat first.. may get an error if file is too big */
23660  x=I_STAT(name,&mystat);
23661  if(x<0)
23662  {
23663  return(0);
23664  /* printf("Stat failed %d\n",x); */
23665  }
23666  if(mystat.st_mode & S_IFREG)
23667  {
23668  /*printf("Is a regular file\n");*/
23669  return(1);
23670  }
23671  return(0);
23672 }
static const char * name
Definition: fork_overflow.c:31
#define I_STAT(x, y)
Definition: iozone.c:1186
long long x
Definition: iozone.c:1335

◆ child_attach()

int child_attach ( int  s,
int  flag 
)

Definition at line 20831 of file iozone.c.

20834 {
20835  unsigned int me;
20836  int ns;
20837  struct sockaddr_in *addr;
20838  if(flag)
20839  {
20840  addr=&child_async_sock;
20841  if(cdebug)
20842  {
20843  fprintf(newstdout,"Child %d attach async\n",(int)chid);
20844  fflush(newstdout);
20845  }
20846  }
20847  else
20848  {
20849  addr=&child_sync_sock;
20850  if(cdebug)
20851  {
20852  fprintf(newstdout,"Child %d attach sync\n",(int)chid);
20853  fflush(newstdout);
20854  }
20855  }
20856  me=sizeof(struct sockaddr_in);
20857  if(cdebug)
20858  {
20859  printf("Child %d enters listen\n",(int)chid);
20860  fflush(stdout);
20861  }
20862  listen(s,10);
20863  if(cdebug)
20864  {
20865  fprintf(newstdout,"Child %d enters accept\n",(int)chid);
20866  fflush(newstdout);
20867  }
20868  ns=accept(s,(void *)addr,&me);
20869  if(cdebug)
20870  {
20871  fprintf(newstdout,"Child %d attached for receive. Sock %d %d\n",
20872  (int)chid, ns,errno);
20873  fflush(newstdout);
20874  }
20875  return(ns);
20876 }
int cdebug
Definition: iozone.c:1478
double s
Definition: byte_profile.c:36
long long chid
Definition: iozone.c:1529
FILE * newstdout
Definition: iozone.c:1475
struct sockaddr_in child_sync_sock child_async_sock
Definition: iozone.c:1481
int errno
Here is the caller graph for this function:

◆ child_listen() [1/2]

void child_listen ( )
Here is the caller graph for this function:

◆ child_listen() [2/2]

void child_listen ( int  sock,
int  size_of_message 
)

Definition at line 20888 of file iozone.c.

20891 {
20892  int tsize;
20893  int rcvd;
20894  int s;
20895  int rc;
20896  char *cnc;
20897 
20898  cnc = (char *)&child_rcv_buf[0];
20899  bzero(cnc, sizeof(child_rcv_buf));
20900  s = sock;
20901  tsize=size_of_message; /* Number of messages to receive */
20902  rcvd = 0;
20903  while(rcvd < tsize)
20904  {
20905  if(cdebug ==1)
20906  {
20907  fprintf(newstdout,"Child %d In recieve \n",(int)chid);
20908  fflush(newstdout);
20909  }
20910  rc=read(s,cnc,size_of_message);
20911  if(rc < 0)
20912  {
20913  fprintf(newstdout,"Read failed. Errno %d \n",errno);
20914  fflush(newstdout);
20915  exit(21);
20916  }
20917  if(cdebug >= 1)
20918  {
20919  fprintf(newstdout,"Child %d: Got %d bytes\n",(int)chid, rc);
20920  fflush(newstdout);
20921  }
20922  rcvd+=rc;
20923  cnc+=rc;
20924  }
20925  if(cdebug >= 1)
20926  {
20927  fprintf(newstdout,"Child %d: return from listen\n",(int)chid);
20928  fflush(newstdout);
20929  }
20930 }
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
rc
Definition: pscanf.h:23
void bzero()
char child_rcv_buf[4096]
Definition: iozone.c:1463
int cdebug
Definition: iozone.c:1478
double s
Definition: byte_profile.c:36
long long chid
Definition: iozone.c:1529
FILE * newstdout
Definition: iozone.c:1475
void exit()
int errno
Here is the call graph for this function:

◆ child_listen_async() [1/2]

void child_listen_async ( )
Here is the caller graph for this function:

◆ child_listen_async() [2/2]

void child_listen_async ( int  sock,
int  size_of_message 
)

Definition at line 21010 of file iozone.c.

21013 {
21014  int tsize;
21015  int rcvd;
21016  int s;
21017  int rc;
21018  char *cnc;
21019 
21020  cnc = &child_async_rcv_buf[0];
21021  s = sock;
21022  tsize=size_of_message; /* Number of messages to receive */
21023  rcvd = 0;
21024  while(rcvd < tsize)
21025  {
21026  if(cdebug ==1)
21027  {
21028  fprintf(newstdout,"Child %d In async recieve \n",(int)chid);
21029  fflush(newstdout);
21030  }
21031  rc=read(s,cnc,size_of_message);
21032  if(rc < 0)
21033  {
21034  fprintf(newstdout,"Read failed. Errno %d \n",errno);
21035  fflush(newstdout);
21036  exit(21);
21037  }
21038  /* Special case. If master gets final results, it can
21039  exit, and close the connection to the async child
21040  too quickly. When this happens the child gets a
21041  read() that returns 0. It just needs to exit here.
21042  */
21043  if(rc==0)
21044  exit(0);
21045  if(cdebug >= 1)
21046  {
21047  fprintf(newstdout,"Child %d: Got %d bytes (async) \n",(int)chid,rc);
21048  fflush(newstdout);
21049  }
21050  rcvd+=rc;
21051  cnc+=rc;
21052  }
21053  if(cdebug >= 1)
21054  {
21055  fprintf(newstdout,"Child %d: return from async listen\n",(int)chid);
21056  fflush(newstdout);
21057  }
21058 }
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
rc
Definition: pscanf.h:23
int cdebug
Definition: iozone.c:1478
double s
Definition: byte_profile.c:36
long long chid
Definition: iozone.c:1529
FILE * newstdout
Definition: iozone.c:1475
char child_async_rcv_buf[4096]
Definition: iozone.c:1464
void exit()
int errno
Here is the call graph for this function:

◆ child_remove_files() [1/2]

void child_remove_files ( )
Here is the caller graph for this function:

◆ child_remove_files() [2/2]

void child_remove_files ( int  i)

Definition at line 22504 of file iozone.c.

22507 {
22508 
22509  char *dummyfile[MAXSTREAMS]; /* name of dummy file */
22510  dummyfile[i]=(char *)malloc((size_t)MAXNAMESIZE);
22511  if(mfflag)
22512  {
22513  sprintf(dummyfile[i],"%s",filearray[i]);
22514  }
22515  else
22516  {
22517  sprintf(dummyfile[i],"%s.DUMMY.%d",filearray[i],i);
22518  }
22519  if(cdebug)
22520  {
22521  fprintf(newstdout,"Child %d remove: %s \n",(int)chid, dummyfile[i]);
22522  fflush(newstdout);
22523  }
22524  if(check_filename(dummyfile[i]))
22525  unlink(dummyfile[i]);
22526 }
int check_filename()
#define MAXNAMESIZE
Definition: iozone.c:833
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
int cdebug
Definition: iozone.c:1478
long long chid
Definition: iozone.c:1529
char mfflag
Definition: iozone.c:1334
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
FILE * newstdout
Definition: iozone.c:1475
int unlink()
#define MAXSTREAMS
Definition: iozone.c:813
int i
Definition: fileop.c:140
Here is the call graph for this function:

◆ child_send() [1/2]

void child_send ( )
Here is the caller graph for this function:

◆ child_send() [2/2]

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

Definition at line 20406 of file iozone.c.

20411 {
20412 
20413  int rc,child_socket_val;
20414  struct hostent *he;
20415  int tmp_port;
20416  struct in_addr *ip;
20417  struct sockaddr_in cs_addr,cs_raddr;
20418  struct master_neutral_command outbuf;
20419  struct timespec req,rem;
20420 
20421  req.tv_sec = 0;
20422  req.tv_nsec = 10000000;
20423  rem.tv_sec = 0;
20424  rem.tv_nsec = 10000000;
20425 
20426  if(cdebug)
20427  {
20428  fprintf(newstdout,"Start_child_send: %s Size %d\n",controlling_host_name,send_size);
20429  fflush(newstdout);
20430  }
20431  he = gethostbyname(controlling_host_name);
20432  if (he == NULL)
20433  {
20434  exit(22);
20435  }
20436  ip = (struct in_addr *)he->h_addr_list[0];
20437 
20438 over:
20439  cs_raddr.sin_family = AF_INET;
20440  cs_raddr.sin_port = htons(controlling_host_port);
20441  cs_raddr.sin_addr.s_addr = ip->s_addr;
20442  child_socket_val = socket(AF_INET, SOCK_STREAM, 0);
20443  if (child_socket_val < 0)
20444  {
20445  perror("Child: socket failed:");
20446  exit(23);
20447  }
20448  bzero(&cs_addr, sizeof(struct sockaddr_in));
20449  tmp_port= CHILD_ESEND_PORT;
20450  cs_addr.sin_port = htons(tmp_port);
20451  cs_addr.sin_family = AF_INET;
20452  cs_addr.sin_addr.s_addr = INADDR_ANY;
20453  rc = -1;
20454  while (rc < 0)
20455  {
20456  rc = bind(child_socket_val, (struct sockaddr *)&cs_addr,
20457  sizeof(struct sockaddr_in));
20458  if(rc < 0)
20459  {
20460  tmp_port++;
20461  cs_addr.sin_port=htons(tmp_port);
20462  continue;
20463  }
20464  }
20465  if (rc < 0)
20466  {
20467  perror("Child: bind failed\n");
20468  exit(24);
20469  }
20470  if(cdebug)
20471  {
20472  fprintf(newstdout,"Child sender bound to port %d Master port %d \n",tmp_port,HOST_LIST_PORT);
20473  fflush(newstdout);
20474  }
20475 again:
20476  nanosleep(&req,&rem);
20477  rc = connect(child_socket_val, (struct sockaddr *)&cs_raddr,
20478  sizeof(struct sockaddr_in));
20479  if (rc < 0)
20480  {
20481  if((ecount++ < 200) && (errno != EISCONN))
20482  {
20483  nanosleep(&req,&rem);
20484  /*sleep(1);*/
20485  goto again;
20486  }
20487  if(cdebug)
20488  {
20489  fprintf(newstdout,"Child: connect failed. Errno %d \n",errno);
20490  fflush(newstdout);
20491  }
20492  close(child_socket_val);
20493  nanosleep(&req,&rem);
20494  /*sleep(1);*/
20495  ecount=0;
20496  goto over;
20497  }
20498  ecount=0;
20499  if(cdebug)
20500  {
20501  fprintf(newstdout,"Child connected\n");
20502  fflush(newstdout);
20503  }
20504 
20505  /* NOW send */
20506 
20507  bzero(&outbuf, sizeof(struct master_neutral_command));
20508  if(cdebug>=1)
20509  {
20510  fprintf(newstdout,"Child %d sending message to %s \n",(int)chid, controlling_host_name);
20511  fflush(newstdout);
20512  }
20513  /*
20514  * Convert internal commands to string format to neutral format for portability
20515  */
20516  strcpy(outbuf.m_host_name,send_buffer->m_host_name);
20517  strcpy(outbuf.m_client_name,send_buffer->m_client_name);
20518  sprintf(outbuf.m_client_number,"%d",send_buffer->m_client_number);
20519  sprintf(outbuf.m_client_error,"%d",send_buffer->m_client_error);
20520  sprintf(outbuf.m_child_port,"%d",send_buffer->m_child_port);
20521  sprintf(outbuf.m_child_async_port,"%d",send_buffer->m_child_async_port);
20522  sprintf(outbuf.m_command,"%d",send_buffer->m_command);
20523  sprintf(outbuf.m_testnum,"%d",send_buffer->m_testnum);
20524  sprintf(outbuf.m_version,"%d",send_buffer->m_version);
20525  sprintf(outbuf.m_mygen,"%d",send_buffer->m_mygen);
20526  sprintf(outbuf.m_throughput,"%f",send_buffer->m_throughput);
20527  sprintf(outbuf.m_cputime,"%f", send_buffer->m_cputime);
20528  sprintf(outbuf.m_walltime,"%f",send_buffer->m_walltime);
20529  sprintf(outbuf.m_stop_flag,"%d",send_buffer->m_stop_flag);
20530  sprintf(outbuf.m_actual,"%f",send_buffer->m_actual);
20531 #ifdef NO_PRINT_LLD
20532  sprintf(outbuf.m_child_flag,"%ld",send_buffer->m_child_flag);
20533 #else
20534  sprintf(outbuf.m_child_flag,"%lld",send_buffer->m_child_flag);
20535 #endif
20536  rc=write(child_socket_val,&outbuf,sizeof(struct master_neutral_command));
20537  if (rc < 0) {
20538  perror("write failed\n");
20539  exit(26);
20540  }
20541  close(child_socket_val);
20542 }
rc
Definition: pscanf.h:23
#define CHILD_ESEND_PORT
Definition: iozone.c:1415
int controlling_host_port
Definition: iozone.c:1410
char controlling_host_name[100]
Definition: iozone.c:1493
__time_t tv_sec
int m_testnum
Definition: iozone.c:692
void bzero()
long long m_child_flag
Definition: iozone.c:699
float m_throughput
Definition: iozone.c:695
char m_client_name[100]
Definition: iozone.c:685
int m_child_port
Definition: iozone.c:689
char m_stop_flag
Definition: iozone.c:686
int m_child_async_port
Definition: iozone.c:690
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
int m_command
Definition: iozone.c:691
int m_version
Definition: iozone.c:693
int cdebug
Definition: iozone.c:1478
long long chid
Definition: iozone.c:1529
#define HOST_LIST_PORT
Definition: iozone.c:1407
float m_cputime
Definition: iozone.c:696
int ecount
Definition: iozone.c:1310
float m_actual
Definition: iozone.c:698
int close()
FILE * newstdout
Definition: iozone.c:1475
int m_client_error
Definition: iozone.c:688
char m_host_name[100]
Definition: iozone.c:684
void exit()
int m_client_number
Definition: iozone.c:687
float m_walltime
Definition: iozone.c:697
int errno
Here is the call graph for this function:

◆ cleanup_children()

void cleanup_children ( )

Definition at line 22647 of file iozone.c.

22649 {
22650  int i;
22651  struct client_command cc;
22652  bzero(&cc,sizeof(struct client_command));
22653  cc.c_command = R_DEATH;
22654  for(i=0;i<num_child;i++)
22655  {
22656  cc.c_client_number = (int)i;
22657  /* Child not started yet */
22658  if(child_idents[i].state == C_STATE_ZERO)
22659  ;
22660  /* Child is waiting for who info */
22661  if(child_idents[i].state == C_STATE_WAIT_WHO)
22662  {
22663  if(mdebug)
22664  printf("Master sending signaled death to child !!\n");
22665  master_send(master_send_sockets[i],child_idents[i].child_name, &cc,sizeof(struct client_command));
22666  }
22667  /* Child is waiting at the barrier */
22668  if(child_idents[i].state == C_STATE_WAIT_BARRIER)
22669  {
22670  if(mdebug)
22671  printf("Master sending signaled death to child !!\n");
22672  master_send(master_send_sockets[i],child_idents[i].child_name, &cc,sizeof(struct client_command));
22673  if(mdebug)
22674  printf("Master sending signaled death to child async !!\n");
22675  master_send(master_send_async_sockets[i],child_idents[i].child_name, &cc,sizeof(struct client_command));
22676  }
22677 
22678  }
22679 }
#define C_STATE_ZERO
Definition: iozone.c:1449
int mdebug
Definition: iozone.c:1479
void bzero()
void master_send()
int master_send_async_sockets[MAXSTREAMS]
Definition: iozone.c:1471
#define R_DEATH
Definition: iozone.c:744
#define C_STATE_WAIT_BARRIER
Definition: iozone.c:1451
struct child_ident child_idents[MAXSTREAMS]
#define C_STATE_WAIT_WHO
Definition: iozone.c:1450
long long num_child
Definition: iozone.c:1335
int master_send_sockets[MAXSTREAMS]
Definition: iozone.c:1470
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanup_comm()

void cleanup_comm ( )

Definition at line 22690 of file iozone.c.

22692 {
22693  int i;
22694  for(i=0;i<num_child;i++)
22695  {
22698  }
22699 }
int master_send_async_sockets[MAXSTREAMS]
Definition: iozone.c:1471
long long num_child
Definition: iozone.c:1335
int close()
int master_send_sockets[MAXSTREAMS]
Definition: iozone.c:1470
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ close()

int close ( )
Here is the caller graph for this function:

◆ close_xls()

void close_xls ( )
Here is the caller graph for this function:

◆ cpu_util() [1/2]

static double cpu_util ( )
static
Here is the caller graph for this function:

◆ cpu_util() [2/2]

static double cpu_util ( double  cputime,
double  walltime 
)
static

Definition at line 19347 of file iozone.c.

19350 {
19351  double cpu;
19352 
19353  if (walltime <= (double)0.0)
19354  {
19355  cpu = (double)0.0;
19356  return cpu;
19357  }
19358  if (cputime <= (double)0.0)
19359  cputime = 0.0;
19360  if (walltime <= (double)0.0)
19361  cpu = (double)100.0;
19362  else {
19363  cpu = (((double)100.0 * cputime) / walltime);
19364  /*
19365  if (cpu > (double)100.0)
19366  cpu = (double)99.99;
19367  */
19368  }
19369  return cpu;
19370 }

◆ create_list()

void create_list ( )

◆ create_temp()

void create_temp ( )

◆ create_xls()

int create_xls ( )
Here is the caller graph for this function:

◆ del_record_sizes()

void del_record_sizes ( )

Definition at line 20128 of file iozone.c.

20130 {
20131  struct size_entry *size_listp;
20132  struct size_entry *save_item;
20133 
20134  size_listp=rec_size_list;
20135  if(rec_size_list)
20136  {
20137  while(size_listp!=0)
20138  {
20139  save_item=size_listp->next;
20140  free(size_listp);
20141  size_listp=save_item;
20142  }
20143  }
20144  rec_size_list=0;
20145 }
Definition: iozone.c:1350
struct size_entry * rec_size_list
Definition: iozone.c:1355
struct size_entry * next
Definition: iozone.c:1351
Here is the caller graph for this function:

◆ disrupt() [1/2]

void disrupt ( )
Here is the caller graph for this function:

◆ disrupt() [2/2]

void disrupt ( int  fd)

Definition at line 19502 of file iozone.c.

19505 {
19506  char *nbuff,*free_addr;
19507  off64_t current;
19508 
19509  free_addr=nbuff=(char *)malloc((size_t)page_size+page_size);
19510  nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
19511 
19512  /* Save current position */
19513  current = I_LSEEK(fd,0,SEEK_CUR);
19514 
19515  /* Move to beginning of file */
19516  I_LSEEK(fd,0,SEEK_SET);
19517 
19518  /* Read a little of the file */
19519  if(direct_flag)
19520  junk=read(fd,nbuff,page_size);
19521  else
19522  junk=read(fd,nbuff,1);
19523 
19524  /* Skip into the file */
19525  I_LSEEK(fd,page_size,SEEK_SET);
19526 
19527  /* Read a little of the file */
19528  if(direct_flag)
19529  junk=read(fd,nbuff,page_size);
19530  else
19531  junk=read(fd,nbuff,1);
19532 
19533  /* Restore current position in file, before disruption */
19534  I_LSEEK(fd,current,SEEK_SET);
19535  free(free_addr);
19536 
19537 }
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
int fd
Definition: iozone.c:1291
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
long long page_size
Definition: iozone.c:428
int junk
Definition: iozone.c:1402
long long off64_t
Definition: iozone.c:357
int direct_flag
Definition: iozone.c:1527
Here is the call graph for this function:

◆ distribute_stop()

void distribute_stop ( )

Definition at line 22564 of file iozone.c.

22566 {
22567  int i;
22568  struct client_command cc;
22569 
22570  /*
22571  * Only send one stop to the clients. Each client will
22572  * send stop to the master, but the master only needs
22573  * to distribute the first stop. Without this, the
22574  * master may distribute too many stops and overflow
22575  * the socket buffer on the client.
22576  */
22577  if(sent_stop)
22578  {
22579  if(mdebug)
22580  {
22581  s_count++;
22582  printf("Master not send stop %d\n",s_count);
22583  }
22584  return;
22585  }
22586  bzero(&cc,sizeof(struct client_command));
22587  cc.c_command = R_STOP_FLAG;
22588  cc.c_stop_flag = 1;
22589  for(i=0;i<num_child;i++)
22590  {
22591  cc.c_client_number = (int)i;
22592  if(mdebug)
22593  printf("Master distributing stop flag to child %d\n",i);
22594  master_send(master_send_async_sockets[i],child_idents[i].child_name, &cc,sizeof(struct client_command));
22595  }
22596  sent_stop=1;
22597 }
int mdebug
Definition: iozone.c:1479
int s_count
Definition: iozone.c:1286
void bzero()
void master_send()
int master_send_async_sockets[MAXSTREAMS]
Definition: iozone.c:1471
struct child_ident child_idents[MAXSTREAMS]
char sent_stop
Definition: iozone.c:1304
long long num_child
Definition: iozone.c:1335
#define R_STOP_FLAG
Definition: iozone.c:742
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_compute() [1/2]

float do_compute ( )
Here is the caller graph for this function:

◆ do_compute() [2/2]

float do_compute ( float  comp_delay)

Definition at line 19474 of file iozone.c.

19477 {
19478  double starttime,tmptime;
19479  if(comp_delay == (float)0.0)
19480  return(0.0);
19481  starttime=time_so_far();
19482  while(1)
19483  {
19484  tmptime=time_so_far()-starttime;
19485  if(tmptime >= (double)comp_delay)
19486  return(tmptime);
19487  }
19488  return(0.0);
19489 }
static double time_so_far()
Definition: iozone.c:6844
Here is the call graph for this function:

◆ do_float()

void do_float ( )
Here is the caller graph for this function:

◆ do_label()

void do_label ( )
Here is the caller graph for this function:

◆ do_speed_check() [1/2]

void do_speed_check ( )
Here is the caller graph for this function:

◆ do_speed_check() [2/2]

void do_speed_check ( int  client_flag)

Definition at line 23531 of file iozone.c.

23534 {
23535  int i;
23536  if(client_flag)
23537  {
23538  speed_main(" "," ",reclen,kilobytes64,client_flag);
23539  }
23540  else
23541  {
23542  printf("Checking %d clients\n",clients_found);
23543  for(i=0;i<clients_found;i++)
23544  {
23545  speed_main(child_idents[i].child_name,
23546  child_idents[i].execute_path,
23547  reclen, kilobytes64,client_flag);
23548  }
23549  }
23550 }
void speed_main(char *, char *, long long, long long, int)
Definition: iozone.c:22822
long long reclen
Definition: iozone.c:1535
struct child_ident child_idents[MAXSTREAMS]
off64_t kilobytes64
Definition: iozone.c:1277
int clients_found
Definition: iozone.c:1474
int i
Definition: fileop.c:140
Here is the call graph for this function:

◆ dump_cputimes()

void dump_cputimes ( void  )

Definition at line 11880 of file iozone.c.

11882 {
11883  bif_row++;
11884  bif_column = 0;
11885 
11886  if ((!include_tflag) || (include_mask & (long long)WRITER_MASK)) {
11887  if(bif_flag)
11888  do_label(bif_fd, "Writer CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11889  if(!silent) printf("\n%cWriter CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11890  dump_times(2);
11891  if(bif_flag)
11892  do_label(bif_fd, "Re-writer CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11893  if(!silent) printf("\n%cRe-writer CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11894  dump_times(3);
11895  }
11896 
11897  if ((!include_tflag) || (include_mask & (long long)READER_MASK)) {
11898  if(bif_flag)
11899  do_label(bif_fd, "Reader CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11900  if(!silent) printf("\n%cReader CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11901  dump_times(4);
11902  if(bif_flag)
11903  do_label(bif_fd, "Re-reader CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11904  if(!silent) printf("\n%cRe-Reader CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11905  dump_times(5);
11906  }
11907 
11908  if ((!include_tflag) || (include_mask & (long long)RANDOM_RW_MASK)) {
11909  if(bif_flag)
11910  do_label(bif_fd, "Random Read CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11911  if(!silent) printf("\n%cRandom read CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11912  dump_times(6);
11913  if(bif_flag)
11914  do_label(bif_fd, "Random Write CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11915  if(!silent) printf("\n%cRandom write CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11916  dump_times(7);
11917  }
11918 
11919  if ((!include_tflag) || (include_mask & (long long)REVERSE_MASK)) {
11920  if(bif_flag)
11921  do_label(bif_fd, "Backward Read CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11922  if(!silent) printf("\n%cBackward read CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11923  dump_times(8);
11924  }
11925 
11926  if ((!include_tflag) || (include_mask & (long long)REWRITE_REC_MASK)) {
11927  if(bif_flag)
11928  do_label(bif_fd, "Record Rewrite CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11929  if(!silent) printf("\n%cRecord rewrite CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11930  dump_times(9);
11931  }
11932 
11933  if ((!include_tflag) || (include_mask & (long long)STRIDE_READ_MASK)) {
11934  if(bif_flag)
11935  do_label(bif_fd, "Stride Read CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11936  if(!silent) printf("\n%cStride read CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11937  dump_times(10);
11938  }
11939 
11940  if ((!include_tflag) || (include_mask & (long long)FWRITER_MASK)) {
11941  if(bif_flag)
11942  do_label(bif_fd, "Fwrite CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11943  if(!silent) printf("\n%cFwrite CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11944  dump_times(11);
11945  if(bif_flag)
11946  do_label(bif_fd, "Re-fwrite CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11947  if(!silent) printf("\n%cRe-Fwrite CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11948  dump_times(12);
11949  }
11950 
11951  if ((!include_tflag) || (include_mask & (long long)FREADER_MASK)) {
11952  if(bif_flag)
11953  do_label(bif_fd, "Fread CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11954  if(!silent) printf("\n%cFread CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11955  dump_times(13);
11956  if(bif_flag)
11957  do_label(bif_fd, "Re-fread CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11958  if(!silent) printf("\n%cRe-Fread CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11959  dump_times(14);
11960  }
11961 
11962 #ifdef HAVE_PREAD
11963  if(Eflag)
11964  {
11965  if ((!include_tflag) || (include_mask & (long long)PWRITER_MASK)) {
11966  if(bif_flag)
11967  do_label(bif_fd, "Pwrite CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11968  if(!silent) printf("\n%cPwrite CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11969  dump_times(15);
11970  if(bif_flag)
11971  do_label(bif_fd, "Re-pwrite CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11972  if(!silent) printf("\n%cRe-Pwrite CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11973  dump_times(16);
11974  }
11975 
11976  if ((!include_tflag) || (include_mask & (long long)PREADER_MASK)) {
11977  if(bif_flag)
11978  do_label(bif_fd, "Pread CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11979  if(!silent) printf("\n%cPread CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11980  dump_times(17);
11981  if(bif_flag)
11982  do_label(bif_fd, "Re-pread CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11983  if(!silent) printf("\n%cRe-Pread CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11984  dump_times(18);
11985  }
11986 
11987 #ifdef HAVE_PREADV
11988  if ((!include_tflag) || (include_mask & (long long)PWRITEV_MASK)) {
11989  if(bif_flag)
11990  do_label(bif_fd, "Pwritev CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11991  if(!silent) printf("\n%cPwritev CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11992  dump_times(19);
11993  if(bif_flag)
11994  do_label(bif_fd, "Re-pwritev CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
11995  if(!silent) printf("\n%cRe-Pwritev CPU utilization report (Zero values should be ignored)%c\n",'"','"');
11996  dump_times(20);
11997  }
11998 
11999  if ((!include_tflag) || (include_mask & (long long)PREADV_MASK)) {
12000  if(bif_flag)
12001  do_label(bif_fd, "Preadv CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
12002  if(!silent) printf("\n%cPreadv CPU utilization report (Zero values should be ignored)%c\n",'"','"');
12003  dump_times(21);
12004  if(bif_flag)
12005  do_label(bif_fd, "Re-preadv CPU utilization report (Zero values should be ignored)", bif_row++, bif_column);
12006  if(!silent) printf("\n%cRe-Preadv CPU utilization report (Zero values should be ignored)%c\n",'"','"');
12007  dump_times(22);
12008  }
12009 #endif
12010  }
12011 #endif
12012 }
void do_label()
#define RANDOM_RW_MASK
Definition: iozone.c:922
int bif_column
Definition: iozone.c:1298
#define STRIDE_READ_MASK
Definition: iozone.c:926
dump_times(long long who)
Definition: iozone.c:11804
#define FREADER_MASK
Definition: iozone.c:928
#define READER_MASK
Definition: iozone.c:921
char include_tflag
Definition: iozone.c:1329
char Eflag
Definition: iozone.c:1303
int bif_row
Definition: iozone.c:1298
int bif_fd
Definition: iozone.c:1297
long long include_mask
Definition: iozone.c:1332
#define REWRITE_REC_MASK
Definition: iozone.c:925
#define REVERSE_MASK
Definition: iozone.c:924
#define WRITER_MASK
Definition: iozone.c:920
char silent
Definition: iozone.c:1295
#define FWRITER_MASK
Definition: iozone.c:927
char bif_flag
Definition: iozone.c:1307
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_excel()

void dump_excel ( )

Definition at line 11653 of file iozone.c.

11655 {
11656  if(bif_flag)
11657  {
11661  do_label(bif_fd,"The top row is records sizes, the left column is file sizes",bif_row++,bif_column);
11662  }
11663  if(!silent) printf("Excel output is below:\n");
11664 
11665  if ((!include_tflag) || (include_mask & (long long)WRITER_MASK)) {
11666  if(bif_flag)
11667  do_label(bif_fd,"Writer Report",bif_row++,bif_column);
11668  if(!silent) printf("\n%cWriter report%c\n",'"','"');
11669  dump_report(2);
11670  if(bif_flag)
11671  do_label(bif_fd,"Re-writer Report",bif_row++,bif_column);
11672  if(!silent) printf("\n%cRe-writer report%c\n",'"','"');
11673  dump_report(3);
11674  }
11675 
11676  if ((!include_tflag) || (include_mask & (long long)READER_MASK)) {
11677  if(bif_flag)
11678  do_label(bif_fd,"Reader Report",bif_row++,bif_column);
11679  if(!silent) printf("\n%cReader report%c\n",'"','"');
11680  dump_report(4);
11681  if(bif_flag)
11682  do_label(bif_fd,"Re-reader Report",bif_row++,bif_column);
11683  if(!silent) printf("\n%cRe-Reader report%c\n",'"','"');
11684  dump_report(5);
11685  }
11686 
11687  if ((!include_tflag) || (include_mask & (long long)RANDOM_RW_MASK)) {
11688  if(bif_flag)
11689  do_label(bif_fd,"Random Read Report",bif_row++,bif_column);
11690  if(!silent) printf("\n%cRandom read report%c\n",'"','"');
11691  dump_report(6);
11692  if(bif_flag)
11693  do_label(bif_fd,"Random Write Report",bif_row++,bif_column);
11694  if(!silent) printf("\n%cRandom write report%c\n",'"','"');
11695  dump_report(7);
11696  }
11697 
11698  if ((!include_tflag) || (include_mask & (long long)REVERSE_MASK)) {
11699  if(bif_flag)
11700  do_label(bif_fd,"Backward Read Report",bif_row++,bif_column);
11701  if(!silent) printf("\n%cBackward read report%c\n",'"','"');
11702  dump_report(8);
11703  }
11704 
11705  if ((!include_tflag) || (include_mask & (long long)REWRITE_REC_MASK)) {
11706  if(bif_flag)
11707  do_label(bif_fd,"Record Rewrite Report",bif_row++,bif_column);
11708  if(!silent) printf("\n%cRecord rewrite report%c\n",'"','"');
11709  dump_report(9);
11710  }
11711 
11712  if ((!include_tflag) || (include_mask & (long long)STRIDE_READ_MASK)) {
11713  if(bif_flag)
11714  do_label(bif_fd,"Stride Read Report",bif_row++,bif_column);
11715  if(!silent) printf("\n%cStride read report%c\n",'"','"');
11716  dump_report(10);
11717  }
11718 
11719  if ((!include_tflag) || (include_mask & (long long)FWRITER_MASK)) {
11720  if(bif_flag)
11721  do_label(bif_fd,"Fwrite Report",bif_row++,bif_column);
11722  if(!silent) printf("\n%cFwrite report%c\n",'"','"');
11723  dump_report(11);
11724  if(bif_flag)
11725  do_label(bif_fd,"Re-fwrite Report",bif_row++,bif_column);
11726  if(!silent) printf("\n%cRe-Fwrite report%c\n",'"','"');
11727  dump_report(12);
11728  }
11729 
11730  if ((!include_tflag) || (include_mask & (long long)FREADER_MASK)) {
11731  if(bif_flag)
11732  do_label(bif_fd,"Fread Report",bif_row++,bif_column);
11733  if(!silent) printf("\n%cFread report%c\n",'"','"');
11734  dump_report(13);
11735  if(bif_flag)
11736  do_label(bif_fd,"Re-fread Report",bif_row++,bif_column);
11737  if(!silent) printf("\n%cRe-Fread report%c\n",'"','"');
11738  dump_report(14);
11739  }
11740 
11741 #ifdef HAVE_PREAD
11742  if(Eflag)
11743  {
11744  if ((!include_tflag) || (include_mask & (long long)PWRITER_MASK)) {
11745  if(bif_flag)
11746  do_label(bif_fd,"Pwrite Report",bif_row++,bif_column);
11747  if(!silent) printf("\n%cPwrite report%c\n",'"','"');
11748  dump_report(15);
11749  if(bif_flag)
11750  do_label(bif_fd,"Re-pwrite Report",bif_row++,bif_column);
11751  if(!silent) printf("\n%cRe-Pwrite report%c\n",'"','"');
11752  dump_report(16);
11753  }
11754 
11755  if ((!include_tflag) || (include_mask & (long long)PREADER_MASK)) {
11756  if(bif_flag)
11757  do_label(bif_fd,"Pread Report",bif_row++,bif_column);
11758  if(!silent) printf("\n%cPread report%c\n",'"','"');
11759  dump_report(17);
11760  if(bif_flag)
11761  do_label(bif_fd,"Re-pread Report",bif_row++,bif_column);
11762  if(!silent) printf("\n%cRe-Pread report%c\n",'"','"');
11763  dump_report(18);
11764  }
11765 
11766 #ifdef HAVE_PREADV
11767  if ((!include_tflag) || (include_mask & (long long)PWRITEV_MASK)) {
11768  if(bif_flag)
11769  do_label(bif_fd,"Pwritev Report",bif_row++,bif_column);
11770  if(!silent) printf("\n%cPwritev report%c\n",'"','"');
11771  dump_report(19);
11772  if(bif_flag)
11773  do_label(bif_fd,"Re-pwritev Report",bif_row++,bif_column);
11774  if(!silent) printf("\n%cRe-Pwritev report%c\n",'"','"');
11775  dump_report(20);
11776  }
11777 
11778  if ((!include_tflag) || (include_mask & (long long)PREADV_MASK)) {
11779  if(bif_flag)
11780  do_label(bif_fd,"Preadv Report",bif_row++,bif_column);
11781  if(!silent) printf("\n%cPreadv report%c\n",'"','"');
11782  dump_report(21);
11783  if(bif_flag)
11784  do_label(bif_fd,"Re-preadv Report",bif_row++,bif_column);
11785  if(!silent) printf("\n%cRe-Preadv report%c\n",'"','"');
11786  dump_report(22);
11787  }
11788 #endif
11789  }
11790 #endif
11791  if (cpuutilflag)
11792  dump_cputimes();
11793  if(bif_flag)
11794  close_xls(bif_fd);
11795 }
void do_label()
#define RANDOM_RW_MASK
Definition: iozone.c:922
int bif_column
Definition: iozone.c:1298
#define STRIDE_READ_MASK
Definition: iozone.c:926
#define FREADER_MASK
Definition: iozone.c:928
#define READER_MASK
Definition: iozone.c:921
char cpuutilflag
Definition: iozone.c:1321
dump_report(long long who)
Definition: iozone.c:11567
char include_tflag
Definition: iozone.c:1329
char Eflag
Definition: iozone.c:1303
int bif_row
Definition: iozone.c:1298
int bif_fd
Definition: iozone.c:1297
long long include_mask
Definition: iozone.c:1332
void dump_cputimes()
Definition: iozone.c:11880
#define REWRITE_REC_MASK
Definition: iozone.c:925
#define REVERSE_MASK
Definition: iozone.c:924
char command_line[1024]
Definition: iozone.c:1387
#define WRITER_MASK
Definition: iozone.c:920
void close_xls()
char bif_filename[MAXNAMESIZE]
Definition: iozone.c:1359
char silent
Definition: iozone.c:1295
#define FWRITER_MASK
Definition: iozone.c:927
char bif_flag
Definition: iozone.c:1307
int create_xls()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_hist() [1/2]

void dump_hist ( )
Here is the caller graph for this function:

◆ dump_hist() [2/2]

void dump_hist ( char *  what,
int  id 
)

Definition at line 24284 of file iozone.c.

24285 {
24286  FILE *fp;
24287 
24288  char name[256];
24289 
24290  sprintf(name,"%s_child_%d.txt","Iozone_histogram",id);
24291 
24292  fp = fopen(name,"a");
24293 
24294 #ifndef NO_PRINT_LLD
24295  fprintf(fp,"Child: %d Op: %s\n",id,what);
24296  fprintf(fp,"Band 1: ");
24297  fprintf(fp," 20us:%-7.1lld ",buckets[0]);
24298  fprintf(fp," 40us:%-7.1lld ",buckets[1]);
24299  fprintf(fp," 60us:%-7.1lld ",buckets[2]);
24300  fprintf(fp," 80us:%-7.1lld ",buckets[3]);
24301  fprintf(fp,"100us:%-7.1lld \n",buckets[4]);
24302 
24303  fprintf(fp,"Band 2: ");
24304  fprintf(fp,"200us:%-7.1lld ",buckets[5]);
24305  fprintf(fp,"400us:%-7.1lld ",buckets[6]);
24306  fprintf(fp,"600us:%-7.1lld ",buckets[7]);
24307  fprintf(fp,"800us:%-7.1lld ",buckets[8]);
24308  fprintf(fp," 1ms:%-7.1lld \n",buckets[9]);
24309 
24310  fprintf(fp,"Band 3: ");
24311  fprintf(fp," 2ms:%-7.1lld ",buckets[10]);
24312  fprintf(fp," 4ms:%-7.1lld ",buckets[11]);
24313  fprintf(fp," 6ms:%-7.1lld ",buckets[12]);
24314  fprintf(fp," 8ms:%-7.1lld ",buckets[13]);
24315  fprintf(fp," 10ms:%-7.1lld \n",buckets[14]);
24316 
24317  fprintf(fp,"Band 4: ");
24318  fprintf(fp," 12ms:%-7.1lld ",buckets[15]);
24319  fprintf(fp," 14ms:%-7.1lld ",buckets[16]);
24320  fprintf(fp," 16ms:%-7.1lld ",buckets[17]);
24321  fprintf(fp," 18ms:%-7.1lld ",buckets[18]);
24322  fprintf(fp," 20ms:%-7.1lld \n",buckets[19]);
24323 
24324  fprintf(fp,"Band 5: ");
24325  fprintf(fp," 40ms:%-7.1lld ",buckets[20]);
24326  fprintf(fp," 60ms:%-7.1lld ",buckets[21]);
24327  fprintf(fp," 80ms:%-7.1lld ",buckets[22]);
24328  fprintf(fp,"100ms:%-7.1lld \n",buckets[23]);
24329 
24330  fprintf(fp,"Band 6: ");
24331  fprintf(fp,"200ms:%-7.1lld ",buckets[24]);
24332  fprintf(fp,"400ms:%-7.1lld ",buckets[25]);
24333  fprintf(fp,"600ms:%-7.1lld ",buckets[26]);
24334  fprintf(fp,"800ms:%-7.1lld ",buckets[27]);
24335  fprintf(fp," 1s:%-7.1lld \n",buckets[28]);
24336 
24337  fprintf(fp,"Band 7: ");
24338  fprintf(fp," 2s:%-7.1lld ",buckets[29]);
24339  fprintf(fp," 4s:%-7.1lld ",buckets[30]);
24340  fprintf(fp," 6s:%-7.1lld ",buckets[31]);
24341  fprintf(fp," 8s:%-7.1lld ",buckets[32]);
24342  fprintf(fp," 10s:%-7.1lld \n",buckets[33]);
24343 
24344  fprintf(fp,"Band 8: ");
24345  fprintf(fp," 20s:%-7.1lld ",buckets[34]);
24346  fprintf(fp," 40s:%-7.1lld ",buckets[35]);
24347  fprintf(fp," 60s:%-7.1lld ",buckets[36]);
24348  fprintf(fp," 80s:%-7.1lld ",buckets[37]);
24349  fprintf(fp," 120s:%-7.1lld \n",buckets[38]);
24350 
24351  fprintf(fp,"Band 9: ");
24352  fprintf(fp,"120+s:%-7.1lld \n\n",buckets[39]);
24353 #else
24354  fprintf(fp,"Child: %d Op: %s\n",id,what);
24355  fprintf(fp,"Band 1: ");
24356  fprintf(fp," 20us:%-7.1ld ",buckets[0]);
24357  fprintf(fp," 40us:%-7.1ld ",buckets[1]);
24358  fprintf(fp," 60us:%-7.1ld ",buckets[2]);
24359  fprintf(fp," 80us:%-7.1ld ",buckets[3]);
24360  fprintf(fp,"100us:%-7.1ld \n",buckets[4]);
24361 
24362  fprintf(fp,"Band 2: ");
24363  fprintf(fp,"200us:%-7.1ld ",buckets[5]);
24364  fprintf(fp,"400us:%-7.1ld ",buckets[6]);
24365  fprintf(fp,"600us:%-7.1ld ",buckets[7]);
24366  fprintf(fp,"800us:%-7.1ld ",buckets[8]);
24367  fprintf(fp," 1ms:%-7.1ld \n",buckets[9]);
24368 
24369  fprintf(fp,"Band 3: ");
24370  fprintf(fp," 2ms:%-7.1ld ",buckets[10]);
24371  fprintf(fp," 4ms:%-7.1ld ",buckets[11]);
24372  fprintf(fp," 6ms:%-7.1ld ",buckets[12]);
24373  fprintf(fp," 8ms:%-7.1ld ",buckets[13]);
24374  fprintf(fp," 10ms:%-7.1ld \n",buckets[14]);
24375 
24376  fprintf(fp,"Band 4: ");
24377  fprintf(fp," 12ms:%-7.1ld ",buckets[15]);
24378  fprintf(fp," 14ms:%-7.1ld ",buckets[16]);
24379  fprintf(fp," 16ms:%-7.1ld ",buckets[17]);
24380  fprintf(fp," 18ms:%-7.1ld ",buckets[18]);
24381  fprintf(fp," 20ms:%-7.1ld \n",buckets[19]);
24382 
24383  fprintf(fp,"Band 5: ");
24384  fprintf(fp," 40ms:%-7.1ld ",buckets[20]);
24385  fprintf(fp," 60ms:%-7.1ld ",buckets[21]);
24386  fprintf(fp," 80ms:%-7.1ld ",buckets[22]);
24387  fprintf(fp,"100ms:%-7.1ld \n",buckets[23]);
24388 
24389  fprintf(fp,"Band 6: ");
24390  fprintf(fp,"200ms:%-7.1ld ",buckets[24]);
24391  fprintf(fp,"400ms:%-7.1ld ",buckets[25]);
24392  fprintf(fp,"600ms:%-7.1ld ",buckets[26]);
24393  fprintf(fp,"800ms:%-7.1ld ",buckets[27]);
24394  fprintf(fp," 1s:%-7.1ld \n",buckets[28]);
24395 
24396  fprintf(fp,"Band 7: ");
24397  fprintf(fp," 2s:%-7.1ld ",buckets[29]);
24398  fprintf(fp," 4s:%-7.1ld ",buckets[30]);
24399  fprintf(fp," 6s:%-7.1ld ",buckets[31]);
24400  fprintf(fp," 8s:%-7.1ld ",buckets[32]);
24401  fprintf(fp," 10s:%-7.1ld \n",buckets[33]);
24402 
24403  fprintf(fp,"Band 8: ");
24404  fprintf(fp," 20s:%-7.1ld ",buckets[34]);
24405  fprintf(fp," 40s:%-7.1ld ",buckets[35]);
24406  fprintf(fp," 60s:%-7.1ld ",buckets[36]);
24407  fprintf(fp," 80s:%-7.1ld ",buckets[37]);
24408  fprintf(fp," 120s:%-7.1ld \n",buckets[38]);
24409 
24410  fprintf(fp,"Band 9: ");
24411  fprintf(fp,"120+s:%-7.1ld \n\n",buckets[39]);
24412 #endif
24413  fclose(fp);
24414 }
static const char * name
Definition: fork_overflow.c:31
static FILE * fp
long long buckets[BUCKETS]
Definition: iozone.c:24212

◆ dump_report()

dump_report ( long long  who)

Definition at line 11567 of file iozone.c.

11570 {
11571  long long i;
11572  off64_t current_file_size;
11573  off64_t rec_size;
11574 
11575  if(bif_flag)
11576  bif_column++;
11577  if(!silent) printf(" ");
11578 
11579  /*
11580  * Need to reconstruct the record size list
11581  * as the crossover in -a changed the list.
11582  */
11583  del_record_sizes();
11585 
11586  for(rec_size=get_next_record_size(0); rec_size <= orig_max_rec_size;
11587  rec_size=get_next_record_size(rec_size))
11588  {
11589  if (rec_size == 0) break;
11590  if(bif_flag)
11591  do_float(bif_fd,(double)(rec_size/1024),bif_row,bif_column++);
11592 #ifdef NO_PRINT_LLD
11593  if(!silent) printf(" %c%ld%c",'"',rec_size/1024,'"');
11594 #else
11595  if(!silent) printf(" %c%lld%c",'"',rec_size/1024,'"');
11596 #endif
11597  }
11598  if(!silent) printf("\n");
11599  if(bif_flag)
11600  {
11601  bif_column=0;
11602  bif_row++;
11603  }
11604 
11605  current_file_size = report_array[0][0];
11606  if(bif_flag)
11607  {
11608  do_float(bif_fd,(double)(current_file_size),bif_row,bif_column++);
11609  }
11610 #ifdef NO_PRINT_LLD
11611  if(!silent) printf("%c%ld%c ",'"',current_file_size,'"');
11612 #else
11613  if(!silent) printf("%c%lld%c ",'"',current_file_size,'"');
11614 #endif
11615  for(i=0;i<=max_y;i++){
11616  if(report_array[0][i] != current_file_size){
11617  if(!silent) printf("\n");
11618  current_file_size = report_array[0][i];
11619  if(bif_flag)
11620  {
11621  bif_row++;
11622  bif_column=0;
11623  do_float(bif_fd,(double)(current_file_size),bif_row,bif_column++);
11624  }
11625 #ifdef NO_PRINT_LLD
11626  if(!silent) printf("%c%ld%c ",'"',current_file_size,'"');
11627 #else
11628  if(!silent) printf("%c%lld%c ",'"',current_file_size,'"');
11629 #endif
11630  }
11631  if(bif_flag)
11632  do_float(bif_fd,(double)(report_array[who][i]),bif_row,bif_column++);
11633 #ifdef NO_PRINT_LLD
11634  if(!silent) printf(" %ld ",report_array[who][i]);
11635 #else
11636  if(!silent) printf(" %lld ",report_array[who][i]);
11637 #endif
11638  }
11639  if(bif_flag)
11640  {
11641  bif_row++;
11642  bif_column=0;
11643  }
11644  if(!silent) printf("\n");
11645 }
long long orig_max_rec_size
Definition: iozone.c:1383
int bif_column
Definition: iozone.c:1298
long long max_y
Definition: iozone.c:1275
void do_float()
off64_t get_next_record_size()
void del_record_sizes()
Definition: iozone.c:20128
int bif_row
Definition: iozone.c:1298
int bif_fd
Definition: iozone.c:1297
off64_t report_array[MAX_X][MAX_Y]
Definition: iozone.c:1269
void init_record_sizes()
char silent
Definition: iozone.c:1295
char bif_flag
Definition: iozone.c:1307
long long off64_t
Definition: iozone.c:357
int i
Definition: fileop.c:140
long long orig_min_rec_size
Definition: iozone.c:1382
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_throughput()

void dump_throughput ( )

Definition at line 18694 of file iozone.c.

18696 {
18697  long long x,y,i,j;
18698  char *port;
18699  char *label;
18700  char print_str[300];
18701  x=max_x;
18702  y=max_y;
18703 
18704  if(use_thread)
18705  port="threads";
18706  else
18707  port="processes";
18708  if(!silent) printf("\n\"Throughput report Y-axis is type of test X-axis is number of %s\"\n",port);
18709  if(bif_flag)
18710  {
18713  sprintf(print_str,"Throughput report Y-axis is type of test X-axis is number of %s",port);
18714  do_label(bif_fd,print_str,bif_row++,bif_column);
18715  }
18716  if(OPS_flag)
18717  label="ops/sec";
18718  else
18719  if(MS_flag)
18720  label="microseconds/op";
18721  else
18722  label="Kbytes/sec";
18723 #ifdef NO_PRINT_LLD
18724  if(!silent) printf("\"Record size = %ld Kbytes \"\n",reclen/1024);
18725 #else
18726  if(!silent) printf("\"Record size = %lld Kbytes \"\n",reclen/1024);
18727 #endif
18728  if(!silent) printf("\"Output is in %s\"\n\n",label);
18729  if(bif_flag)
18730  {
18731 #ifdef NO_PRINT_LLD
18732  sprintf(print_str,"Record size = %ld Kbytes",reclen/1024);
18733 #else
18734  sprintf(print_str,"Record size = %lld Kbytes",reclen/1024);
18735 #endif
18736  do_label(bif_fd,print_str,bif_row++,bif_column);
18737  sprintf(print_str,"Output is in %s",label);
18738  do_label(bif_fd,print_str,bif_row++,bif_column);
18739  }
18740  for(i=0;i<=toutputindex;i++)
18741  {
18742  if(!silent) printf("\"%15s \"",toutput[i]);
18743  if(bif_flag)
18744  {
18745  sprintf(print_str,"%15s ",toutput[i]);
18746  do_label(bif_fd,print_str,bif_row,bif_column++);
18747  bif_column++;
18748  }
18749  for(j=0;j<=y;j++)
18750  {
18751  if(bif_flag)
18752  {
18754  }
18755  if(!silent) printf(" %10.2f ",report_darray[i][j]);
18756  }
18757  if(!silent) printf("\n\n");
18758  if(bif_flag)
18759  {
18760  bif_column=0;
18761  bif_row++;
18762  }
18763  }
18764  if (cpuutilflag)
18766  if(bif_flag)
18767  close_xls(bif_fd);
18768 }
int toutputindex
Definition: iozone.c:1477
void do_label()
int bif_column
Definition: iozone.c:1298
long long max_y
Definition: iozone.c:1275
long long reclen
Definition: iozone.c:1535
void do_float()
char use_thread
Definition: iozone.c:1372
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
int bif_row
Definition: iozone.c:1298
int bif_fd
Definition: iozone.c:1297
void dump_throughput_cpu()
Definition: iozone.c:18625
long long x
Definition: iozone.c:1335
char command_line[1024]
Definition: iozone.c:1387
void close_xls()
char bif_filename[MAXNAMESIZE]
Definition: iozone.c:1359
char silent
Definition: iozone.c:1295
double report_darray[MAX_X][MAXSTREAMS]
Definition: iozone.c:1270
char bif_flag
Definition: iozone.c:1307
char OPS_flag
Definition: iozone.c:1517
char toutput[20][20]
Definition: iozone.c:1476
int create_xls()
int i
Definition: fileop.c:140
long long max_x
Definition: iozone.c:1275
long long y
Definition: iozone.c:1335
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_throughput_cpu()

void dump_throughput_cpu ( )

Definition at line 18625 of file iozone.c.

18627 {
18628  long long x,y,i,j;
18629  char *port;
18630  char *label;
18631  char print_str[300];
18632  x=max_x;
18633  y=max_y;
18634 
18635  port = use_thread ? "threads" : "processes";
18636  printf("\n\"CPU utilization report Y-axis is type of test X-axis is number of %s\"\n",port);
18637  if (bif_flag)
18638  {
18639  sprintf(print_str, "CPU utilization report Y-axis is type of test X-axis is number of %s", port);
18640  do_label(bif_fd, print_str, bif_row++, bif_column);
18641  }
18642  label = OPS_flag ? "ops/sec" :
18643  MS_flag ? "microseconds/op" : "Kbytes/sec";
18644 #ifdef NO_PRINT_LLD
18645  if(!silent) printf("\"Record size = %ld Kbytes \"\n", reclen/1024);
18646 #else
18647  if(!silent) printf("\"Record size = %lld Kbytes \"\n", reclen/1024);
18648 #endif
18649  if(!silent) printf("\"Output is in CPU%%\"\n\n");
18650  if (bif_flag)
18651  {
18652 #ifdef NO_PRINT_LLD
18653  sprintf(print_str, "Record size = %ld Kbytes", reclen/1024);
18654 #else
18655  sprintf(print_str, "Record size = %lld Kbytes", reclen/1024);
18656 #endif
18657  do_label(bif_fd, print_str, bif_row++, bif_column);
18658  sprintf(print_str, "Output is in CPU%%");
18659  do_label(bif_fd, print_str, bif_row++, bif_column);
18660  }
18661  for (i = 0; i < x; i++)
18662  {
18663  if(!silent) printf("\"%15s \"", throughput_tests[i]);
18664  if (bif_flag)
18665  {
18666  sprintf(print_str, "%15s ", throughput_tests[i]);
18667  do_label(bif_fd, print_str, bif_row, bif_column++);
18668  bif_column++;
18669  }
18670  for (j = 0; j <= y; j++)
18671  {
18672  if (bif_flag)
18673  do_float(bif_fd, runtimes[i][j].cpuutil, bif_row, bif_column++);
18674  if(!silent) printf(" %10.2f ", runtimes[i][j].cpuutil);
18675  }
18676  if(!silent) printf("\n\n");
18677  if (bif_flag)
18678  {
18679  bif_column=0;
18680  bif_row++;
18681  }
18682  }
18683 }
void do_label()
int bif_column
Definition: iozone.c:1298
long long max_y
Definition: iozone.c:1275
long long reclen
Definition: iozone.c:1535
void do_float()
char use_thread
Definition: iozone.c:1372
struct runtime runtimes[MAX_X][MAX_Y]
Definition: iozone.c:1330
char MS_flag
Definition: iozone.c:1525
int bif_row
Definition: iozone.c:1298
int bif_fd
Definition: iozone.c:1297
long long x
Definition: iozone.c:1335
char * throughput_tests[]
Definition: iozone.c:1385
char silent
Definition: iozone.c:1295
char bif_flag
Definition: iozone.c:1307
char OPS_flag
Definition: iozone.c:1517
int i
Definition: fileop.c:140
long long max_x
Definition: iozone.c:1275
long long y
Definition: iozone.c:1335
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_times()

dump_times ( long long  who)

Definition at line 11804 of file iozone.c.

11807 {
11808  long long i;
11809  off64_t current_file_size;
11810  off64_t rec_size;
11811 
11812  if (bif_flag)
11813  bif_column++;
11814  if(!silent) printf(" ");
11815 
11816  for (rec_size = get_next_record_size(0); rec_size <= orig_max_rec_size;
11817  rec_size = get_next_record_size(rec_size))
11818  {
11819  if (rec_size == 0) break;
11820  if (bif_flag)
11821  do_float(bif_fd, (double)(rec_size/1024), bif_row, bif_column++);
11822 #ifdef NO_PRINT_LLD
11823  if(!silent) printf(" %c%ld%c",'"',rec_size/1024,'"');
11824 #else
11825  if(!silent) printf(" %c%lld%c",'"',rec_size/1024,'"');
11826 #endif
11827  }
11828  if(!silent) printf("\n");
11829  if (bif_flag)
11830  {
11831  bif_column=0;
11832  bif_row++;
11833  }
11834 
11835  current_file_size = report_array[0][0];
11836  if (bif_flag)
11837  {
11838  do_float(bif_fd, (double)(current_file_size), bif_row, bif_column++);
11839  }
11840 #ifdef NO_PRINT_LLD
11841  if(!silent) printf("%c%ld%c ",'"',current_file_size,'"');
11842 #else
11843  if(!silent) printf("%c%lld%c ",'"',current_file_size,'"');
11844 #endif
11845  for (i = 0; i <= max_y; i++) {
11846  if (report_array[0][i] != current_file_size) {
11847  if(!silent) printf("\n");
11848  current_file_size = report_array[0][i];
11849  if (bif_flag)
11850  {
11851  bif_row++;
11852  bif_column=0;
11853  do_float(bif_fd, (double)(current_file_size), bif_row, bif_column++);
11854  }
11855 #ifdef NO_PRINT_LLD
11856  if(!silent) printf("%c%ld%c ",'"',current_file_size,'"');
11857 #else
11858  if(!silent) printf("%c%lld%c ",'"',current_file_size,'"');
11859 #endif
11860  }
11861  if (bif_flag)
11862  do_float(bif_fd, (double)(runtimes [who][i].cpuutil), bif_row, bif_column++);
11863  if(!silent) printf(" %6.2f", runtimes [who][i].cpuutil);
11864  }
11865  if(!silent) printf("\n");
11866  if (bif_flag)
11867  {
11868  bif_row++;
11869  bif_column=0;
11870  }
11871 }
long long orig_max_rec_size
Definition: iozone.c:1383
int bif_column
Definition: iozone.c:1298
long long max_y
Definition: iozone.c:1275
void do_float()
off64_t get_next_record_size()
struct runtime runtimes[MAX_X][MAX_Y]
Definition: iozone.c:1330
int bif_row
Definition: iozone.c:1298
int bif_fd
Definition: iozone.c:1297
off64_t report_array[MAX_X][MAX_Y]
Definition: iozone.c:1269
char silent
Definition: iozone.c:1295
char bif_flag
Definition: iozone.c:1307
long long off64_t
Definition: iozone.c:357
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ exit()

void exit ( )

◆ fetchit() [1/2]

void fetchit ( )
Here is the caller graph for this function:

◆ fetchit() [2/2]

void fetchit ( char *  buffer,
long long  length 
)

Definition at line 6909 of file iozone.c.

6913 {
6914  char *where;
6915  volatile long long x[4];
6916  long long i;
6917  where=(char *)buffer;
6918  for(i=0;i<(length/cache_line_size);i++)
6919  {
6920  x[(i & 3)]=*(where);
6921  where+=cache_line_size;
6922 
6923  }
6924 }
unsigned long cache_line_size
Definition: iozone.c:1376
unsigned int length
long long x
Definition: iozone.c:1335
char * buffer
Definition: iozone.c:1366
int i
Definition: fileop.c:140

◆ fill_area()

fill_area ( long long *  src_buffer,
long long *  dest_buffer,
long long  length 
)

Definition at line 19014 of file iozone.c.

19019 {
19020  /*printf("Fill area %d\n",(size_t)length);*/
19021  bcopy((void *)src_buffer,(void *)dest_buffer,(size_t)length);
19022 }
unsigned int length
Here is the caller graph for this function:

◆ fill_buffer() [1/2]

void fill_buffer ( )
Here is the caller graph for this function:

◆ fill_buffer() [2/2]

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

Definition at line 7115 of file iozone.c.

7122 {
7123  unsigned long long *where;
7124  long long i,j,xx2;
7125  long long mpattern;
7126  unsigned int seed;
7127  unsigned long x;
7128  unsigned long long value,value1;
7129  unsigned long long a = 0x01020304;
7130  unsigned long long b = 0x05060708;
7131  unsigned long long c = 0x01010101;
7132  unsigned long long d = 0x01010101;
7133 
7134  value = (a << 32) | b;
7135  value1 = (c << 32) | d;
7136 
7137  xx2=chid;
7138  if(share_file)
7139  xx2=(long long)0;
7140  x=0;
7141  mpattern=pattern;
7142  /* printf("Fill: Sverify %d verify %d diag_v %d\n",sverify,verify,diag_v);*/
7143  if(dedup)
7144  {
7145  gen_new_buf((char *)dedup_ibuf,(char *)buffer, (long)recnum, (int)length,(int)dedup, (int) dedup_interior, dedup_compress, 1);
7146  return;
7147  }
7148  if(diag_v)
7149  {
7150  /*if(client_iozone)
7151  base_time=0;
7152  */
7153  if(no_unlink)
7154  base_time=0;
7155  seed= (unsigned int)(base_time+xx2+recnum);
7156  srand(seed);
7157  mpattern=(long long)rand();
7158  mpattern=(mpattern<<48) | (mpattern<<32) | (mpattern<<16) | mpattern;
7159  mpattern=mpattern+value;
7160  }
7161  where=(unsigned long long *)buffer;
7162  if(sverify == 1)
7163  {
7164  for(i=0;i<(length);i+=page_size)
7165  {
7166  *where = (long long)((pattern<<32) | pattern);
7167  where+=(page_size/sizeof(long long));
7168  /* printf("Filling page %lld \n",i/page_size);*/
7169  }
7170  }
7171  else
7172  {
7173  for(i=0;i<(length/cache_line_size);i++)
7174  {
7175  for(j=0;j<(cache_line_size/sizeof(long long));j++)
7176  {
7177  if(diag_v)
7178  {
7179  *where = (long long)(mpattern);
7180  mpattern=mpattern+value1;
7181  }
7182  else
7183  *where = (long long)((pattern<<32) | pattern);
7184  where++;
7185  }
7186  }
7187  }
7188 }
unsigned long cache_line_size
Definition: iozone.c:1376
char diag_v
Definition: iozone.c:1304
int no_unlink
Definition: iozone.c:1521
char dedup_compress
Definition: iozone.c:1304
double c
Definition: multiplex.c:22
int gen_new_buf()
char * dedup_ibuf
Definition: iozone.c:1305
long base_time
Definition: iozone.c:1323
char sverify
Definition: iozone.c:1515
void srand()
long long page_size
Definition: iozone.c:428
unsigned int length
char dedup
Definition: iozone.c:1304
long long chid
Definition: iozone.c:1529
long long x
Definition: iozone.c:1335
char * buffer
Definition: iozone.c:1366
int share_file
Definition: iozone.c:1309
char dedup_interior
Definition: iozone.c:1304
unsigned int pattern
Definition: iozone.c:1531
int rand()
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:39
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:38
int i
Definition: fileop.c:140
Here is the call graph for this function:

◆ find_external_mon()

void find_external_mon ( char *  imon_start,
char*  imon_stop 
)

Definition at line 22729 of file iozone.c.

22732 {
22733  char *start,*stop,*sync;
22734  imon_start[0]=(char)0;
22735  imon_stop[0]=(char)0;
22736  start=(char *)getenv("IMON_START");
22737  if(start)
22738  {
22739  strcpy(imon_start,start);
22740  }
22741  stop=(char *)getenv("IMON_STOP");
22742  if(stop)
22743  {
22744  strcpy(imon_stop,stop);
22745  }
22746  sync=(char *)getenv("IMON_SYNC");
22747  if(sync)
22748  {
22749  imon_sync=1;
22750  }
22751 
22752  return;
22753 }
char * getenv()
char imon_sync
Definition: iozone.c:1319
static struct timeval start
char imon_start[256]
Definition: iozone.c:1318
char imon_stop[256]
Definition: iozone.c:1318
Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_remote_shell() [1/2]

void find_remote_shell ( )
Here is the caller graph for this function:

◆ find_remote_shell() [2/2]

void find_remote_shell ( char *  shell)

Definition at line 22706 of file iozone.c.

22709 {
22710  char *value;
22711  value=(char *)getenv("RSH");
22712  if(value)
22713  {
22714  strcpy(shell,value);
22715  return;
22716  }
22717 #ifdef _HPUX_SOURCE
22718  strcpy(shell,"remsh");
22719 #else
22720  strcpy(shell,"rsh");
22721 #endif
22722  return;
22723 }
char * getenv()
Here is the call graph for this function:

◆ fread_perf_test() [1/2]

void fread_perf_test ( )

◆ fread_perf_test() [2/2]

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

Definition at line 8083 of file iozone.c.

8088 {
8089  double starttime2;
8090  double readtime[2];
8091  double walltime[2], cputime[2];
8092  double compute_val = (double)0;
8093  long long j;
8095  long long Index = 0;
8096  unsigned long long readrate[2];
8098  FILE *stream = 0;
8099  char *stdio_buf;
8100  int fd,ltest;
8101 
8102  if(mmapflag || async_flag)
8103  return;
8104  numrecs64 = (kilo64*1024)/reclen;
8106  stdio_buf=(char *)malloc((size_t)reclen);
8107 
8108  if(noretest)
8109  ltest=1;
8110  else
8111  ltest=2;
8112 
8113  for( j=0; j<ltest; j++ )
8114  {
8115  if(cpuutilflag)
8116  {
8117  walltime[j] = time_so_far();
8118  cputime[j] = cputime_so_far();
8119  }
8120 
8121  if(Uflag) /* Unmount and re-mount the mountpoint */
8122  {
8124  }
8125 #ifdef IRIX64
8126  if((stream=(FILE *)fopen(filename,"r")) == 0)
8127  {
8128  printf("\nCan not fdopen temp file: %s\n",
8129  filename);
8130  perror("fdopen");
8131  exit(51);
8132  }
8133 #else
8134  if((stream=(FILE *)I_FOPEN(filename,"r")) == 0)
8135  {
8136  printf("\nCan not fdopen temp file: %s\n",
8137  filename);
8138  perror("fdopen");
8139  exit(52);
8140  }
8141 #endif
8142  fd=I_OPEN(filename,O_RDONLY,0);
8143  fsync(fd);
8144  close(fd);
8145  setvbuf(stream,stdio_buf,_IOFBF,reclen);
8147  if(fetchon)
8149  compute_val=(double)0;
8150  starttime2 = time_so_far();
8151  for(i=0; i<numrecs64; i++)
8152  {
8153  if(compute_flag)
8154  compute_val+=do_compute(compute_time);
8155  if(multi_buffer)
8156  {
8157  Index +=reclen;
8158  if(Index > (MAXBUFFERSIZE-reclen))
8159  Index=0;
8160  buffer = mbuffer + Index;
8161  }
8162  if(purge)
8164  if(fread(buffer, (size_t) reclen,1, stream) != 1)
8165  {
8166 #ifdef _64BIT_ARCH_
8167 #ifdef NO_PRINT_LLD
8168  printf("\nError freading block %lu %lx\n", i,
8169  (unsigned long long)buffer);
8170 #else
8171  printf("\nError freading block %llu %llx\n", i,
8172  (unsigned long long)buffer);
8173 #endif
8174 #else
8175 #ifdef NO_PRINT_LLD
8176  printf("\nError freading block %lu %lx\n", i,
8177  (long)buffer);
8178 #else
8179  printf("\nError freading block %llu %lx\n", i,
8180  (long)buffer);
8181 #endif
8182 #endif
8183  perror("read");
8184  exit(54);
8185  }
8186  if(verify){
8188  exit(55);
8189  }
8190  }
8191  }
8192  if(include_flush)
8193  fflush(stream);
8194  if(include_close)
8195  {
8196  fclose(stream);
8197  }
8198  readtime[j] = ((time_so_far() - starttime2)-time_res)
8199  -compute_val;
8200  if(readtime[j] < (double).000001)
8201  {
8202  readtime[j]= time_res;
8203  if(rec_prob < reclen)
8204  rec_prob = reclen;
8205  res_prob=1;
8206  }
8207  if(!include_close)
8208  {
8209  fflush(stream);
8210  fclose(stream);
8211  }
8212  stream = NULL;
8213  if(cpuutilflag)
8214  {
8215  cputime[j] = cputime_so_far() - cputime[j];
8216  if (cputime[j] < cputime_res)
8217  cputime[j] = 0.0;
8218  walltime[j] = time_so_far() - walltime[j];
8219  if (walltime[j] < cputime[j])
8220  walltime[j] = cputime[j];
8221  }
8222  if(restf)
8223  sleep((int)rest_val);
8224  }
8225  free(stdio_buf);
8226  if(OPS_flag || MS_flag){
8228  }
8229  for(j=0;j<ltest;j++)
8230  {
8231  if(MS_flag)
8232  {
8233  readrate[j]=1000000.0*(readtime[j] / (double)filebytes64);
8234  continue;
8235  }
8236  else
8237  {
8238  readrate[j] =
8239  (unsigned long long) ((double) filebytes64 / readtime[j]);
8240  }
8241  if(!(OPS_flag || MS_flag))
8242  readrate[j] >>= 10;
8243  }
8244  data1[0]=readrate[0];
8245  data2[0]=1;
8246  if(noretest)
8247  {
8248  readrate[1]=(long long)0;
8249  if(cpuutilflag)
8250  {
8251  walltime[1]=0.0;
8252  cputime[1]=0.0;
8253  }
8254  }
8255  /* Must save walltime & cputime before calling store_value() for each/any cell.*/
8256  if(cpuutilflag)
8257  store_times(walltime[0], cputime[0]);
8258  store_value((off64_t)readrate[0]);
8259  if(cpuutilflag)
8260  store_times(walltime[1], cputime[1]);
8261  store_value((off64_t)readrate[1]);
8262 #ifdef NO_PRINT_LLD
8263  if(!silent) printf("%8ld",readrate[0]);
8264  if(!silent) printf("%9ld",readrate[1]);
8265  if(!silent) fflush(stdout);
8266 #else
8267  if(!silent) printf("%8lld",readrate[0]);
8268  if(!silent) printf("%9lld",readrate[1]);
8269  if(!silent) fflush(stdout);
8270 #endif
8271 }
void fetchit()
void purgeit()
store_times(double walltime, double cputime)
Definition: iozone.c:11551
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
store_value(off64_t value)
Definition: iozone.c:11518
char verify
Definition: iozone.c:1513
char mmapflag
Definition: iozone.c:1512
int fd
Definition: iozone.c:1291
int restf
Definition: iozone.c:1514
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
Definition: appio.c:275
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
long long multi_buffer
Definition: iozone.c:1290
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long reclen
Definition: iozone.c:1535
float compute_time
Definition: iozone.c:1538
char Uflag
Definition: iozone.c:1329
char * mbuffer
Definition: iozone.c:1366
char noretest
Definition: iozone.c:1510
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char * mainbuffer
Definition: iozone.c:1366
purge_buffer_cache()
Definition: iozone.c:12274
#define MAXBUFFERSIZE
Definition: iozone.c:809
char * buffer
Definition: iozone.c:1366
off64_t numrecs64
Definition: iozone.c:1534
long long verify_buffer(char *buffer, long long length, off64_t recnum, long long recsize, unsigned long long patt, char sverify)
Definition: iozone.c:6940
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
int close()
#define cputime_so_far()
Definition: iozone.c:973
char silent
Definition: iozone.c:1295
long long res_prob
Definition: iozone.c:1294
static double time_so_far()
Definition: iozone.c:6844
char include_close
Definition: iozone.c:1519
char OPS_flag
Definition: iozone.c:1517
void exit()
setvbuf(file, file_buf, _IOFBF, sizeof(file_buf))
int fsync()
double cputime_res
Definition: iozone.c:1271
long long rest_val
Definition: iozone.c:1540
long long off64_t
Definition: iozone.c:357
int i
Definition: fileop.c:140
#define I_FOPEN(x, y)
Definition: iozone.c:1185
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ fsync()

int fsync ( )
Here is the caller graph for this function:

◆ fwrite_perf_test() [1/2]

void fwrite_perf_test ( )

◆ fwrite_perf_test() [2/2]

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

Definition at line 7859 of file iozone.c.

7865 {
7866  double starttime1;
7867  double writetime[2];
7868  double walltime[2], cputime[2];
7869  double compute_val = (double)0;
7870  long long i,j;
7872  long long Index = 0;
7873  unsigned long long writerate[2];
7875  FILE *stream = NULL;
7876  int fd;
7877  int wval;
7878  int ltest;
7879  char *how;
7880  char *stdio_buf;
7881 
7882  if(mmapflag || async_flag)
7883  return;
7884  numrecs64 = (kilo64*1024)/reclen;
7886  stdio_buf=(char *)malloc((size_t)reclen);
7887  if(noretest)
7888  ltest=1;
7889  else
7890  ltest=2;
7891 
7892  for( j=0; j<ltest; j++)
7893  {
7894  if(cpuutilflag)
7895  {
7896  walltime[j] = time_so_far();
7897  cputime[j] = cputime_so_far();
7898  }
7899  if(Uflag) /* Unmount and re-mount the mountpoint */
7900  {
7902  }
7903  if(j==0)
7904  {
7906  how="r+"; /* file exists, don't create and zero a new one. */
7907  else
7908  how="w+"; /* file doesn't exist. create it. */
7909  }
7910  else
7911  how="r+"; /* re-tests should error out if file does not exist. */
7912 #ifdef IRIX64
7913  if((stream=(FILE *)fopen(filename,how)) == 0)
7914  {
7915  printf("\nCan not fdopen temp file: %s %lld\n",
7916  filename,errno);
7917  perror("fdopen");
7918  exit(48);
7919  }
7920 #else
7921  if((stream=(FILE *)I_FOPEN(filename,how)) == 0)
7922  {
7923 #ifdef NO_PRINT_LLD
7924  printf("\nCan not fdopen temp file: %s %d\n",
7925  filename,errno);
7926 #else
7927  printf("\nCan not fdopen temp file: %s %d\n",
7928  filename,errno);
7929 #endif
7930  perror("fdopen");
7931  exit(49);
7932  }
7933 #endif
7934  fd=fileno(stream);
7935  fsync(fd);
7936  setvbuf(stream,stdio_buf,_IOFBF,reclen);
7938  if(fetchon)
7940  if(verify || dedup || dedup_interior)
7941  fill_buffer(buffer,reclen,(long long)pattern,sverify,(long long)0);
7942  starttime1 = time_so_far();
7943  compute_val=(double)0;
7944  for(i=0; i<numrecs64; i++){
7945  if(compute_flag)
7946  compute_val+=do_compute(compute_time);
7947  if(multi_buffer)
7948  {
7949  Index +=reclen;
7950  if(Index > (MAXBUFFERSIZE-reclen))
7951  Index=0;
7952  buffer = mbuffer + Index;
7953  }
7954  if((verify & diag_v) || dedup || dedup_interior)
7955  fill_buffer(buffer,reclen,(long long)pattern,sverify,i);
7956  if(purge)
7958  if(fwrite(buffer, (size_t) reclen, 1, stream) != 1)
7959  {
7960 #ifdef NO_PRINT_LLD
7961  printf("\nError fwriting block %ld, fd= %d\n", i,
7962  fd);
7963 #else
7964  printf("\nError fwriting block %lld, fd= %d\n", i,
7965  fd);
7966 #endif
7967  perror("fwrite");
7968  signal_handler();
7969  }
7970  }
7971 
7972  if(include_flush)
7973  {
7974  fflush(stream);
7975  wval=fsync(fd);
7976  if(wval==-1){
7977  perror("fsync");
7978  signal_handler();
7979  }
7980  }
7981  if(include_close)
7982  {
7983  wval=fclose(stream);
7984  if(wval==-1){
7985  perror("fclose");
7986  signal_handler();
7987  }
7988  }
7989  writetime[j] = ((time_so_far() - starttime1)-time_res)
7990  -compute_val;
7991  if(writetime[j] < (double).000001)
7992  {
7993  writetime[j]= time_res;
7994  if(rec_prob < reclen)
7995  rec_prob = reclen;
7996  res_prob=1;
7997  }
7998  if(!include_close)
7999  {
8000  wval=fflush(stream);
8001  if(wval==-1){
8002  perror("fflush");
8003  signal_handler();
8004  }
8005  wval=fsync(fd);
8006  if(wval==-1){
8007  perror("fsync");
8008  signal_handler();
8009  }
8010  wval=fclose(stream);
8011  if(wval==-1){
8012  perror("fclose");
8013  signal_handler();
8014  }
8015  }
8016 
8017  if(cpuutilflag)
8018  {
8019  cputime[j] = cputime_so_far() - cputime[j];
8020  if (cputime[j] < cputime_res)
8021  cputime[j] = 0.0;
8022  walltime[j] = time_so_far() - walltime[j];
8023  if (walltime[j] < cputime[j])
8024  walltime[j] = cputime[j];
8025  }
8026  if(restf)
8027  sleep((int)(int)rest_val);
8028  }
8029  free(stdio_buf);
8030  if(OPS_flag || MS_flag){
8032  }
8033  for(j=0;j<ltest;j++)
8034  {
8035  if(MS_flag)
8036  {
8037  writerate[j]=1000000.0*(writetime[j] / (double)filebytes64);
8038  continue;
8039  }
8040  else
8041  {
8042  writerate[j] =
8043  (unsigned long long) ((double) filebytes64 / writetime[j]);
8044  }
8045  if(!(OPS_flag || MS_flag))
8046  writerate[j] >>= 10;
8047  }
8048  /* Must save walltime & cputime before calling store_value() for each/any cell.*/
8049  if(noretest)
8050  {
8051  writerate[1]=(long long)0;
8052  if(cpuutilflag)
8053  {
8054  walltime[1]=0.0;
8055  cputime[1]=0.0;
8056  }
8057  }
8058  if(cpuutilflag)
8059  store_times(walltime[0], cputime[0]);
8060  store_value((off64_t)writerate[0]);
8061  if(cpuutilflag)
8062  store_times(walltime[1], cputime[1]);
8063  store_value((off64_t)writerate[1]);
8064  data1[0]=writerate[0];
8065 #ifdef NO_PRINT_LLD
8066  if(!silent) printf("%9ld",writerate[0]);
8067  if(!silent) printf("%9ld",writerate[1]);
8068  if(!silent) fflush(stdout);
8069 #else
8070  if(!silent) printf("%9lld",writerate[0]);
8071  if(!silent) printf("%9lld",writerate[1]);
8072  if(!silent) fflush(stdout);
8073 #endif
8074 }
int check_filename()
void fetchit()
void purgeit()
store_times(double walltime, double cputime)
Definition: iozone.c:11551
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
char diag_v
Definition: iozone.c:1304
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
Definition: appio.c:387
store_value(off64_t value)
Definition: iozone.c:11518
char verify
Definition: iozone.c:1513
void fill_buffer()
char mmapflag
Definition: iozone.c:1512
int fd
Definition: iozone.c:1291
int restf
Definition: iozone.c:1514
void signal_handler()
Definition: iozone.c:3336
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
long long multi_buffer
Definition: iozone.c:1290
long long reclen
Definition: iozone.c:1535
float compute_time
Definition: iozone.c:1538
char Uflag
Definition: iozone.c:1329
char * mbuffer
Definition: iozone.c:1366
char noretest
Definition: iozone.c:1510
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char * mainbuffer
Definition: iozone.c:1366
char dedup
Definition: iozone.c:1304
purge_buffer_cache()
Definition: iozone.c:12274
#define MAXBUFFERSIZE
Definition: iozone.c:809
char * buffer
Definition: iozone.c:1366
off64_t numrecs64
Definition: iozone.c:1534
char dedup_interior
Definition: iozone.c:1304
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
#define cputime_so_far()
Definition: iozone.c:973
char silent
Definition: iozone.c:1295
long long res_prob
Definition: iozone.c:1294
static double time_so_far()
Definition: iozone.c:6844
char include_close
Definition: iozone.c:1519
char OPS_flag
Definition: iozone.c:1517
void exit()
setvbuf(file, file_buf, _IOFBF, sizeof(file_buf))
int fsync()
double cputime_res
Definition: iozone.c:1271
long long rest_val
Definition: iozone.c:1540
long long off64_t
Definition: iozone.c:357
int errno
int i
Definition: fileop.c:140
#define I_FOPEN(x, y)
Definition: iozone.c:1185
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ gen_new_buf() [1/2]

int gen_new_buf ( )
Here is the caller graph for this function:

◆ gen_new_buf() [2/2]

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.

23733 {
23734  register long *ip, *op; /* Register for speed */
23735  register long iseed; /* Register for speed */
23736  register long isize; /* Register for speed */
23737  register long cseed; /* seed for dedupable for within & ! across */
23738  register int x,w; /* Register for speed */
23739  register int value; /* Register for speed */
23740  register int interior_size; /* size of interior dedup region */
23741  register int compress_size; /* size of compression dedup region */
23742  if(ibuf == NULL) /* no input buf */
23743  return(-1);
23744  if(obuf == NULL) /* no output buf */
23745  return(-1);
23746  if((percent > 100) || (percent < 0)) /* percent check */
23747  return(-1);
23748  if(size == 0) /* size check */
23749  return(-1);
23750  srand(seed+1+(((int)numrecs64)*dedup_mseed)); /* set random seed */
23751  iseed = rand(); /* generate random value */
23752  isize = (size * percent)/100; /* percent that is dedupable */
23753  interior_size = ((isize * percent_interior)/100);/* /sizeof(long) */
23754  compress_size =((interior_size * percent_compress)/100);
23755  ip = (long *)ibuf; /* pointer to input buf */
23756  op = (long *)obuf; /* pointer to output buf */
23757  if(all == 0) /* Special case for verify only */
23758  isize = sizeof(long);
23759  /* interior_size = dedup_within + dedup_across */
23760  for(w=0;w<interior_size;w+=sizeof(long))
23761  {
23762  *op=0xdeadbeef+dedup_mseed;
23763  *ip=0xdeadbeef+dedup_mseed;
23764  op++;
23765  ip++;
23766  }
23767  /* Prepare for dedup within but not across */
23768  w=interior_size - compress_size;
23769  op=(long *)&obuf[w];
23770  ip=(long *)&ibuf[w];
23771  srand(chid+1+dedup_mseed); /* set randdom seed */
23772  cseed = rand(); /* generate random value */
23773  for(w=(interior_size-compress_size);w<interior_size;w+=sizeof(long))
23774  {
23775  *op=*ip ^ cseed; /* do the xor op */
23776  op++;
23777  ip++;
23778  }
23779  /* isize = dedup across only */
23780  for(x=interior_size;x<isize;x+=sizeof(long)) /* tight loop for transformation */
23781  {
23782  *op=*ip ^ iseed; /* do the xor op */
23783  op++;
23784  ip++;
23785  }
23786  if(all == 0) /* Special case for verify only */
23787  return(0);
23788  /* make the rest of the buffer non-dedupable */
23789  if(100-percent > 0)
23790  {
23791  srand(1+seed+((chid+1)*(int)numrecs64)*dedup_mseed);
23792  value=rand();
23793 /* printf("Non-dedup value %x seed %x\n",value,seed);*/
23794  for( ; x<size;x+=sizeof(long))
23795  *op++=(*ip++)^value; /* randomize the remainder */
23796  }
23797  return(0);
23798 }
int dedup_mseed
Definition: iozone.c:1299
void srand()
long long chid
Definition: iozone.c:1529
long long x
Definition: iozone.c:1335
off64_t numrecs64
Definition: iozone.c:1534
int rand()
Here is the call graph for this function:

◆ genrand64_int63()

long long genrand64_int63 ( void  )

Definition at line 23960 of file iozone.c.

23961 {
23962  return (long long)(genrand64_int64() >> 1);
23963 }
unsigned long long genrand64_int64(void)
Definition: iozone.c:23922
Here is the call graph for this function:

◆ genrand64_int64()

unsigned long long genrand64_int64 ( void  )

Definition at line 23922 of file iozone.c.

23923 {
23924  int i;
23925  unsigned long long x;
23926  static unsigned long long mag01[2]={0ULL, MATRIX_A};
23927 
23928  if (mti >= NN) { /* generate NN words at one time */
23929 
23930  /* if init_genrand64() has not been called, */
23931  /* a default initial seed is used */
23932  if (mti == NN+1)
23933  init_genrand64(5489ULL);
23934 
23935  for (i=0;i<NN-MM;i++) {
23936  x = (mt[i]&UM)|(mt[i+1]&LM);
23937  mt[i] = mt[i+MM] ^ (x>>1) ^ mag01[(int)(x&1ULL)];
23938  }
23939  for (;i<NN-1;i++) {
23940  x = (mt[i]&UM)|(mt[i+1]&LM);
23941  mt[i] = mt[i+(MM-NN)] ^ (x>>1) ^ mag01[(int)(x&1ULL)];
23942  }
23943  x = (mt[NN-1]&UM)|(mt[0]&LM);
23944  mt[NN-1] = mt[MM-1] ^ (x>>1) ^ mag01[(int)(x&1ULL)];
23945 
23946  mti = 0;
23947  }
23948 
23949  x = mt[mti++];
23950 
23951  x ^= (x >> 29) & 0x5555555555555555ULL;
23952  x ^= (x << 17) & 0x71D67FFFEDA60000ULL;
23953  x ^= (x << 37) & 0xFFF7EEE000000000ULL;
23954  x ^= (x >> 43);
23955 
23956  return x;
23957 }
static int mti
Definition: iozone.c:23884
#define MATRIX_A
Definition: iozone.c:23876
void init_genrand64(unsigned long long seed)
Definition: iozone.c:23887
#define MM
Definition: iozone.c:23875
static unsigned long long mt[NN]
Definition: iozone.c:23882
#define NN
Definition: iozone.c:23874
long long x
Definition: iozone.c:1335
#define UM
Definition: iozone.c:23877
#define LM
Definition: iozone.c:23878
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ genrand64_real1()

double genrand64_real1 ( void  )

Definition at line 23966 of file iozone.c.

23967 {
23968  return (genrand64_int64() >> 11) * (1.0/9007199254740991.0);
23969 }
unsigned long long genrand64_int64(void)
Definition: iozone.c:23922
Here is the call graph for this function:

◆ genrand64_real2()

double genrand64_real2 ( void  )

Definition at line 23972 of file iozone.c.

23973 {
23974  return (genrand64_int64() >> 11) * (1.0/9007199254740992.0);
23975 }
unsigned long long genrand64_int64(void)
Definition: iozone.c:23922
Here is the call graph for this function:

◆ genrand64_real3()

double genrand64_real3 ( void  )

Definition at line 23978 of file iozone.c.

23979 {
23980  return ((genrand64_int64() >> 12) + 0.5) * (1.0/4503599627370496.0);
23981 }
unsigned long long genrand64_int64(void)
Definition: iozone.c:23922
Here is the call graph for this function:

◆ get_client_info()

int get_client_info ( )

Definition at line 22417 of file iozone.c.

22419 {
22420  FILE *fd;
22421  char *ret1;
22422  int count;
22423  char buffer[200];
22424  count=0;
22425  fd=fopen(client_filename,"r");
22426  if(fd == (FILE *)NULL)
22427  {
22428  printf("Unable to open client file \"%s\"\n",
22429  client_filename);
22430  exit(176);
22431  }
22432  while(1)
22433  {
22434  if (count > MAXSTREAMS) {
22435  printf("Too many lines in client file - max of %d supported\n",
22436  MAXSTREAMS);
22437  exit(7);
22438  }
22439  ret1=fgets(buffer,200,fd);
22440  if(ret1== (char *)NULL)
22441  break;
22443  }
22444  fclose(fd);
22445  return(count);
22446 }
int fd
Definition: iozone.c:1291
char * buffer
Definition: iozone.c:1366
int parse_client_line()
char client_filename[256]
Definition: iozone.c:1396
void exit()
#define MAXSTREAMS
Definition: iozone.c:813
static long count
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_date() [1/2]

void get_date ( )
Here is the caller graph for this function:

◆ get_date() [2/2]

get_date ( char *  where)

Definition at line 23556 of file iozone.c.

23559 {
23560  time_t t;
23561  char *value;
23562  t=time(0);
23563  value=(char *)ctime(&t);
23564  strcpy(where,value);
23565 }

◆ get_next_file_size() [1/2]

off64_t get_next_file_size ( )
Here is the caller graph for this function:

◆ get_next_file_size() [2/2]

off64_t get_next_file_size ( off64_t  size)

Definition at line 20070 of file iozone.c.

20073 {
20074  struct size_entry *size_listp;
20075 
20076  size_listp=size_list;
20077 
20078  for( ; size_listp ; size_listp=size_listp->next )
20079  {
20080  if(size_listp->size > size)
20081  return(size_listp->size);
20082  }
20083  return((off64_t)0);
20084 }
Definition: iozone.c:1350
struct size_entry * size_list
Definition: iozone.c:1354
off64_t size
Definition: iozone.c:1352
struct size_entry * next
Definition: iozone.c:1351
long long off64_t
Definition: iozone.c:357

◆ get_next_record_size() [1/2]

off64_t get_next_record_size ( )
Here is the caller graph for this function:

◆ get_next_record_size() [2/2]

off64_t get_next_record_size ( off64_t  size)

Definition at line 20193 of file iozone.c.

20196 {
20197  struct size_entry *size_listp;
20198 
20199  size_listp=rec_size_list;
20200 
20201  for( ; size_listp ; size_listp=size_listp->next )
20202  {
20203  if(size_listp->size > size)
20204  return(size_listp->size);
20205  }
20206  return((off64_t)0);
20207 }
Definition: iozone.c:1350
struct size_entry * rec_size_list
Definition: iozone.c:1355
off64_t size
Definition: iozone.c:1352
struct size_entry * next
Definition: iozone.c:1351
long long off64_t
Definition: iozone.c:357

◆ get_pattern()

get_pattern ( void  )

Definition at line 23584 of file iozone.c.

23586 {
23587  int i,x,y;
23588  char cp[100],*ptr;
23589  int pat;
23590  unsigned char inp_pat;
23591  unsigned int temp;
23592 
23593  y=0;
23594  ptr=&cp[0];
23595  strcpy(cp,THISVERSION);
23596  x=strlen(THISVERSION);
23597  for(i=0;i<x;i++)
23598  y+=*ptr++;
23599  srand(y);
23600  pat=(rand()& 0xff);
23601  /* For compatibility with old 0xa5 data sets. */
23602  if(Z_flag)
23603  pat=0xa5;
23604  /* Lock pattern to 0xBB, for filesystem short circuit debug */
23605  if(X_flag)
23606  pat=PATTERN1;
23607  /* Set global pattern */
23608  inp_pat = pat;
23609  temp =((inp_pat << 24) | (inp_pat << 16) | (inp_pat << 8) | inp_pat);
23610  return(pat);
23611 }
char X_flag
Definition: iozone.c:1520
void srand()
#define PATTERN1
Definition: iozone.c:823
char Z_flag
Definition: iozone.c:1520
long long x
Definition: iozone.c:1335
#define THISVERSION
Definition: iozone.c:63
int rand()
int i
Definition: fileop.c:140
long long y
Definition: iozone.c:1335
Here is the call graph for this function:

◆ get_resolution()

void get_resolution ( )

Definition at line 19131 of file iozone.c.

19133 {
19134  double starttime, finishtime, besttime = 0;
19135  long j,delay;
19136  int k;
19137 
19138  finishtime=time_so_far1(); /* Warm up the instruction cache */
19139  starttime=time_so_far1(); /* Warm up the instruction cache */
19140  delay=j=0; /* Warm up the data cache */
19141  for(k=0;k<10;k++)
19142  {
19143  while(1)
19144  {
19145  starttime=time_so_far1();
19146  for(j=0;j< delay;j++)
19147  ;
19148  finishtime=time_so_far1();
19149  if(starttime==finishtime)
19150  delay++;
19151  else
19152  {
19153  if(k==0)
19154  besttime=(finishtime-starttime);
19155  if((finishtime-starttime) < besttime)
19156  besttime=(finishtime-starttime);
19157  break;
19158  }
19159  }
19160  }
19161  time_res=besttime/1000000.0;
19162 }
long long delay
Definition: iozone.c:1533
static double time_so_far1()
Definition: iozone.c:19207
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_rusage_resolution()

void get_rusage_resolution ( )

Definition at line 19174 of file iozone.c.

19176 {
19177  double starttime, finishtime;
19178  long j;
19179 
19180  finishtime=cputime_so_far(); /* Warm up the instruction cache */
19181  starttime=cputime_so_far(); /* Warm up the instruction cache */
19182  delay=j=0; /* Warm up the data cache */
19183  while(1)
19184  {
19185  starttime=cputime_so_far();
19186  for(j=0;j< delay;j++)
19187  ;
19188  finishtime=cputime_so_far();
19189  if(starttime==finishtime)
19190 
19191  delay++;
19192  else
19193  break;
19194  }
19195  cputime_res = (finishtime-starttime); /* in seconds */
19196 }
long long delay
Definition: iozone.c:1533
#define cputime_so_far()
Definition: iozone.c:973
double cputime_res
Definition: iozone.c:1271
Here is the caller graph for this function:

◆ get_traj() [1/2]

long long get_traj ( )
Here is the caller graph for this function:

◆ get_traj() [2/2]

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

Definition at line 19596 of file iozone.c.

19602 {
19603  long long traj_offset = 0;
19604  long long tmp2 = 0;
19605  int tmp = 0;
19606  int tokens;
19607  int ret=0;
19608  char *ret1,*where;
19609  char buf[200];
19610  char sbuf[200];
19611  int got_line;
19612 
19613  got_line=0;
19614 
19615  while(got_line==0)
19616  {
19617  tokens=0;
19618  ret1=fgets(buf,200,traj_fd);
19619  if(ret1==(char *)0)
19620  {
19621  printf("\n\n\tEarly end of telemetry file. Results not accurate.\n");
19622  signal_handler();
19623  }
19624  where=(char *)&buf[0];
19625  strcpy(sbuf,buf);
19626  if((*where=='#') || (*where=='\n'))
19627  continue;
19628  tokens++;
19629  strtok(where," ");
19630  while( (char *)(strtok( (char *)0," ")) != (char *)0)
19631  {
19632  tokens++;
19633  }
19634  got_line=1;
19635  }
19636  if(tokens == 3)
19637  {
19638 #ifdef NO_PRINT_LLD
19639  ret=sscanf(sbuf,"%ld %ld %d\n",&traj_offset,&tmp2,&tmp);
19640 #else
19641  ret=sscanf(sbuf,"%lld %lld %d\n",&traj_offset,&tmp2,&tmp);
19642 #endif
19643  /*printf("\nReading %s trajectory with %d items\n",which?"write":"read",tokens);*/
19644  *traj_size=tmp2;
19645  *delay= ((float)tmp/1000);
19646  }
19647  if(tokens == 2)
19648  {
19649 #ifdef NO_PRINT_LLD
19650  ret=sscanf(sbuf,"%ld %ld\n",&traj_offset,traj_size);
19651 #else
19652  ret=sscanf(sbuf,"%lld %lld\n",&traj_offset,traj_size);
19653 #endif
19655  /*printf("\nReading %s trajectory with %d items\n",which?"write":"read",tokens);*/
19656  }
19657  if((tokens != 2) && (tokens !=3))
19658  {
19659  printf("\n\tInvalid entry in telemetry file. > %s <\n",sbuf);
19660  exit(178);
19661  }
19662  if(ret==EOF)
19663  {
19664  printf("\n\n\tEarly end of telemetry file. Results not accurate.\n");
19665  signal_handler();
19666  }
19667 #ifdef DEBUG
19668 #ifdef NO_PRINT_LLD
19669  if(!silent) printf("\nOffset %lld Size %ld Compute delay %f\n",traj_offset, *traj_size,*delay);
19670 #else
19671  if(!silent) printf("\nOffset %lld Size %lld Compute delay %f\n",traj_offset, *traj_size,*delay);
19672 #endif
19673 #endif
19674  return(traj_offset);
19675 }
void signal_handler()
Definition: iozone.c:3336
double tmp
float compute_time
Definition: iozone.c:1538
long long delay
Definition: iozone.c:1533
long long ret
Definition: iozone.c:1346
char silent
Definition: iozone.c:1295
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
void exit()
Here is the call graph for this function:

◆ getenv()

char* getenv ( )
Here is the caller graph for this function:

◆ hist_insert() [1/2]

void hist_insert ( )
Here is the caller graph for this function:

◆ hist_insert() [2/2]

void hist_insert ( double  my_value)

Definition at line 24255 of file iozone.c.

24256 {
24257  int k;
24258  long long value;
24259 
24260  /* Convert to micro-seconds */
24261  value = (long long)(my_value * 1000000);
24262  for(k=0;k<BUCKETS;k++)
24263  {
24264  if(k < (BUCKETS-1))
24265  {
24266  if(value <= bucket_val[k])
24267  {
24268  buckets[k]++;
24269  break;
24270  }
24271  }
24272  else
24273  {
24274  if(value > bucket_val[k])
24275  {
24276  buckets[k]++;
24277  break;
24278  }
24279  }
24280  }
24281 }
long long bucket_val[BUCKETS]
Definition: iozone.c:24213
#define BUCKETS
Definition: iozone.c:24211
long long buckets[BUCKETS]
Definition: iozone.c:24212

◆ inet_ntoa()

char* inet_ntoa ( )
Here is the caller graph for this function:

◆ init_by_array64() [1/2]

void init_by_array64 ( unsigned long long *  ,
unsigned long long   
)
Here is the caller graph for this function:

◆ init_by_array64() [2/2]

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

Definition at line 23897 of file iozone.c.

23899 {
23900  unsigned long long i, j, k;
23901  init_genrand64(19650218ULL);
23902  i=1; j=0;
23903  k = (NN>key_length ? NN : key_length);
23904  for (; k; k--) {
23905  mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 62)) * 3935559000370003845ULL))
23906  + init_key[j] + j; /* non linear */
23907  i++; j++;
23908  if (i>=NN) { mt[0] = mt[NN-1]; i=1; }
23909  if (j>=key_length) j=0;
23910  }
23911  for (k=NN-1; k; k--) {
23912  mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 62)) * 2862933555777941757ULL))
23913  - i; /* non linear */
23914  i++;
23915  if (i>=NN) { mt[0] = mt[NN-1]; i=1; }
23916  }
23917 
23918  mt[0] = 1ULL << 63; /* MSB is 1; assuring non-zero initial array */
23919 }
void init_genrand64(unsigned long long seed)
Definition: iozone.c:23887
static unsigned long long mt[NN]
Definition: iozone.c:23882
#define NN
Definition: iozone.c:23874
int i
Definition: fileop.c:140
Here is the call graph for this function:

◆ init_file_sizes() [1/2]

void init_file_sizes ( )
Here is the caller graph for this function:

◆ init_file_sizes() [2/2]

void init_file_sizes ( off64_t  min_f_size,
off64_t  max_f_size 
)

Definition at line 20000 of file iozone.c.

20004 {
20005  off64_t kilosi;
20006  int x;
20007  if(s_count > 1)
20008  {
20009  for(x=0; x < s_count; x++)
20010  {
20011  kilosi=s_range[x];
20012  add_file_size((off64_t)kilosi);
20013  }
20014  }
20015  else
20016  {
20017  for(kilosi=min_f_size;kilosi<=max_f_size;kilosi*=multiplier)
20018  {
20019  add_file_size((off64_t)kilosi);
20020  }
20021  }
20022 }
int s_count
Definition: iozone.c:1286
off64_t s_range[100]
Definition: iozone.c:1283
void add_file_size()
int multiplier
Definition: iozone.c:1539
long long x
Definition: iozone.c:1335
long long off64_t
Definition: iozone.c:357
Here is the call graph for this function:

◆ init_genrand64()

void init_genrand64 ( unsigned long long  seed)

Definition at line 23887 of file iozone.c.

23888 {
23889  mt[0] = seed;
23890  for (mti=1; mti<NN; mti++)
23891  mt[mti] = (6364136223846793005ULL * (mt[mti-1] ^ (mt[mti-1] >> 62)) + mti);
23892 }
static int mti
Definition: iozone.c:23884
static unsigned long long mt[NN]
Definition: iozone.c:23882
#define NN
Definition: iozone.c:23874
Here is the caller graph for this function:

◆ init_record_sizes() [1/2]

void init_record_sizes ( )
Here is the caller graph for this function:

◆ init_record_sizes() [2/2]

void init_record_sizes ( off64_t  min_r_size,
off64_t  max_r_size 
)

Definition at line 20099 of file iozone.c.

20103 {
20104  int x;
20105  off64_t size;
20106  if(r_count > 1)
20107  {
20108  for(x=0; x < r_count; x++)
20109  {
20110  size=r_range[x];
20112  }
20113  }
20114  else
20115  {
20116  for(size=min_r_size;size<=max_r_size;size*=multiplier)
20117  {
20119  }
20120  }
20121 }
void add_record_size()
off64_t r_range[100]
Definition: iozone.c:1282
int multiplier
Definition: iozone.c:1539
off64_t size
Definition: iozone.c:1352
long long x
Definition: iozone.c:1335
int r_count
Definition: iozone.c:1286
long long off64_t
Definition: iozone.c:357
Here is the call graph for this function:

◆ initfile() [1/2]

char* initfile ( )
Here is the caller graph for this function:

◆ initfile() [2/2]

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

Definition at line 18810 of file iozone.c.

18815 {
18816  char *pa;
18817  int mflags=0;
18818  long long x;
18819  char *tmp,*stmp;
18820  int file_flags;
18821  long long recs;
18822  long long i;
18823  int dflag = 0;
18824 
18825  if(flag)
18826  {
18827 
18828 #ifdef _HPUX_SOURCE
18829  /*
18830  * Save time, just have the operating system prealloc
18831  * the file
18832  */
18833  prealloc(fd,filebytes);
18834 #else
18835  /*
18836  * Allocate a temporary buffer to meet any alignment
18837  * contraints of any method.
18838  */
18839  tmp=(char *)malloc((size_t)reclen * 2);
18840  stmp=tmp;
18841  /*
18842  * Align to a reclen boundary.
18843  */
18844  tmp = (char *)((((long)tmp + (long)reclen))& ~(((long)reclen-1)));
18845  /*
18846  * Special case.. Open O_DIRECT, and going to be mmap()
18847  * Under Linux, one can not create a sparse file using
18848  * a file that is opened with O_DIRECT
18849  */
18850  file_flags=fcntl(fd,F_GETFL);
18851 
18852 #if ! defined(DONT_HAVE_O_DIRECT)
18853 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
18854  dflag = O_DIRECT;
18855 #endif
18856 #if defined(TRU64)
18857  if(direct_flag)
18858  dflag = O_DIRECTIO;
18859 #endif
18860 #endif
18861  if((file_flags & dflag) !=0)
18862  {
18863  recs=filebytes/reclen;
18864  for (i =0; i<recs ;i++)
18865  {
18866  x=write(fd,tmp,(size_t)reclen);
18867  if(x < 1)
18868  {
18869  printf("Unable to write file\n");
18870  exit(182);
18871  }
18872  }
18873  }
18874  else
18875  {
18876  /* Save time, just seek out and touch at the end */
18877  I_LSEEK(fd,(filebytes-reclen),SEEK_SET);
18878  x=write(fd,tmp,(size_t)reclen);
18879  if(x < 1)
18880  {
18881  printf("Unable to write file\n");
18882  exit(181);
18883  }
18884  }
18885  free(stmp);
18886  I_LSEEK(fd,0,SEEK_SET);
18887 #endif
18888  }
18889 
18890 #ifdef IRIX64
18891  if((prot & PROT_WRITE)==PROT_WRITE)
18892  mflags=MAP_SHARED;
18893  else
18894  mflags=MAP_PRIVATE;
18895 #else
18896 #ifdef IRIX
18897  if((prot & PROT_WRITE)==PROT_WRITE)
18898  mflags=MAP_SHARED;
18899  else
18900  mflags=MAP_PRIVATE;
18901 #else
18902  if((prot & PROT_WRITE)==PROT_WRITE)
18903  mflags=MAP_FILE|MAP_SHARED;
18904  else
18905  mflags=MAP_FILE|MAP_PRIVATE;
18906 #endif
18907 #endif
18908 
18909 #if defined(bsd4_2) && !defined(macosx)
18910  pa = (char *)mmap( 0,&filebytes, (int)prot,
18911  (int)mflags, (int)fd, 0);
18912 #else
18913  pa = (char *)I_MMAP( ((char *)0),filebytes, prot,
18914  mflags, fd, 0);
18915 #endif
18916 #ifdef __convex_spp
18917  if(pa == (char *)-1)
18918  {
18919  printf("\nMmap failed, errno %d Flags %x\n",errno,(int)mflags);
18920  exit(165);
18921  }
18922 #else
18923 #ifdef linux
18924  if(pa == (char *)-1)
18925  {
18926  printf("Mapping failed, errno %d\n",errno);
18927  exit(166);
18928  }
18929 #else
18930 #ifdef bsd4_2
18931  if(pa == (char *)-1)
18932  {
18933  printf("Mapping failed, errno %d\n",errno);
18934  exit(167);
18935  }
18936 #else
18937  if(pa == (char *)MAP_FAILED)
18938  {
18939  printf("\nMapping failed, errno %d Flags = %x\n",errno,mflags);
18940  exit(168);
18941  }
18942 #endif
18943 #endif
18944 #endif
18945 #ifndef NO_MADVISE
18946  if(advise_flag)
18947  {
18948  switch(advise_op){
18949  case 0:
18950  madvise( (char *)pa, (size_t) filebytes, MADV_NORMAL);
18951  break;
18952  case 1:
18953  madvise( (char *)pa, (size_t) filebytes, MADV_RANDOM);
18954  break;
18955  case 2:
18956  madvise( (char *)pa, (size_t) filebytes, MADV_SEQUENTIAL);
18957  break;
18958  case 3:
18959  madvise( (char *)pa, (size_t) filebytes, MADV_DONTNEED);
18960  break;
18961  case 4:
18962  madvise( (char *)pa, (size_t) filebytes, MADV_WILLNEED);
18963  break;
18964  default:
18965  break;
18966  };
18967  }
18968 
18969 #endif
18970  return(pa);
18971 
18972 }
#define I_MMAP(a, b, c, d, e, f)
Definition: iozone.c:1191
int fd
Definition: iozone.c:1291
int advise_op
Definition: iozone.c:1526
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
int advise_flag
Definition: iozone.c:1526
long long reclen
Definition: iozone.c:1535
double tmp
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
long long x
Definition: iozone.c:1335
#define MAP_FAILED
Definition: iozone.c:336
void exit()
int errno
int i
Definition: fileop.c:140
int direct_flag
Definition: iozone.c:1527
Here is the call graph for this function:

◆ Kill() [1/2]

void Kill ( )
Here is the caller graph for this function:

◆ Kill() [2/2]

void Kill ( long long  pid,
long long  sig 
)

Definition at line 12195 of file iozone.c.

12198 {
12199  if(!xflag)
12200  {
12201  /*printf("Killing %d\n",pid);*/
12202  kill((pid_t)pid,(int)sig);
12203  }
12204 }
static int pid
int kill(__pid_t __pid, int __sig) __attribute__((__nothrow__
char xflag
Definition: iozone.c:1520
Here is the call graph for this function:

◆ l_max() [1/2]

long long l_max ( )
Here is the caller graph for this function:

◆ l_max() [2/2]

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

Definition at line 12179 of file iozone.c.

12182 {
12183  if(one > two)
12184  return(one);
12185  else
12186  return(two);
12187 }
int one

◆ l_min() [1/2]

long long l_min ( )
Here is the caller graph for this function:

◆ l_min() [2/2]

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

Definition at line 12212 of file iozone.c.

12215 {
12216  if(num1 >= num2)
12217  return num2;
12218  else
12219  return num1;
12220 }

◆ lrand48()

long lrand48 ( )
Here is the caller graph for this function:

◆ main() [1/2]

int main ( )

Definition at line 20 of file pernode.c.

21 {
22  int ncpu, nctr, i, actual_domain;
23  int retval;
24  int EventSet = PAPI_NULL;
25  long long *values;
26  long long elapsed_us, elapsed_cyc;
28 
30  if ( retval != PAPI_VER_CURRENT ) {
31  fprintf( stderr, "Library mismatch: code %d, library %d\n", retval,
33  exit( 1 );
34  }
35 
37  exit( 1 );
38 
39  /* Set the domain as high as it will go. */
40 
41  options.domain.eventset = EventSet;
42  options.domain.domain = PAPI_DOM_ALL;
44  if ( retval != PAPI_OK )
45  exit( 1 );
46  actual_domain = options.domain.domain;
47 
48  /* This should only happen to an empty eventset */
49 
50  options.granularity.eventset = EventSet;
51  options.granularity.granularity = PAPI_GRN_SYS_CPU;
53  if ( retval != PAPI_OK )
54  exit( 1 );
55 
56  /* Malloc the output array */
57 
58  ncpu = PAPI_get_opt( PAPI_MAX_CPUS, NULL );
59  nctr = PAPI_get_opt( PAPI_MAX_HWCTRS, NULL );
60  values = ( long long * ) malloc( ncpu * nctr * sizeof ( long long ) );
61  memset( values, 0x0, ( ncpu * nctr * sizeof ( long long ) ) );
62 
63  /* Add the counters */
64 
66  exit( 1 );
67 
69  exit( 1 );
70 
72 
74 
76  if ( retval != PAPI_OK )
77  exit( 1 );
78 
79  sleep( 5 );
80 
82  if ( retval != PAPI_OK )
83  exit( 1 );
84 
86 
88 
89  printf( "Test case: per node\n" );
90  printf( "-------------------\n\n" );
91 
92  printf( "This machine has %d cpus, each with %d counters.\n", ncpu, nctr );
93  printf( "Test case asked for: PAPI_DOM_ALL\n" );
94  printf( "Test case got: " );
95  if ( actual_domain & PAPI_DOM_USER )
96  printf( "PAPI_DOM_USER " );
97  if ( actual_domain & PAPI_DOM_KERNEL )
98  printf( "PAPI_DOM_KERNEL " );
99  if ( actual_domain & PAPI_DOM_OTHER )
100  printf( "PAPI_DOM_OTHER " );
101  printf( "\n" );
102 
103  for ( i = 0; i < ncpu; i++ ) {
104  printf( "CPU %d\n", i );
105  printf( "PAPI_TOT_CYC: \t%lld\n", values[0 + i * nctr] );
106  printf( "PAPI_TOT_INS: \t%lld\n", values[1 + i * nctr] );
107  }
108 
109  printf
110  ( "\n-------------------------------------------------------------------------\n" );
111 
112  printf( "Real usec : \t%lld\n", elapsed_us );
113  printf( "Real cycles : \t%lld\n", elapsed_cyc );
114 
115  printf
116  ( "-------------------------------------------------------------------------\n" );
117 
118  free( values );
119 
120  PAPI_shutdown( );
121 
122  exit( 0 );
123 }
#define PAPI_OK
Definition: fpapi.h:105
int PAPI_stop(int EventSet, long long *values)
Definition: papi.c:2314
#define PAPI_GRANUL
Definition: fpapi.h:52
#define PAPI_DOM_KERNEL
Definition: fpapi.h:22
int PAPI_add_event(int EventSet, int EventCode)
Definition: papi.c:1663
#define PAPI_VER_CURRENT
Definition: fpapi.h:14
int EventSet
int retval
Definition: zero_fork.c:53
A pointer to the following is passed to PAPI_set/get_opt()
Definition: papi.h:849
int PAPI_set_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:3465
#define PAPI_DOM_OTHER
Definition: fpapi.h:23
int PAPI_library_init(int version)
Definition: papi.c:500
#define PAPI_TOT_INS
Definition: fpapi.h:186
void PAPI_shutdown(void)
Definition: papi.c:4461
int PAPI_get_opt(int option, PAPI_option_t *ptr)
Definition: papi.c:4143
long long elapsed_cyc
Definition: zero_fork.c:50
#define PAPI_DOM_USER
Definition: fpapi.h:21
#define PAPI_NULL
Definition: fpapi.h:13
int PAPI_create_eventset(int *EventSet)
Definition: papi.c:1464
long long PAPI_get_real_usec(void)
Definition: papi.c:6264
#define PAPI_MAX_CPUS
Definition: fpapi.h:61
#define PAPI_MAX_HWCTRS
Definition: fpapi.h:58
static options_t options
#define PAPI_DOMAIN
Definition: fpapi.h:50
#define PAPI_GRN_SYS_CPU
Definition: fpapi.h:72
long long PAPI_get_real_cyc(void)
Definition: papi.c:6217
int PAPI_start(int EventSet)
Definition: papi.c:2096
#define PAPI_TOT_CYC
Definition: fpapi.h:195
static long long values[NUM_EVENTS]
Definition: init_fini.c:10
long long elapsed_us
Definition: zero_fork.c:50
void exit()
#define PAPI_DOM_ALL
Definition: fpapi.h:25
int i
Definition: fileop.c:140
Here is the call graph for this function:

◆ main() [2/2]

int main ( int  argc,
char **  argv 
)

Definition at line 1608 of file iozone.c.

1611 {
1612 
1613  long long fileindx,i,tval;
1614  long long ind;
1615  int ret;
1616  FILE *pi;
1617  char reply[IBUFSIZE];
1618  unsigned char inp_pat;
1619  time_t time_run;
1620  char *port,*m,*subarg;
1621  int num_child1;
1622  int cret;
1623  int anwser,bind_cpu;
1624  char *evalue;
1625 
1626 
1627  anwser=bind_cpu=0;
1628  /* Used to make fread/fwrite do something better than their defaults */
1629  setvbuf( stdout, NULL, _IONBF, (size_t) NULL );
1630  setvbuf( stderr, NULL, _IONBF, (size_t) NULL );
1631 
1632  /* Save the master's name */
1633  gethostname(controlling_host_name,100);
1634 
1635  /* Let user activate mdebug or cdebug via environmental variables */
1636  evalue = (char *)NULL;
1637  evalue=(char *)getenv("CDEBUG");
1638  if(evalue)
1639  cdebug=atoi(evalue);
1640  evalue = (char *)NULL;
1641  evalue=(char *)getenv("MDEBUG");
1642  if(evalue)
1643  mdebug=atoi(evalue);
1644 
1645  srand(time(0));
1646  mygen=rand(); /* Pick a random generation number */
1647 
1648  /* Try to find the actual VM page size, if possible */
1649 #if defined (solaris) || defined (_HPUX_SOURCE) || defined (linux) || defined(IRIX) || defined (IRIX64)
1650 #ifndef __convex_spp
1651  page_size=getpagesize();
1652 #endif
1653 #endif
1654  /* Try to find the actual number of ticks per second */
1655 #ifdef unix
1656  sc_clk_tck = clk_tck();
1657 #endif
1658  for(ind=0;ind<MAXSTREAMS;ind++)
1659  filearray[ind]=(char *)tfile;
1660 
1661  /* base_time=(long)time_so_far(); */
1662  myid=(long long)getpid(); /* save the master's PID */
1663  /* get_resolution(); Get clock resolution */
1664  time_run = time(0); /* Start a timer */
1666 
1667  /*
1668  * Save the splash screen for later display. When in distributed network
1669  * mode this output does not get displayed on the clients.
1670  */
1671  sprintf(splash[splash_line++],"\tIozone: Performance Test of File I/O\n");
1672  sprintf(splash[splash_line++],"\t%s\n\t%s\n", THISVERSION,MODE);
1673  sprintf(splash[splash_line++],"\t\tBuild: %s \n\n",build_name);
1674  sprintf(splash[splash_line++],"\tContributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins\n");
1675  sprintf(splash[splash_line++],"\t Al Slater, Scott Rhine, Mike Wisner, Ken Goss\n");
1676  sprintf(splash[splash_line++],"\t Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,\n");
1677  sprintf(splash[splash_line++],"\t Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,\n");
1678  sprintf(splash[splash_line++],"\t Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,\n");
1679  sprintf(splash[splash_line++],"\t Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,\n");
1680  sprintf(splash[splash_line++],"\t Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer.\n");
1681  sprintf(splash[splash_line++],"\t Ben England.\n\n");
1682  sprintf(splash[splash_line++],"\tRun began: %s\n",ctime(&time_run));
1683  argcsave=argc;
1684  argvsave=argv;
1685 
1686  signal(SIGINT, signal_handler); /* handle user interrupt */
1687  signal(SIGTERM, signal_handler); /* handle kill from shell */
1688 
1689  /********************************************************/
1690  /* Allocate and align buffer with beginning of the */
1691  /* on chip data cache. */
1692  /********************************************************/
1693 
1694  buffer = (char *) alloc_mem((long long)(MAXBUFFERSIZE + (2 * cache_size)),(int)0);
1695  if(buffer == 0) {
1696  perror("Memory allocation failed:");
1697  exit(1);
1698  }
1699 
1700 #ifdef _64BIT_ARCH_
1701  buffer = (char *) ((long long )(buffer + cache_size ) &
1702  ~(cache_size-1));
1703 #else
1704  buffer = (char *) ((long)(buffer + cache_size ) &
1705  ~((long)cache_size-1));
1706 #endif
1707  mainbuffer = buffer;
1708 
1709  /* de-dup input buf */
1710  buffer1 = (char *) alloc_mem((long long)(MAXBUFFERSIZE + (2 * cache_size)),(int)0);
1711  if(buffer1 == 0) {
1712  perror("Memory allocation failed:");
1713  exit(1);
1714  }
1715 
1716 #ifdef _64BIT_ARCH_
1717  buffer1 = (char *) ((long long )(buffer1 + cache_size ) &
1718  ~(cache_size-1));
1719 #else
1720  buffer1 = (char *) ((long)(buffer1 + cache_size ) &
1721  ~((long)cache_size-1));
1722 #endif
1723  dedup_ibuf = buffer1;
1725 
1726 #ifdef FOOB
1727  /* de-dup temp buf */
1728  buffer1 = (char *) alloc_mem((long long)(MAXBUFFERSIZE + (2 * cache_size)),(int)0);
1729  if(buffer1 == 0) {
1730  perror("Memory allocation failed:");
1731  exit(1);
1732  }
1733 
1734 #ifdef _64BIT_ARCH_
1735  buffer1 = (char *) ((long long )(buffer1 + cache_size ) &
1736  ~(cache_size-1));
1737 #else
1738  buffer1 = (char *) ((long)(buffer1 + cache_size ) &
1739  ~((long)cache_size-1));
1740 #endif
1741 #endif
1743 
1744  fetchon++; /* By default, prefetch the CPU cache lines associated with the buffer */
1745  strcpy(filename,default_filename); /* Init default filename */
1746  sprintf(dummyfile[0],"%s.DUMMY",default_filename);
1747  if(argc <=1){
1748  printf(USAGE);
1749  exit(255);
1750  }
1751  auto_mode = 0; /* Default is to disable auto mode */
1752  inp_pat = PATTERN; /* Init default pattern for verification */
1753  /* Fill the entire pattern variable with the same character */
1754  pattern = ((inp_pat << 24) | (inp_pat << 16) | (inp_pat << 8) | inp_pat);
1755 
1756  /*
1757  * Parse all of the options that the user specified.
1758  */
1759  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){
1760  switch(cret){
1761  case 'k': /* Async I/O with no bcopys */
1762  depth = (long long)(atoi(optarg));
1763  if(depth <0)
1764  depth=0;
1765  /*
1766  if(depth > 60)
1767  depth=60;
1768  */
1769 #ifdef NO_PRINT_LLD
1770  sprintf(splash[splash_line++],"\tPOSIX Async I/O (no bcopy). Depth %ld \n",depth);
1771 #else
1772  sprintf(splash[splash_line++],"\tPOSIX Async I/O (no bcopy). Depth %lld \n",depth);
1773 #endif
1774  no_copy_flag=1;
1775  async_flag++;
1776  k_flag++;
1777  break;
1778  case 'T': /* Switch to POSIX thread based */
1779 #ifndef NO_THREADS
1780  use_thread++;
1781 #else
1782  printf("\tThreads not supported in this version\n");
1783  exit(2);
1784 #endif
1785  break;
1786  case 'H': /* Use POSIX async_io */
1787  h_flag++;
1788  depth = (long long)(atoi(optarg));
1789  if(depth <0)
1790  depth=0;
1791  /*
1792  * Hmmm. many systems fail is strange ways when the maximum
1793  * number of async I/Os per user or proc is exceeded.
1794  */
1795  /*
1796  if(depth > 60)
1797  depth=60;
1798  */
1799 #ifdef NO_PRINT_LLD
1800  sprintf(splash[splash_line++],"\tPOSIX async I/O (with bcopy). Depth %ld\n",depth);
1801 #else
1802  sprintf(splash[splash_line++],"\tPOSIX async I/O (with bcopy). Depth %lld\n",depth);
1803 #endif
1804  async_flag++;
1805  break;
1806  case 'I': /* Use VXFS direct advisory or O_DIRECT from Linux or AIX , or O_DIRECTIO for TRU64 or Solaris directio */
1807 #ifdef VXFS
1808  direct_flag++;
1809  sprintf(splash[splash_line++],"\tVxFS advanced feature SET_CACHE, VX_DIRECT enabled\n");
1810  break;
1811 #endif
1812 #if ! defined(DONT_HAVE_O_DIRECT)
1813 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined(__FreeBSD__) || defined(solaris)
1814  direct_flag++;
1815  sprintf(splash[splash_line++],"\tO_DIRECT feature enabled\n");
1816  break;
1817 #endif
1818 #if defined(TRU64)
1819  direct_flag++;
1820  sprintf(splash[splash_line++],"\tO_DIRECTIO feature enabled\n");
1821  break;
1822 #endif
1823 #else
1824  break;
1825 #endif
1826 #if defined(Windows)
1827  sprintf(splash[splash_line++],"\tO_DIRECTIO feature not available in Windows version.\n");
1828  break;
1829 #endif
1830  case 'B': /* Use mmap file for test file */
1831  sprintf(splash[splash_line++],"\tUsing mmap files\n");
1832  mmapflag++;
1833  mmapnsflag++;
1834  break;
1835  case 'D': /* Use async msync mmap file */
1836  sprintf(splash[splash_line++],"\tUsing msync(MS_ASYNC) on mmap files\n");
1837  mmapflag++;
1838  mmapasflag++;
1839  mmapnsflag=0;
1840  break;
1841  case 'G': /* Use msync sync for mmap file */
1842  sprintf(splash[splash_line++],"\tUsing msync(MS_SYNC) on mmap files\n");
1843  mmapssflag++;
1844  mmapnsflag=0;
1845  break;
1846  case 'C': /* show children xfer counts */
1847  Cflag++;
1848  break;
1849  case 'Q': /* Enable output offset/latency files */
1850  sprintf(splash[splash_line++],"\tOffset/latency files enabled.\n");
1851  Q_flag++;
1852  break;
1853  case 'x': /* Disable stone_wall */
1854  sprintf(splash[splash_line++],"\tStonewall disabled\n");
1855  xflag++;
1856  break;
1857 
1858  case 'a': /* auto mode */
1859  fetchon=1;
1860  purge=0;
1861  multi_buffer=0;
1862  auto_mode = 1;
1863  aflag++;
1864  sprintf(splash[splash_line++],"\tAuto Mode\n");
1865  break;
1866  case 'c': /* Include close in timing */
1867  include_close++;
1868  sprintf(splash[splash_line++],"\tInclude close in write timing\n");
1869  break;
1870  case 'e': /* Include fsync in timing */
1871  include_flush++;
1872  sprintf(splash[splash_line++],"\tInclude fsync in write timing\n");
1873  break;
1874  case 'A': /* auto2 mode. Soon to go away. Please use -az */
1875  fetchon=1;
1876  purge=0;
1877  multi_buffer=0;
1878  auto_mode = 1;
1879  aflag++;
1880  sprintf(splash[splash_line++],"\tAuto Mode 2. This option is obsolete. Use -az -i0 -i1 \n");
1881  RWONLYflag++;
1882  NOCROSSflag++;
1883  include_tflag++; /* automatically set WRITER_TEST and READER_TEST */
1886  break;
1887  case 's': /* Set file size */
1888 #ifdef NO_PRINT_LLD
1889  sscanf(optarg,"%ld",&kilobytes64);
1890 #else
1891  sscanf(optarg,"%lld",&kilobytes64);
1892 #endif
1893  if(optarg[strlen(optarg)-1]=='k' ||
1894  optarg[strlen(optarg)-1]=='K'){
1895  ;
1896  }
1897  if(optarg[strlen(optarg)-1]=='m' ||
1898  optarg[strlen(optarg)-1]=='M'){
1899  kilobytes64 = kilobytes64 * 1024;
1900  }
1901  if(optarg[strlen(optarg)-1]=='g' ||
1902  optarg[strlen(optarg)-1]=='G'){
1903  kilobytes64 = kilobytes64 *1024 * 1024;
1904  }
1905  if(kilobytes64 <= 0)
1906  kilobytes64=512;
1907 
1909  max_file_size = (off64_t)s_range[s_count-1]; /* Make visable globally */
1910  min_file_size = (off64_t)s_range[0]; /* Make visable globally */
1911 
1912 #ifdef NO_PRINT_LLD
1913  sprintf(splash[splash_line++],"\tFile size set to %ld KB\n",kilobytes64);
1914 #else
1915  sprintf(splash[splash_line++],"\tFile size set to %lld KB\n",kilobytes64);
1916 #endif
1917  sflag++;
1918  break;
1919  case 'l': /* Set lower thread/proc limit */
1920  mint = (long long)(atoi(optarg));
1921  if(mint <= 0)
1922  {
1923  mint=1;
1924  num_child=1;
1925  }else
1926  num_child=mint;
1927  if(mint > (unsigned long long)MAXSTREAMS){
1928  printf("Invalid options: maximum streams for ");
1929  printf("throughput is MAXSTREAMS\n");
1930  exit(4);
1931  }
1932  lflag++;
1933  trflag++;
1934  if(Uflag)
1935  {
1936  printf("Can not run throughput tests with unmount & remounts.\n");
1937  exit(5);
1938  }
1939  break;
1940  case 'u': /* Set upper thread/proc limit */
1941  maxt = (long long)(atoi(optarg));
1942  if(maxt <= 0)
1943  maxt=1;
1944  if(maxt > MAXSTREAMS){
1945  printf("Invalid options: maximum streams for ");
1946  printf("throughput is MAXSTREAMS\n");
1947  exit(6);
1948  }
1949  uflag++;
1950  trflag++;
1951  if(Uflag)
1952  {
1953  printf("Can not run throughput tests with unmount & remounts.\n");
1954  exit(7);
1955  }
1956  break;
1957  case 'm': /* Use multiple buffers */
1958  fetchon=0;
1959  multi_buffer=1;
1960  mflag++;
1961  mbuffer = (char *) alloc_mem((long long)MAXBUFFERSIZE,(int)0);
1962  if(mbuffer == 0) {
1963  perror("Memory allocation failed:");
1964  exit(8);
1965  }
1966  sprintf(splash[splash_line++],"\tMulti_buffer. Work area %d bytes\n",
1967  MAXBUFFERSIZE);
1968  break;
1969  case 'M': /* Report machine name and OS */
1970  bzero(reply,sizeof(reply));
1971  pi=popen("uname -a", "r");
1972  if(pi == (FILE *)0)
1973  {
1974  sprintf(splash[splash_line++],"\n\tError using popen() on uname\n");
1975  sprintf(splash[splash_line++],"\t-M option suppressed.\n");
1976  }
1977  else
1978  {
1979  junk=fread(reply,IBUFSIZE-1,1,pi);
1980  pclose(pi);
1981  m=reply;
1982  while(*m) /* Strip new line */
1983  {
1984  if(*m=='\n')
1985  *m=0;
1986  else
1987  m++;
1988  }
1989  sprintf(splash[splash_line++],"\n\tMachine = %s\n",reply);
1990  }
1991  break;
1992 
1993  case 'P': /* Set beginning processor for binding. */
1994 #ifndef NO_THREADS
1995 #if defined(_HPUX_SOURCE) || defined(linux)
1996 #if defined(_HPUX_SOURCE)
1997  num_processors= pthread_num_processors_np();
1998 #else
1999  num_processors = sysconf(_SC_NPROCESSORS_ONLN);
2000 #endif
2001  begin_proc = atoi(optarg);
2002  if(begin_proc < 0)
2003  begin_proc=0;
2005  begin_proc=0;
2006  sprintf(splash[splash_line++],"\tBinding of processors beginning with %d \n",begin_proc);
2008 #else
2009  sprintf(splash[splash_line++],"\tProcessor binding not available in this version\n");
2010 #endif
2011 #endif
2012  break;
2013  case 'p': /* purge the processor cache */
2014  sprintf(splash[splash_line++],"\tPurge Mode On\n");
2015  fetchon=0;
2016  pflag++;
2017  purge=1;
2018  break;
2019  case 'h': /* show help */
2020  hflag++;
2021  show_help();
2022  exit(0);
2023  break;
2024  case 'E': /* Extended testing for pread/pwrite... */
2025  Eflag++;
2026  break;
2027  case 'R': /* Generate Excel compatible Report */
2028  Rflag++;
2029  sprintf(splash[splash_line++],"\tExcel chart generation enabled\n");
2030  break;
2031  case 'o': /* Open OSYNC */
2032  sprintf(splash[splash_line++],"\tSYNC Mode. \n");
2033  oflag++;
2034  break;
2035  case 'O': /* Report in Ops/sec instead of KB/sec */
2036  sprintf(splash[splash_line++],"\tOPS Mode. Output is in operations per second.\n");
2037  OPS_flag++;
2038  break;
2039  case 'N': /* Report in usec/op */
2040  sprintf(splash[splash_line++],"\tMicroseconds/op Mode. Output is in microseconds per operation.\n");
2041  MS_flag++;
2042  break;
2043  case 'V': /* Turn on Verify every byte */
2044  sverify=0;
2045  inp_pat = (char)(atoi(optarg));
2046  if(inp_pat == 0)
2047  inp_pat = PATTERN;
2048  pattern = ((inp_pat << 24) | (inp_pat << 16) | (inp_pat << 8)
2049  | inp_pat);
2050  verify=1;
2051  sprintf(splash[splash_line++],"\tVerify Mode. Pattern %x\n",pattern);
2052  sprintf(splash[splash_line++],"\tPerformance measurements are invalid in this mode.\n");
2053  break;
2054  case 'S': /* Set the processor cache size */
2055  cache_size = (long)(atoi(optarg)*1024);
2056  if(cache_size == 0)
2058  break;
2059  case 'L': /* Set processor cache line size */
2060  cache_line_size = (long)(atoi(optarg));
2061  if(cache_line_size == 0)
2063  break;
2064  case 'f': /* Specify the file name */
2065  if(mfflag) {
2066  printf("invalid options: -f and -F are mutually exclusive\n");
2067  exit(10);
2068  }
2069  fflag++;
2070  strcpy(filename,optarg);
2071  sprintf(dummyfile[0],"%s.DUMMY",optarg);
2072  break;
2073  case 'b': /* Specify the biff file name */
2074  Rflag++;
2075  bif_flag++;
2076  strcpy(bif_filename,optarg);
2077  break;
2078  case 'F': /* Specify multiple file names for -t */
2079  mfflag++;
2080  if(fflag) {
2081  printf("invalid options: -f and -F are mutually exclusive\n");
2082  exit(11);
2083  }
2084  if(!trflag) {
2085  printf("invalid options: must specify -t N before -F\n");
2086  exit(12);
2087  }
2088  optind--;
2089  for(fileindx=0;fileindx<maxt;fileindx++) {
2090  filearray[fileindx]=argv[optind++];
2091  if(optind > argc) {
2092 #ifdef NO_PRINT_LLD
2093  printf("invalid options: not enough filenames for %ld streams\n",num_child);
2094 #else
2095  printf("invalid options: not enough filenames for %lld streams\n",num_child);
2096 #endif
2097  exit(13);
2098  }
2099  }
2100  break;
2101  case 'r': /* Specify the record size to use */
2102  rflag++;
2103  reclen = ((long long)(atoi(optarg))*1024);
2104  if(optarg[strlen(optarg)-1]=='k' ||
2105  optarg[strlen(optarg)-1]=='K'){
2106  reclen = (long long)(1024 * atoi(optarg));
2107  }
2108  if(optarg[strlen(optarg)-1]=='m' ||
2109  optarg[strlen(optarg)-1]=='M'){
2110  reclen = (long long)(1024 * 1024 * atoi(optarg));
2111  }
2112  if(optarg[strlen(optarg)-1]=='g' ||
2113  optarg[strlen(optarg)-1]=='G'){
2114  reclen = (long long)(1024 * 1024 * 1024 *(long long)atoi(optarg));
2115  }
2116  if(reclen <= 0)
2117  reclen=(long long)4096;
2118 
2119  r_range[r_count++]=reclen;
2120  max_rec_size = (off64_t)r_range[r_count-1]; /* Make visable globally */
2121  min_rec_size = (off64_t)r_range[0]; /* Make visable globally */
2122 #ifdef NO_PRINT_LLD
2123  sprintf(splash[splash_line++],"\tRecord Size %ld KB\n",reclen/1024);
2124 #else
2125  sprintf(splash[splash_line++],"\tRecord Size %lld KB\n",reclen/1024);
2126 #endif
2127  if(max_rec_size > MAXBUFFERSIZE) {
2128 #ifdef NO_PRINT_LLD
2129  printf("Error: maximum record size %ld KB is greater than maximum buffer size %ld KB\n ",
2130  max_rec_size/1024, MAXBUFFERSIZE/1024);
2131 #else
2132  printf("Error: maximum record size %lld KB is greater than maximum buffer size %lld KB\n ",
2133  (long long)(max_rec_size/1024LL), (long long)MAXBUFFERSIZE/1024LL);
2134 #endif
2135  exit(23);
2136  }
2137  break;
2138  case 'J': /* Specify the compute time in millisecs */
2139  compute_time = (float)(atoi(optarg));
2140  compute_time=compute_time/1000;
2141  if(compute_time < (float)0)
2142  compute_time=(float)0;
2143  else
2144  compute_flag=1;
2145  jflag++;
2146  break;
2147  case 'j': /* Specify the stride in records */
2148  stride = (long long)(atoi(optarg));
2149  if(stride < 0)
2150  stride=0;
2151  stride_flag=1;
2152  break;
2153  case 't': /* Specify the number of children to run */
2154  num_child1=(atoi(optarg));
2155  num_child = (long long)num_child1;
2156  if(num_child > (long long)MAXSTREAMS) {
2157  printf("invalid options: maximum streams for throughput is MAXSTREAMS\n");
2158 #ifdef NO_PRINT_LLD
2159  printf("Numchild %ld %s\n",num_child,optarg);
2160 #else
2161  printf("Numchild %lld %s\n",num_child,optarg);
2162 #endif
2163  exit(14);
2164  }
2165  if(num_child <= 0)
2166  num_child = 8;
2167  if(num_child == 0)
2168  num_child=1;
2171  trflag++;
2172  if(Uflag)
2173  {
2174  printf("Can not run throughput tests with unmount & remounts.\n");
2175  exit(15);
2176  }
2177  break;
2178  case 'd': /* Specify the delay of children to run */
2179  delay_start = (long long)(atoi(optarg));
2180  if(delay_start < 0)
2181  delay_start=0;
2182  break;
2183  case 'i': /* Specify specific tests */
2184  tval=(long long)(atoi(optarg));
2185  if(tval < 0) tval=0;
2186 #ifndef HAVE_PREAD
2187  if(tval > RANDOM_MIX_TEST)
2188  {
2189  printf("\tPread tests not available on this operating system.\n");
2190  exit(183);
2191  }
2192 #endif
2193  if(tval > sizeof(func)/sizeof(char *))
2194  {
2195  tval=0;
2196  sprintf(splash[splash_line++],"\tSelected test not available on the version.\n");
2197  }
2198  include_test[tval]++;
2199  include_tflag++;
2200  break;
2201  case 'v': /* Show version information */
2202  for(ind=0; strlen(head1[ind]); ind++)
2203  {
2204  printf("%s\n", head1[ind]);
2205  }
2206  exit(0);
2207  break;
2208  case 'U': /* Specify the dev name for umount/mount*/
2209  Uflag++;
2210  strcpy(mountname,optarg);
2211  if(trflag)
2212  {
2213  printf("Can not run throughput tests with unmount & remounts.\n");
2214  exit(16);
2215  }
2216  break;
2217  case 'w': /* Do not unlink files */
2218  sprintf(splash[splash_line++],"\tSetting no_unlink\n");
2219  no_unlink = 1;
2220  break;
2221  case 'Z': /* Turn on the mmap and file I/O mixing */
2222  sprintf(splash[splash_line++],"\tEnable mmap & file I/O mixing.\n");
2223  mmap_mix = 1;
2224  break;
2225  case 'W': /* Read/Write with file locked */
2226  file_lock=1;
2227  sprintf(splash[splash_line++],"\tLock file when reading/writing.\n");
2228  break;
2229  case 'K': /* Cause disrupted read pattern */
2230  disrupt_flag=1;
2231  sprintf(splash[splash_line++],"\tDisrupted read patterns selected.\n");
2232  break;
2233  case 'X': /* Open write telemetry file */
2234  compute_flag=1;
2235  sverify=2; /* touch lightly */
2236  w_traj_flag=1;
2237  strcpy(write_traj_filename,optarg);
2238  traj_vers();
2239  w_traj_size();
2240  sprintf(splash[splash_line++],"\tUsing write telemetry file \"%s\"\n",
2243  if(w_traj_fd == (FILE *)0)
2244  exit(200);
2245  break;
2246  case 'Y': /* Open Read telemetry file */
2247  compute_flag=1;
2248  sverify=2; /* touch lightly */
2249  r_traj_flag=1;
2250  strcpy(read_traj_filename,optarg);
2251  sprintf(splash[splash_line++],"\tUsing read telemetry file \"%s\"\n",
2253  traj_vers();
2254  r_traj_size();
2256  if(r_traj_fd == (FILE*) 0)
2257  exit(200);
2258  break;
2259  case 'n': /* Set min file size for auto mode */
2260  nflag=1;
2262  if(optarg[strlen(optarg)-1]=='k' ||
2263  optarg[strlen(optarg)-1]=='K'){
2264  ;
2265  }
2266  if(optarg[strlen(optarg)-1]=='m' ||
2267  optarg[strlen(optarg)-1]=='M'){
2268  minimum_file_size = (long long)(1024 * atoi(optarg));
2269  }
2270  if(optarg[strlen(optarg)-1]=='g' ||
2271  optarg[strlen(optarg)-1]=='G'){
2272  minimum_file_size = (long long)(1024 * 1024 * (long long)atoi(optarg));
2273  }
2274  if(minimum_file_size < RECLEN_START/1024)
2276  if(minimum_file_size < page_size/1024)
2278 #ifdef NO_PRINT_LLD
2279  sprintf(splash[splash_line++],"\tUsing minimum file size of %ld kilobytes.\n",minimum_file_size);
2280 #else
2281  sprintf(splash[splash_line++],"\tUsing minimum file size of %lld kilobytes.\n",minimum_file_size);
2282 #endif
2283  break;
2284  case 'g': /* Set maximum file size for auto mode */
2285  gflag=1;
2287  if(optarg[strlen(optarg)-1]=='k' ||
2288  optarg[strlen(optarg)-1]=='K'){
2289  ;
2290  }
2291  if(optarg[strlen(optarg)-1]=='m' ||
2292  optarg[strlen(optarg)-1]=='M'){
2293  maximum_file_size = (long long)(1024 * atoi(optarg));
2294  }
2295  if(optarg[strlen(optarg)-1]=='g' ||
2296  optarg[strlen(optarg)-1]=='G'){
2297  maximum_file_size = (long long)(1024 * 1024 * (long long)atoi(optarg));
2298  }
2299  if(maximum_file_size < RECLEN_START/1024)
2301 #ifdef NO_PRINT_LLD
2302  sprintf(splash[splash_line++],"\tUsing maximum file size of %ld kilobytes.\n",maximum_file_size);
2303 #else
2304  sprintf(splash[splash_line++],"\tUsing maximum file size of %lld kilobytes.\n",maximum_file_size);
2305 #endif
2306  break;
2307  case 'z': /* Set no cross over */
2308  sprintf(splash[splash_line++],"\tCross over of record size disabled.\n");
2309  NOCROSSflag=1;
2310  break;
2311  case 'y': /* Set min record size for auto mode */
2312  yflag=1;
2313  min_rec_size = ((long long)(atoi(optarg))*1024);
2314  if(optarg[strlen(optarg)-1]=='k' ||
2315  optarg[strlen(optarg)-1]=='K'){
2316  min_rec_size = (long long)(1024 * atoi(optarg));
2317  }
2318  if(optarg[strlen(optarg)-1]=='m' ||
2319  optarg[strlen(optarg)-1]=='M'){
2320  min_rec_size = (long long)(1024 * 1024 * atoi(optarg));
2321  }
2322  if(optarg[strlen(optarg)-1]=='g' ||
2323  optarg[strlen(optarg)-1]=='G'){
2324  min_rec_size = (long long)(1024 * 1024 * 1024 *(long long)atoi(optarg));
2325  }
2326  if(min_rec_size <= 0)
2327  min_rec_size=(long long)RECLEN_START;
2328 #ifdef NO_PRINT_LLD
2329  sprintf(splash[splash_line++],"\tUsing Minimum Record Size %ld KB\n", min_rec_size/1024);
2330 #else
2331  sprintf(splash[splash_line++],"\tUsing Minimum Record Size %lld KB\n", min_rec_size/1024);
2332 #endif
2333  break;
2334  case 'q': /* Set max record size for auto mode */
2335  qflag=1;
2336  max_rec_size = ((long long)(atoi(optarg))*1024);
2337  if(optarg[strlen(optarg)-1]=='k' ||
2338  optarg[strlen(optarg)-1]=='K'){
2339  max_rec_size = (long long)(1024 * atoi(optarg));
2340  }
2341  if(optarg[strlen(optarg)-1]=='m' ||
2342  optarg[strlen(optarg)-1]=='M'){
2343  max_rec_size = (long long)(1024 * 1024 * atoi(optarg));
2344  }
2345  if(optarg[strlen(optarg)-1]=='g' ||
2346  optarg[strlen(optarg)-1]=='G'){
2347  max_rec_size = (long long)(1024 * 1024 * 1024 *(long long)atoi(optarg));
2348  }
2349  if(max_rec_size <= 0)
2350  min_rec_size=(long long)RECLEN_END;
2351  if(max_rec_size > MAXBUFFERSIZE) {
2352 #ifdef NO_PRINT_LLD
2353  printf("Error: maximum record size %ld KB is greater than maximum buffer size %ld KB\n ",
2354  max_rec_size/1024, MAXBUFFERSIZE/1024);
2355 #else
2356  printf("Error: maximum record size %lld KB is greater than maximum buffer size %lld KB\n ",
2357  (long long)(max_rec_size/1024LL), (long long)MAXBUFFERSIZE/1024LL);
2358 #endif
2359  exit(23);
2360  }
2361 #ifdef NO_PRINT_LLD
2362  sprintf(splash[splash_line++],"\tUsing Maximum Record Size %ld KB\n", max_rec_size/1024);
2363 #else
2364  sprintf(splash[splash_line++],"\tUsing Maximum Record Size %lld KB\n", max_rec_size/1024);
2365 #endif
2366  break;
2367 
2368  /*
2369  * The + operator is for the new extended options mechanism
2370  * Syntax is -+ followed by option leter, and if the optino
2371  * takes an operand then it is implemented below. An example
2372  * -+a arg is shown below. This is a sub option with an argument.
2373  * -+b is shown below. This is a sub option with no argument.
2374  */
2375  case '+':
2376  /* printf("Plus option = >%s<\n",optarg);*/
2377  switch (*((char *)optarg))
2378  {
2379  case 'a': /* Example: Has argument */
2380  subarg=argv[optind++];
2381  /* if(subarg!=(char *)0) Error checking. */
2382  /* printf("Plus option argument = >%s<\n",subarg);*/
2383  break;
2384  case 'b': /* Example: Does not have an argument */
2385  break;
2386  case 'c': /* Argument is the controlling host name */
2387  /* I am a client for distributed Iozone */
2388  subarg=argv[optind++];
2389  if(subarg==(char *)0)
2390  {
2391  printf("-+c takes an operand !!\n");
2392  exit(200);
2393  }
2394  strcpy(controlling_host_name,subarg);
2395  distributed=1;
2396  client_iozone=1;
2397  master_iozone=0;
2398  break;
2399  case 'h': /* Argument is the controlling host name */
2400  subarg=argv[optind++];
2401  if(subarg==(char *)0)
2402  {
2403  printf("-+h takes an operand !!\n");
2404  exit(200);
2405  }
2406  strcpy(controlling_host_name,subarg);
2407  sprintf(splash[splash_line++],"\tHostname = %s\n",controlling_host_name);
2408  break;
2409  case 'm': /* I am the controlling process for distributed Iozone */
2410  /* Does not have an argument */
2411  subarg=argv[optind++];
2412  if(subarg==(char *)0)
2413  {
2414  printf("-+m takes an operand. ( filename )\n");
2415  exit(201);
2416  }
2417  strcpy(client_filename,subarg);
2418  ret=get_client_info();
2419  if(ret <= 0)
2420  {
2421  printf("Error reading client file\n");
2422  exit(178);
2423  }
2425  distributed=1;
2426  master_iozone=1;
2427  client_iozone=0;
2428  sprintf(splash[splash_line++],"\tNetwork distribution mode enabled.\n");
2429  break;
2430  case 'N': /* turn off truncating the file before write test */
2431  notruncate = 1;
2432  break;
2433  case 'u': /* Set CPU utilization output flag */
2434  cpuutilflag = 1; /* only used if R(eport) flag is also set */
2436  sprintf(splash[splash_line++],"\tCPU utilization Resolution = %5.3f seconds.\n",cputime_res);
2437  sprintf(splash[splash_line++],"\tCPU utilization Excel chart enabled\n");
2438  break;
2439  case 's': /* Clients operate in silent mode. */
2440  /* Does not have an argument */
2441  silent=1;
2442  break;
2443  case 'd': /* Diagnostics mode */
2444  sprintf(splash[splash_line++],"\t>>> I/O Diagnostic mode enabled. <<<\n");
2445  sprintf(splash[splash_line++],"\tPerformance measurements are invalid in this mode.\n");
2446  diag_v=1;
2447  sverify=0;
2448  break;
2449  case 'x': /* Argument is the multiplier for rec size and file size */
2450  subarg=argv[optind++];
2451  if(subarg==(char *)0)
2452  {
2453  printf("-+c takes an operand !!\n");
2454  exit(200);
2455  }
2456  multiplier = atoi(subarg);
2457  if(multiplier <=1)
2458  multiplier = 2;
2459  break;
2460  case 'i': /* Argument is the host port */
2461  subarg=argv[optind++];
2462  if(subarg==(char *)0)
2463  {
2464  printf("-+i takes an operand !!\n");
2465  exit(200);
2466  }
2467  controlling_host_port = atoi(subarg);
2468  break;
2469  case 'p': /* Argument is the percentage read */
2470  subarg=argv[optind++];
2471  if(subarg==(char *)0)
2472  {
2473  printf("-+p takes an operand !!\n");
2474  exit(200);
2475  }
2476  pct_read = atoi(subarg);
2477  if(pct_read < 1)
2478  pct_read = 1;
2479  if(pct_read >=100)
2480  pct_read = 100;
2481  sprintf(splash[splash_line++],"\tPercent read in mix test is %d\n",pct_read);
2482  break;
2483  case 't': /* Speed code activated */
2484  speed_code=1;
2485  break;
2486 #if defined(_HPUX_SOURCE) || defined(linux) || defined(solaris)
2487  case 'r': /* Read sync too */
2488  read_sync=1;
2489  sprintf(splash[splash_line++],"\tRead & Write sync mode active.\n");
2490  break;
2491 #endif
2492 #ifndef NO_MADVISE
2493  case 'A': /* Argument is madvise selector */
2494  subarg=argv[optind++];
2495  if(subarg==(char *)0)
2496  {
2497  printf("-+A take an operand !!\n");
2498  exit(200);
2499  }
2500  advise_flag=1;
2501  advise_op=atoi(subarg);
2502  sprintf(splash[splash_line++],"\tMadvise enabled: %d\n",advise_op);
2503  break;
2504 #endif
2505  case 'n': /* Set no-retest */
2506  noretest = 1;
2507  sprintf(splash[splash_line++],"\tNo retest option selected\n");
2508  break;
2509  case 'k': /* Constant aggregate data set size */
2510  aggflag=1;
2511  break;
2512  case 'q': /* Argument is the rest time between tests in seconds */
2513  subarg=argv[optind++];
2514  if(subarg==(char *)0)
2515  {
2516  printf("-+q takes an operand !!\n");
2517  exit(200);
2518  }
2519  rest_val = (long long)atoi(subarg);
2520  if(rest_val <=0)
2521  rest_val = 0;
2522  restf=1;
2523  sprintf(splash[splash_line++],"\tDelay %d seconds between tests enabled.\n",atoi(subarg));
2524  break;
2525 #if defined(O_DSYNC)
2526  case 'D': /* O_DSYNC mode */
2527  sprintf(splash[splash_line++],"\t>>> O_DSYNC mode enabled. <<<\n");
2528  odsync=1;
2529  break;
2530 #endif
2531  case 'l': /* Record locking mode */
2532  sprintf(splash[splash_line++],"\t>>> Record locking mode enabled. <<<\n");
2533  rlocking=1;
2534  break;
2535  case 'L': /* Record locking mode shared files*/
2536  sprintf(splash[splash_line++],"\t>>> Record locking, shared file mode enabled. <<<\n");
2537  share_file=1;
2538  rlocking=1;
2539  break;
2540  case 'V': /* No Record locking shared files*/
2541  sprintf(splash[splash_line++],"\t>>> Shared file mode enabled. <<<\n");
2542  share_file=1;
2543  break;
2544  case 'B': /* Sequential mix */
2545  sprintf(splash[splash_line++],"\t>>> Sequential Mixed workload. <<<\n");
2546  seq_mix=1;
2547  break;
2548  /* Use an existing user file, that does
2549  not contain Iozone's pattern. Use file
2550  for testing, but read only, and no
2551  delete at the end of the test. Also,
2552  no pattern verification, but do touch
2553  the pages. */
2554  case 'E':
2555  sprintf(splash[splash_line++],"\t>>> No Verify mode. <<<\n");
2556  sverify=2;
2557  no_unlink=1;
2558  no_write=1;
2559  break;
2560  case 'T': /* Time stamps on */
2561  L_flag=1;
2562  break;
2563  case 'X': /* Short circuit test mode */
2564  X_flag = 1;
2565  sverify=1;
2566  verify=1;
2567  inp_pat = 0xBB;
2568  pattern = ((inp_pat << 24) |
2569  (inp_pat << 16) | (inp_pat << 8) |
2570  inp_pat);
2571  sprintf(splash[splash_line++],"\tShort circuit mode. For\n");
2572  sprintf(splash[splash_line++],"\t filesystem development testing ONLY !\n");
2573  break;
2574  case 'Z': /* Compatibility mode for 0xA5 */
2575  Z_flag = 1;
2576  sverify=1;
2577  verify=1;
2578  inp_pat = 0xA5;
2579  pattern = ((inp_pat << 24) |
2580  (inp_pat << 16) | (inp_pat << 8) |
2581  inp_pat);
2582  sprintf(splash[splash_line++],"\tUsing old data sets.\n");
2583  sprintf(splash[splash_line++],"\t Performance measurements may be invalid in this\n");
2584  sprintf(splash[splash_line++],"\t mode due to published hack.\n");
2585  break;
2586 #if defined(Windows)
2587  case 'U': /* Windows only Unbufferd I/O */
2588  unbuffered=1;
2589  sprintf(splash[splash_line++],"\tUnbuffered Windows API usage. >>> Very Experimental <<<\n");
2590  break;
2591 #endif
2592  case 'K': /* Sony special for manual control of test 8 */
2593  subarg=argv[optind++];
2594  if(subarg==(char *)0)
2595  {
2596  printf("-+K takes an operand !!\n");
2597  exit(204);
2598  }
2599  Kplus_readers = (int)atoi(subarg);
2600  if(Kplus_readers <=0)
2601  Kplus_readers = 1;
2602  Kplus_flag=1;
2603  sprintf(splash[splash_line++],"\tManual control of test 8. >>> Very Experimental. Sony special <<<\n");
2604  break;
2605  case 'w': /* Argument is the percent of dedup */
2606  /* Sets size of dedup region across files */
2607  subarg=argv[optind++];
2608  if(subarg==(char *)0)
2609  {
2610  printf("-+w takes an operand !!\n");
2611  exit(200);
2612  }
2613  dedup = atoi(subarg);
2614  if(dedup <=0)
2615  dedup = 0;
2616  if(dedup >100)
2617  dedup = 100;
2618  sprintf(splash[splash_line++],"\tDedup activated %d percent.\n",dedup);
2619  break;
2620  case 'y': /* Argument is the percent of interior dedup */
2621  /* Sets size of dedup region within and across files */
2622  subarg=argv[optind++];
2623  if(subarg==(char *)0)
2624  {
2625  printf("-+y takes an operand !!\n");
2626  exit(200);
2627  }
2628  dedup_interior = atoi(subarg);
2629  if(dedup_interior <0)
2630  dedup_interior = 0;
2631  if(dedup_interior >100)
2632  dedup_interior = 100;
2633  sprintf(splash[splash_line++],"\tDedupe within & across %d percent.\n",dedup_interior);
2634  break;
2635  case 'C': /* Argument is the percent of dedupe within & !across */
2636  /* Sets size of dedup region within and !across files */
2637  subarg=argv[optind++];
2638  if(subarg==(char *)0)
2639  {
2640  printf("-+C takes an operand !!\n");
2641  exit(200);
2642  }
2643  dedup_compress = atoi(subarg);
2644  if(dedup_compress <0)
2645  dedup_compress = 0;
2646  if(dedup_compress >100)
2647  dedup_compress = 100;
2648  sprintf(splash[splash_line++],"\tDedupe within %d percent.\n",dedup_compress);
2649  break;
2650  case 'S': /* Argument is the seed for dedup */
2651  subarg=argv[optind++];
2652  if(subarg==(char *)0)
2653  {
2654  printf("-+S takes an operand !!\n");
2655  exit(200);
2656  }
2657  dedup_mseed = atoi(subarg);
2658  if(dedup_mseed ==0)
2659  dedup_mseed = 1;
2660  sprintf(splash[splash_line++],"\tDedup manual seed %d .\n",dedup_mseed);
2661  break;
2662  case 'H': /* Argument is hostname of the PIT */
2663  subarg=argv[optind++];
2664  if(subarg==(char *)0)
2665  {
2666  printf("-+H takes operand !!\n");
2667  exit(200);
2668  }
2669  strcpy(pit_hostname,subarg);
2670  sprintf(splash[splash_line++],"\tPIT_host %s\n",pit_hostname);
2671 
2672  break;
2673  case 'P': /* Argument is port of the PIT */
2674  subarg=argv[optind++];
2675  if(subarg==(char *)0)
2676  {
2677  printf("-+P takes operand !!\n");
2678  exit(200);
2679  }
2680  strcpy(pit_service,subarg);
2681  sprintf(splash[splash_line++],"\tPIT_port %s\n",pit_service);
2682  break;
2683  case 'z': /* Enable hist summary*/
2684  hist_summary=1;
2685  sprintf(splash[splash_line++],"\tHistogram summary enabled.\n");
2686  break;
2687  case 'O': /* Argument is the Op rate */
2688  subarg=argv[optind++];
2689  if(subarg==(char *)0)
2690  {
2691  printf("-+O takes an operand !!\n");
2692  exit(200);
2693  }
2694  op_rate = atoi(subarg);
2695  if(op_rate <= 0)
2696  op_rate = 1;
2697  op_rate_flag = 1;
2698  sprintf(splash[splash_line++],"\tRate control active %d Ops/sec .\n",op_rate);
2699  break;
2700  default:
2701  printf("Unsupported Plus option -> %s <-\n",optarg);
2702  exit(255);
2703  break;
2704  }
2705  break;
2706  default:
2707  printf("Unsupported option -> %s <-\n",optarg);
2708  exit(255);
2709  }
2710  }
2711  base_time=(long)time_so_far();
2712  get_resolution(); /* Get clock resolution */
2713  if(speed_code)
2714  {
2716  exit(0);
2717  }
2718  if(r_count > 1)
2719  {
2720  aflag=1;
2721  rflag=0;
2722  NOCROSSflag=1;
2723  }
2724  if(s_count > 1)
2725  {
2726  aflag=1;
2727  sflag=0;
2728  NOCROSSflag=1;
2729  }
2730  /*
2731  * If not in silent mode then display the splash screen.
2732  */
2733  for(i=0;i<splash_line;i++)
2734  if(!silent) printf("%s",splash[i]);
2735  /*
2736  * Save the command line for later
2737  */
2739 
2740  if(pflag) /* Allocate after cache_size is set */
2741  {
2742  alloc_pbuf();
2743  }
2744  if(distributed && master_iozone)
2745  {
2746  if(maxt > clients_found)
2747  {
2748  printf("You can not specify more threads/processes than you have in the client file list\n");
2749  exit(202);
2750  }
2751  }
2752 
2753  if(!OPS_flag && !MS_flag)
2754  {
2755  if(!silent) printf("\tOutput is in Kbytes/sec\n");
2756  }
2757  if (min_rec_size > max_rec_size) {
2758 #ifdef NO_PRINT_LLD
2759  printf("Error: minimum record size %ld KB is greater than maximum record size %ld KB\n ",
2760  min_rec_size/1024, max_rec_size/1024);
2761 #else
2762  printf("Error: minimum record size %lld KB is greater than maximum record size %lld KB\n ",
2763  min_rec_size/1024, max_rec_size/1024);
2764 #endif
2765  exit(23);
2766  }
2769  /*
2770  * No telemetry files... just option selected
2771  */
2772  if(compute_flag && jflag && !(r_traj_flag || w_traj_flag))
2773  if(!silent) printf("\tCompute time %f seconds for reads and writes.\n",compute_time);
2774  /*
2775  * Read telemetry file and option selected
2776  */
2778  {
2779  if(r_traj_items==3)
2780  {
2781  if(!silent) printf("\tCompute time from telemetry files for reads.\n");
2782  }
2783  else
2784  {
2785  if(jflag)
2786  if(!silent) printf("\tCompute time %f seconds for reads.\n",compute_time);
2787  }
2788  if(jflag)
2789  if(!silent) printf("\tCompute time %f seconds for writes.\n",compute_time);
2790  }
2791  /*
2792  * Write telemetry file and option selected
2793  */
2795  {
2796  if(w_traj_items==3)
2797  {
2798  if(!silent) printf("\tCompute time from telemetry files for writes.\n");
2799  }
2800  else
2801  {
2802  if(jflag)
2803  if(!silent) printf("\tCompute time %f seconds for writes.\n",compute_time);
2804  }
2805  if(jflag)
2806  if(!silent) printf("\tCompute time %f seconds for reads.\n",compute_time);
2807  }
2809  {
2810  if(r_traj_items==3)
2811  {
2812  if(!silent) printf("\tCompute time from telemetry files for reads.\n");
2813  }
2814  else
2815  {
2816  if(!silent) printf("\tCompute time %f seconds for reads.\n",compute_time);
2817  }
2818  if(w_traj_items==3)
2819  {
2820  if(!silent) printf("\tCompute time from telemetry files for writes.\n");
2821  }
2822  else
2823  {
2824  if(!silent) printf("\tCompute time %f seconds for writes.\n",compute_time);
2825  }
2826  }
2828  {
2829  if(r_traj_items==3)
2830  {
2831  if(!silent) printf("\tCompute time from telemetry files for reads.\n");
2832  }
2833  else
2834  {
2835  if(!silent) printf("\tNo compute time for reads.\n");
2836  }
2837 
2838  if(w_traj_items==3)
2839  {
2840  if(!silent) printf("\tCompute time from telemetry files for writes.\n");
2841  }
2842  else
2843  {
2844  if(!silent) printf("\tNo compute time for writes.\n");
2845  }
2846  }
2847 
2848  /* Enforce only write,rewrite,read,reread */
2849  if(w_traj_flag || r_traj_flag)
2850  {
2851  for(i=2;i<sizeof(func)/sizeof(char *);i++)
2852  {
2853  if(seq_mix && (i==8))
2854  ;
2855  else
2856  include_test[i] = 0;
2857  }
2858  }
2859 
2860  if(r_traj_flag)
2861  {
2862  if(include_test[READER_TEST] == 0)
2863  {
2866  include_tflag=1;
2867  }
2868  }
2869  if(w_traj_flag)
2870  {
2871  if(include_test[WRITER_TEST] == 0)
2872  {
2874  include_tflag=1;
2875  }
2876  }
2877  if(w_traj_flag && w_traj_fsize != 0)
2879  if(r_traj_flag && r_traj_fsize != 0)
2881 
2882  if( sverify==0 && (w_traj_flag || r_traj_flag))
2883  {
2884  printf("\n\tFull verification not supported in telemetry mode.\n\n");
2885  exit(17);
2886  }
2887  ;
2889  {
2890  printf("\n\tDisrupt not supported in telemetry mode.\n\n");
2891  exit(17);
2892  }
2893  if(aflag &&(w_traj_flag || r_traj_flag) )
2894  {
2895  printf("\n\tAuto mode not supported in telemetry mode.\n");
2896  printf("\tTry: -i 0 -i 1 \n\n");
2897  exit(17);
2898  }
2899  if(sflag && w_traj_flag )
2900  {
2901  printf("\n\tSize of file is determined by telemetry file.\n\n");
2902  exit(17);
2903  }
2904  if(rflag && w_traj_flag )
2905  {
2906  printf("\n\tRecord size of file is determined by telemetry file.\n\n");
2907  exit(17);
2908  }
2909  if(stride_flag && (w_traj_flag || r_traj_flag))
2910  {
2911  printf("\n\tStride size is determined by telemetry file.\n\n");
2912  exit(17);
2913  }
2914  if(trflag && MS_flag)
2915  {
2916  printf("\n\tMicrosecond mode not supported in throughput mode.\n\n");
2917  exit(17);
2918  }
2919  if (trflag /* throughput mode, don't allow auto-mode options: */
2920  && (auto_mode || aflag || yflag || qflag || nflag || gflag))
2921  {
2922  printf("\n\tCan not mix throughput mode and auto-mode flags.\n\n");
2923  exit(17);
2924  }
2925  if(fflag && trflag)
2926  {
2927  printf("\n\tYou must use -F when using multiple threads or processes.\n\n");
2928  exit(17);
2929  }
2930  if(aflag && mfflag)
2931  {
2932  printf("\n\tYou must use -f when using auto mode.\n\n");
2933  exit(17);
2934  }
2935  if(async_flag && mmapflag)
2936  {
2937  printf("\n\tSorry ... Only mmap or async but not both\n\n");
2938  exit(18);
2939  }
2940 #ifndef ASYNC_IO
2941  if(async_flag)
2942  {
2943  printf("\n\tSorry ... This version does not support async I/O\n\n");
2944  exit(19);
2945  }
2946 #endif
2947  if(no_write)
2948  {
2949  if(!include_tflag)
2950  {
2951  printf("You must specify which tests ( -i # ) when using -+E\n");
2952  exit(19);
2953  }
2954  }
2955  if(include_tflag)
2956  {
2957  for(i=0;i<sizeof(func)/sizeof(char *);i++)
2958  if(include_test[i])
2959  include_mask|=(long long)(1<<i);
2960  /* printf(">> %llx",include_mask); HERE */
2961  }
2962  if(no_write) /* Disable if any writer would disturbe existing file */
2963  {
2964  if(include_test[0] || include_test[4] ||
2965  include_test[6] || include_test[8] || include_test[9] ||
2966  include_test[11])
2967  {
2968  printf("You must disable any test that writes when using -+E\n");
2969  exit(20);
2970  }
2971  }
2972  if(no_write) /* User must specify the existing file name */
2973  {
2974  if(!(fflag | mfflag))
2975  {
2976  printf("You must use -f or -F when using -+E\n");
2977  exit(20);
2978  }
2979  }
2980  if(h_flag && k_flag)
2981  {
2982  printf("\n\tCan not do both -H and -k\n");
2983  exit(20);
2984  }
2985  if((dedup | dedup_interior) && diag_v)
2986  {
2987  printf("\n\tCan not do both -+d and -+w\n");
2988  exit(20);
2989  }
2990 
2991  if(!aflag && !rflag)
2993 
2995  if(!silent) printf("\tTime Resolution = %1.6f seconds.\n",time_res);
2996 #ifdef NO_PRINT_LLD
2997  if(!silent) printf("\tProcessor cache size set to %ld Kbytes.\n",cache_size/1024);
2998  if(!silent) printf("\tProcessor cache line size set to %ld bytes.\n",cache_line_size);
2999  if(!silent) printf("\tFile stride size set to %ld * record size.\n",stride);
3000 #else
3001  if(!silent) printf("\tProcessor cache size set to %ld Kbytes.\n",cache_size/1024);
3002  if(!silent) printf("\tProcessor cache line size set to %ld bytes.\n",cache_line_size);
3003  if(!silent) printf("\tFile stride size set to %lld * record size.\n",stride);
3004 #endif
3005  if(!rflag)
3006  reclen=(long long)4096;
3007 
3008  if(uflag && !lflag)
3009  num_child=mint = 1;
3010  if(lflag && !uflag)
3011  maxt = mint;
3012  if(use_thread)
3013  port="thread";
3014  else
3015  port="process";
3016  if(lflag || uflag){
3017 #ifdef NO_PRINT_LLD
3018  if(!silent) printf("\tMin %s = %ld \n",port,mint);
3019  if(!silent) printf("\tMax %s = %ld \n",port,maxt);
3020 #else
3021  if(!silent) printf("\tMin %s = %lld \n",port,mint);
3022  if(!silent) printf("\tMax %s = %lld \n",port,maxt);
3023 #endif
3024  }
3025  if(trflag)
3026  {
3027  if(num_child > 1)
3028  {
3029  if(use_thread)
3030  {
3031  port="threads";
3032  }
3033  else
3034  {
3035  port="processes";
3036  }
3037  }
3038 
3039 #ifdef NO_PRINT_LLD
3040  if(!silent) printf("\tThroughput test with %ld %s\n", num_child,port);
3041 #else
3042  if(!silent) printf("\tThroughput test with %lld %s\n", num_child,port);
3043 #endif
3044  }
3045  numrecs64 = (long long)(kilobytes64*1024)/reclen;
3046  if (reclen > (long long)MAXBUFFERSIZE) {
3047 #ifdef NO_PRINT_LLD
3048  printf("Error: Maximum record length is %ld bytes\n",
3049  MAXBUFFERSIZE);
3050 #else
3051  printf("Error: Maximum record length is %lld bytes\n",
3052  (long long)MAXBUFFERSIZE);
3053 #endif
3054  exit(21);
3055  }
3056  if (reclen < (long long)MINBUFFERSIZE) {
3057 #ifdef NO_PRINT_LLD
3058  printf("Error: Minimum record length is %ld bytes\n",
3059  MINBUFFERSIZE);
3060 #else
3061  printf("Error: Minimum record length is %lld bytes\n",
3062  (long long)MINBUFFERSIZE);
3063 #endif
3064  exit(22);
3065  }
3066  /* Only bzero or fill that which you will use. The buffer is very large */
3067  if(verify )
3068  {
3069  fill_buffer((char *)buffer,l_min(reclen,(long long)cache_size),(long long)pattern,(char)sverify,(long long)0);
3070  if(pflag)
3071  fill_buffer((char *)pbuffer,l_min(reclen,(long long)cache_size),(long long)pattern,(char)sverify,(long long)0);
3072  if(mflag)
3073  fill_buffer((char *)mbuffer,l_min(reclen,(long long)cache_size),(long long)pattern,(char)sverify,(long long)0);
3074  }
3075  else
3076  {
3077  bzero(buffer,(size_t)l_min(reclen,(long long)cache_size));
3078  }
3079 
3080 #ifndef NO_THREADS
3081 #if defined( _HPUX_SOURCE ) || defined ( linux )
3082  if(ioz_processor_bind)
3083  {
3084  bind_cpu=begin_proc;
3085 #if defined( _HPUX_SOURCE )
3086  pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
3087  (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
3088 #else
3089  cpu_set_t cpuset;
3090  CPU_ZERO(&cpuset);
3091  CPU_SET(bind_cpu, &cpuset);
3092 
3093  pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
3094 #endif
3095  my_nap(40); /* Switch to new cpu */
3096  }
3097 #endif
3098 #endif
3100  if(trflag){
3102  goto out;
3103  }
3104  if(trflag && (mint == maxt)){
3105  auto_mode=0;
3106  throughput_test();
3107  goto out;
3108  }
3109  if (aflag) {
3110  print_header();
3111  auto_test();
3112  goto out;
3113  }
3114  print_header();
3115  (void) begin(kilobytes64,reclen);
3116 out:
3117  if(r_traj_flag)
3118  fclose(r_traj_fd);
3119  if(w_traj_flag)
3120  fclose(w_traj_fd);
3121  if (!no_unlink)
3122  {
3123  if(check_filename(dummyfile[0]))
3124  unlink(dummyfile[0]); /* delete the file */
3125  }
3126  if(!silent) printf("\niozone test complete.\n");
3127  if(res_prob)
3128  {
3129  printf("Timer resolution is poor. Some small transfers may have \n");
3130  printf("reported inaccurate results. Sizes %ld Kbytes and below.\n",
3131  (long)(rec_prob/(long long)1024));
3132  }
3133 
3134  if(Rflag && !trflag){
3135  dump_excel();
3136  }
3137  return(0);
3138 }
int check_filename()
long long orig_max_rec_size
Definition: iozone.c:1383
int atoi()
#define IBUFSIZE
Definition: iozone.c:775
long long depth
Definition: iozone.c:1536
void find_external_mon(char *imon_start, char *imon_stop)
Definition: iozone.c:22729
char fflag
Definition: iozone.c:1329
unsigned long cache_line_size
Definition: iozone.c:1376
char pit_hostname[40]
Definition: iozone.c:1400
VOLATILE char * pbuffer
Definition: iozone.c:1368
long long rec_prob
Definition: iozone.c:1294
long long include_test[50]
Definition: iozone.c:1331
int w_traj_flag
Definition: iozone.c:1523
int mdebug
Definition: iozone.c:1479
char compute_flag
Definition: iozone.c:1520
char * getenv()
char diag_v
Definition: iozone.c:1304
int controlling_host_port
Definition: iozone.c:1410
int get_client_info()
Definition: iozone.c:22417
FILE * r_traj_fd
Definition: iozone.c:1367
long long r_traj_fsize
Definition: iozone.c:1325
int s_count
Definition: iozone.c:1286
char controlling_host_name[100]
Definition: iozone.c:1493
char sflag
Definition: iozone.c:1303
off64_t s_range[100]
Definition: iozone.c:1283
char Cflag
Definition: iozone.c:1371
char verify
Definition: iozone.c:1513
char Kplus_flag
Definition: iozone.c:1509
#define WRITER_TEST
Definition: iozone.c:902
long long stride
Definition: iozone.c:1532
void touch_dedup()
#define READER_TEST
Definition: iozone.c:903
void show_help()
Definition: iozone.c:3318
int no_unlink
Definition: iozone.c:1521
void bzero()
int no_write
Definition: iozone.c:1522
void fill_buffer()
char mmapflag
Definition: iozone.c:1512
char k_flag
Definition: iozone.c:1509
char dedup_compress
Definition: iozone.c:1304
char splash[80][80]
Definition: iozone.c:1394
int restf
Definition: iozone.c:1514
char rflag
Definition: iozone.c:1303
char trflag
Definition: iozone.c:1320
char mountname[MAXNAMESIZE]
Definition: iozone.c:1361
long long w_traj_size()
Definition: iozone.c:19825
void signal_handler()
Definition: iozone.c:3336
#define PATTERN
Definition: iozone.c:822
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
Definition: appio.c:275
int advise_op
Definition: iozone.c:1526
off64_t r_range[100]
Definition: iozone.c:1282
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
char stride_flag
Definition: iozone.c:1512
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
long long multi_buffer
Definition: iozone.c:1290
int dedup_mseed
Definition: iozone.c:1299
char disrupt_flag
Definition: iozone.c:1520
int advise_flag
Definition: iozone.c:1526
char nflag
Definition: iozone.c:1311
long long reclen
Definition: iozone.c:1535
int num_processors
Definition: iozone.c:1293
void(* func[])()
Definition: iozone.c:1198
char read_sync
Definition: iozone.c:1295
long long myid
Definition: iozone.c:1335
long long w_traj_fsize
Definition: iozone.c:1325
int op_rate
Definition: iozone.c:1301
char distributed
Definition: iozone.c:1296
long long maxt
Definition: iozone.c:1324
char hflag
Definition: iozone.c:1303
#define RECLEN_START
Definition: iozone.c:893
char use_thread
Definition: iozone.c:1372
float compute_time
Definition: iozone.c:1538
char Uflag
Definition: iozone.c:1329
char * dedup_ibuf
Definition: iozone.c:1305
char * mbuffer
Definition: iozone.c:1366
char gflag
Definition: iozone.c:1311
long base_time
Definition: iozone.c:1323
void auto_test()
Definition: iozone.c:3404
char client_iozone
Definition: iozone.c:1296
char noretest
Definition: iozone.c:1510
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
#define CACHE_LINE_SIZE
Definition: iozone.c:750
void do_speed_check()
char * alloc_mem()
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
FILE * pi
Definition: iozone.c:1367
long long mint
Definition: iozone.c:1324
char X_flag
Definition: iozone.c:1520
long long delay_start
Definition: iozone.c:1536
void srand()
int multiplier
Definition: iozone.c:1539
char unbuffered
Definition: iozone.c:1509
char jflag
Definition: iozone.c:1509
char aflag
Definition: iozone.c:1303
int w_traj_items
Definition: iozone.c:1328
char master_iozone
Definition: iozone.c:1296
char include_tflag
Definition: iozone.c:1329
char Eflag
Definition: iozone.c:1303
long long page_size
Definition: iozone.c:428
void get_rusage_resolution()
Definition: iozone.c:19174
off64_t maximum_file_size
Definition: iozone.c:1356
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char mmapasflag
Definition: iozone.c:1512
char * build_name
Definition: iozone.c:1316
void throughput_test()
Definition: iozone.c:3530
int pct_read
Definition: iozone.c:1336
void get_resolution()
Definition: iozone.c:19131
int cdebug
Definition: iozone.c:1478
char lflag
Definition: iozone.c:1329
int t_count
Definition: iozone.c:1285
char * mainbuffer
Definition: iozone.c:1366
int junk
Definition: iozone.c:1402
int begin_proc
Definition: iozone.c:1293
#define RECLEN_END
Definition: iozone.c:895
char odsync
Definition: iozone.c:1516
long long include_mask
Definition: iozone.c:1332
int aggflag
Definition: iozone.c:1480
char * dedup_temp
Definition: iozone.c:1306
void alloc_pbuf()
Definition: iozone.c:23620
char * buffer1
Definition: iozone.c:1366
int op_rate_flag
Definition: iozone.c:1302
void multi_throughput_test()
char ** argvsave
Definition: iozone.c:1393
char dedup
Definition: iozone.c:1304
long long num_child
Definition: iozone.c:1335
long long ret
Definition: iozone.c:1346
char Z_flag
Definition: iozone.c:1520
char NOCROSSflag
Definition: iozone.c:1333
char imon_start[256]
Definition: iozone.c:1318
char L_flag
Definition: iozone.c:1518
#define MINBUFFERSIZE
Definition: iozone.c:816
void traj_vers()
Definition: iozone.c:19916
int optind
char mfflag
Definition: iozone.c:1334
char imon_stop[256]
Definition: iozone.c:1318
void dump_excel()
Definition: iozone.c:11653
int r_traj_items
Definition: iozone.c:1328
#define MAXBUFFERSIZE
Definition: iozone.c:809
char * buffer
Definition: iozone.c:1366
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
int r_count
Definition: iozone.c:1286
off64_t numrecs64
Definition: iozone.c:1534
char notruncate
Definition: iozone.c:1511
char mmapssflag
Definition: iozone.c:1512
int share_file
Definition: iozone.c:1309
char qflag
Definition: iozone.c:1312
char write_traj_filename[MAXNAMESIZE]
Definition: iozone.c:1507
off64_t minimum_file_size
Definition: iozone.c:1357
__sighandler_t signal(int __sig, __sighandler_t __handler) __attribute__((__nothrow__
char dedup_interior
Definition: iozone.c:1304
void record_command_line()
long long auto_mode
Definition: iozone.c:1290
FILE * open_r_traj()
Definition: iozone.c:19685
FILE * open_w_traj()
Definition: iozone.c:19707
#define CACHE_SIZE
Definition: iozone.c:751
int cret
Definition: fileop.c:138
#define THISVERSION
Definition: iozone.c:63
long long fetchon
Definition: iozone.c:1533
off64_t kilobytes64
Definition: iozone.c:1277
char pflag
Definition: iozone.c:1509
unsigned int pattern
Definition: iozone.c:1531
int t_range[100]
Definition: iozone.c:1284
char xflag
Definition: iozone.c:1520
void print_header()
Definition: iozone.c:11351
FILE * w_traj_fd
Definition: iozone.c:1367
char mflag
Definition: iozone.c:1509
void init_record_sizes()
char oflag
Definition: iozone.c:1509
void my_nap()
int rand()
char yflag
Definition: iozone.c:1312
int r_traj_flag
Definition: iozone.c:1523
int argcsave
Definition: iozone.c:1392
void r_traj_size()
Definition: iozone.c:19732
char h_flag
Definition: iozone.c:1509
char bif_filename[MAXNAMESIZE]
Definition: iozone.c:1359
long long min_rec_size
Definition: iozone.c:1380
char silent
Definition: iozone.c:1295
char seq_mix
Definition: iozone.c:1322
char read_traj_filename[MAXNAMESIZE]
Definition: iozone.c:1508
char Q_flag
Definition: iozone.c:1517
char pit_service[8]
Definition: iozone.c:1401
long long res_prob
Definition: iozone.c:1294
int speed_code
Definition: iozone.c:1336
int ioz_processor_bind
Definition: iozone.c:1293
char tfile[]
Definition: iozone.c:1365
char no_copy_flag
Definition: iozone.c:1519
off64_t min_file_size
Definition: iozone.c:1378
int clients_found
Definition: iozone.c:1474
char Rflag
Definition: iozone.c:1303
long long max_rec_size
Definition: iozone.c:1381
off64_t max_file_size
Definition: iozone.c:1379
long long l_min()
#define USAGE
Definition: iozone.c:829
static double time_so_far()
Definition: iozone.c:6844
char * default_filename
Definition: iozone.c:1369
char bif_flag
Definition: iozone.c:1307
char include_close
Definition: iozone.c:1519
char RWONLYflag
Definition: iozone.c:1333
char OPS_flag
Definition: iozone.c:1517
long long orig_size
Definition: iozone.c:1274
int mygen
Definition: iozone.c:1524
char client_filename[256]
Definition: iozone.c:1396
int unlink()
void exit()
int rlocking
Definition: iozone.c:1308
char mmapnsflag
Definition: iozone.c:1512
#define MODE
Definition: iozone.c:88
char * optarg
setvbuf(file, file_buf, _IOFBF, sizeof(file_buf))
double cputime_res
Definition: iozone.c:1271
#define MAXSTREAMS
Definition: iozone.c:813
char uflag
Definition: iozone.c:1329
long long rest_val
Definition: iozone.c:1540
int Kplus_readers
Definition: iozone.c:1506
char mmap_mix
Definition: iozone.c:1512
long long off64_t
Definition: iozone.c:357
void begin()
unsigned long cache_size
Definition: iozone.c:1375
int i
Definition: fileop.c:140
long long orig_min_rec_size
Definition: iozone.c:1382
int direct_flag
Definition: iozone.c:1527
char * head1[]
Definition: iozone.c:246
#define RANDOM_MIX_TEST
Definition: iozone.c:910
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
int splash_line
Definition: iozone.c:1395
Here is the call graph for this function:

◆ master_listen() [1/2]

void master_listen ( )
Here is the caller graph for this function:

◆ master_listen() [2/2]

void master_listen ( int  sock,
int  size_of_message 
)

Definition at line 20350 of file iozone.c.

20353 {
20354  int tsize;
20355  int s;
20356  struct sockaddr_in *addr;
20357  unsigned int me;
20358  int ns,ret;
20359  struct master_neutral_command *mnc;
20360 
20361  mnc=(struct master_neutral_command *)&master_rcv_buf[0];
20362  tsize = size_of_message;
20363  addr=&listener_sync_sock;
20364  s = sock;
20365  me=sizeof(struct sockaddr_in);
20366 
20367  if(mdebug)
20368  printf("Master in listening mode on socket %d\n",s);
20369 again:
20370  ret=listen(s,MAXSTREAMS);
20371  if(ret != 0)
20372  {
20373  perror("Master: listen returned error\n");
20374  }
20375  if(mdebug)
20376  printf("Master in accepting connection\n");
20377  ns=accept(s,(void *)addr,&me);
20378  if(ns < 0)
20379  {
20380  printf("Master socket %d\n",s);
20381  perror("Master: ***** accept returned error *****\n");
20382  sleep(1);
20383  goto again;
20384  }
20385  if(mdebug)
20386  printf("Master in reading from connection\n");
20387 
20388  ret=read(ns,mnc,tsize);
20389  if(ret < tsize)
20390  {
20391  printf("Master read failed. Ret %d Errno %d\n",ret,errno);
20392  }
20393 
20394  close(ns);
20395 }
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
int mdebug
Definition: iozone.c:1479
char master_rcv_buf[4096]
Definition: iozone.c:1460
double s
Definition: byte_profile.c:36
long long ret
Definition: iozone.c:1346
int close()
struct sockaddr_in listener_sync_sock
Definition: iozone.c:20343
#define MAXSTREAMS
Definition: iozone.c:813
int errno
Here is the call graph for this function:

◆ master_send() [1/2]

void master_send ( )
Here is the caller graph for this function:

◆ master_send() [2/2]

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.

20561 {
20562  int rc;
20563  struct client_neutral_command outbuf;
20564 
20565  bzero(&outbuf,sizeof(struct client_neutral_command));
20566  if(mdebug)
20567  {
20568  printf("Master_neutral_command size = %lu\n",(unsigned long)sizeof(struct master_neutral_command));
20569  printf("Client_neutral_command size = %lu\n",(unsigned long)sizeof(struct client_neutral_command));
20570  }
20571  /*
20572  * Convert internal commands to string format for neutral format/portability
20573  */
20574  strcpy(outbuf.c_host_name,send_buffer->c_host_name);
20575  strcpy(outbuf.c_pit_hostname,send_buffer->c_pit_hostname);
20576  strcpy(outbuf.c_pit_service,send_buffer->c_pit_service);
20577  strcpy(outbuf.c_client_name,send_buffer->c_client_name);
20578  strcpy(outbuf.c_working_dir,send_buffer->c_working_dir);
20579  strcpy(outbuf.c_file_name,send_buffer->c_file_name);
20580  strcpy(outbuf.c_path_dir,send_buffer->c_path_dir);
20581  strcpy(outbuf.c_execute_name,send_buffer->c_execute_name);
20582  strcpy(outbuf.c_write_traj_filename,send_buffer->c_write_traj_filename);
20583  strcpy(outbuf.c_read_traj_filename,send_buffer->c_read_traj_filename);
20584  sprintf(outbuf.c_oflag,"%d",send_buffer->c_oflag);
20585  sprintf(outbuf.c_mfflag,"%d",send_buffer->c_mfflag);
20586  sprintf(outbuf.c_unbuffered,"%d",send_buffer->c_unbuffered);
20587  sprintf(outbuf.c_noretest,"%d",send_buffer->c_noretest);
20588  sprintf(outbuf.c_notruncate,"%d",send_buffer->c_notruncate);
20589  sprintf(outbuf.c_read_sync,"%d",send_buffer->c_read_sync);
20590  sprintf(outbuf.c_jflag,"%d",send_buffer->c_jflag);
20591  sprintf(outbuf.c_async_flag,"%d",send_buffer->c_async_flag);
20592  sprintf(outbuf.c_mmapflag,"%d",send_buffer->c_mmapflag);
20593  sprintf(outbuf.c_k_flag,"%d",send_buffer->c_k_flag);
20594  sprintf(outbuf.c_h_flag,"%d",send_buffer->c_h_flag);
20595  sprintf(outbuf.c_mflag,"%d",send_buffer->c_mflag);
20596  sprintf(outbuf.c_pflag,"%d",send_buffer->c_pflag);
20597  sprintf(outbuf.c_stride_flag,"%d",send_buffer->c_stride_flag);
20598  sprintf(outbuf.c_verify,"%d",send_buffer->c_verify);
20599  sprintf(outbuf.c_sverify,"%d",send_buffer->c_sverify);
20600  sprintf(outbuf.c_odsync,"%d",send_buffer->c_odsync);
20601  sprintf(outbuf.c_diag_v,"%d",send_buffer->c_diag_v);
20602  sprintf(outbuf.c_dedup,"%d",send_buffer->c_dedup);
20603  sprintf(outbuf.c_dedup_interior,"%d",send_buffer->c_dedup_interior);
20604  sprintf(outbuf.c_dedup_compress,"%d",send_buffer->c_dedup_compress);
20605  sprintf(outbuf.c_dedup_mseed,"%d",send_buffer->c_dedup_mseed);
20606  sprintf(outbuf.c_hist_summary,"%d",send_buffer->c_hist_summary);
20607  sprintf(outbuf.c_op_rate,"%d",send_buffer->c_op_rate);
20608  sprintf(outbuf.c_op_rate_flag,"%d",send_buffer->c_op_rate_flag);
20609  sprintf(outbuf.c_Q_flag,"%d",send_buffer->c_Q_flag);
20610  sprintf(outbuf.c_L_flag,"%d",send_buffer->c_L_flag);
20611  sprintf(outbuf.c_include_flush,"%d",send_buffer->c_include_flush);
20612  sprintf(outbuf.c_OPS_flag,"%d",send_buffer->c_OPS_flag);
20613  sprintf(outbuf.c_mmapnsflag,"%d",send_buffer->c_mmapnsflag);
20614  sprintf(outbuf.c_mmapssflag,"%d",send_buffer->c_mmapssflag);
20615  sprintf(outbuf.c_mmapasflag,"%d",send_buffer->c_mmapasflag);
20616  sprintf(outbuf.c_no_copy_flag,"%d",send_buffer->c_no_copy_flag);
20617  sprintf(outbuf.c_include_close,"%d",send_buffer->c_include_close);
20618  sprintf(outbuf.c_disrupt_flag,"%d",send_buffer->c_disrupt_flag);
20619  sprintf(outbuf.c_compute_flag,"%d",send_buffer->c_compute_flag);
20620  sprintf(outbuf.c_xflag,"%d",send_buffer->c_xflag);
20621  sprintf(outbuf.c_MS_flag,"%d",send_buffer->c_MS_flag);
20622  sprintf(outbuf.c_mmap_mix,"%d",send_buffer->c_mmap_mix);
20623  sprintf(outbuf.c_Kplus_flag,"%d",send_buffer->c_Kplus_flag);
20624  sprintf(outbuf.c_w_traj_flag,"%d",send_buffer->c_w_traj_flag);
20625  sprintf(outbuf.c_r_traj_flag,"%d",send_buffer->c_r_traj_flag);
20626  sprintf(outbuf.c_direct_flag,"%d",send_buffer->c_direct_flag);
20627  sprintf(outbuf.c_cpuutilflag,"%d",send_buffer->c_cpuutilflag);
20628  sprintf(outbuf.c_seq_mix,"%d",send_buffer->c_seq_mix);
20629  sprintf(outbuf.c_client_number,"%d",send_buffer->c_client_number);
20630  sprintf(outbuf.c_command,"%d",send_buffer->c_command);
20631  sprintf(outbuf.c_testnum,"%d",send_buffer->c_testnum);
20632  sprintf(outbuf.c_no_unlink,"%d",send_buffer->c_no_unlink);
20633  sprintf(outbuf.c_no_write,"%d",send_buffer->c_no_write);
20634  sprintf(outbuf.c_file_lock,"%d",send_buffer->c_file_lock);
20635  sprintf(outbuf.c_rec_lock,"%d",send_buffer->c_rec_lock);
20636  sprintf(outbuf.c_Kplus_readers,"%d",send_buffer->c_Kplus_readers);
20637  sprintf(outbuf.c_multiplier,"%d",send_buffer->c_multiplier);
20638  sprintf(outbuf.c_share_file,"%d",send_buffer->c_share_file);
20639  sprintf(outbuf.c_pattern,"%d",send_buffer->c_pattern);
20640  sprintf(outbuf.c_version,"%d",send_buffer->c_version);
20641  sprintf(outbuf.c_base_time,"%d",send_buffer->c_base_time);
20642  sprintf(outbuf.c_num_child,"%d",send_buffer->c_num_child);
20643  sprintf(outbuf.c_pct_read,"%d",send_buffer->c_pct_read);
20644  sprintf(outbuf.c_advise_op,"%d",send_buffer->c_advise_op);
20645  sprintf(outbuf.c_advise_flag,"%d",send_buffer->c_advise_flag);
20646  sprintf(outbuf.c_restf,"%d",send_buffer->c_restf);
20647  sprintf(outbuf.c_mygen,"%d",send_buffer->c_mygen);
20648 #ifdef NO_PRINT_LLD
20649  sprintf(outbuf.c_stride,"%ld",send_buffer->c_stride);
20650  sprintf(outbuf.c_rest_val,"%ld",send_buffer->c_rest_val);
20651  sprintf(outbuf.c_delay,"%ld",send_buffer->c_delay);
20652  sprintf(outbuf.c_purge,"%ld",send_buffer->c_purge);
20653  sprintf(outbuf.c_fetchon,"%ld",send_buffer->c_fetchon);
20654  sprintf(outbuf.c_numrecs64,"%ld",send_buffer->c_numrecs64);
20655  sprintf(outbuf.c_reclen,"%ld",send_buffer->c_reclen);
20656  sprintf(outbuf.c_child_flag,"%ld",send_buffer->c_child_flag);
20657  sprintf(outbuf.c_delay_start,"%ld",send_buffer->c_delay_start);
20658  sprintf(outbuf.c_depth,"%ld",send_buffer->c_depth);
20659 #else
20660  sprintf(outbuf.c_delay,"%lld",send_buffer->c_delay);
20661  sprintf(outbuf.c_stride,"%lld",send_buffer->c_stride);
20662  sprintf(outbuf.c_rest_val,"%lld",send_buffer->c_rest_val);
20663  sprintf(outbuf.c_purge,"%lld",send_buffer->c_purge);
20664  sprintf(outbuf.c_fetchon,"%lld",send_buffer->c_fetchon);
20665  sprintf(outbuf.c_numrecs64,"%lld",send_buffer->c_numrecs64);
20666  sprintf(outbuf.c_reclen,"%lld",send_buffer->c_reclen);
20667  sprintf(outbuf.c_child_flag,"%lld",send_buffer->c_child_flag);
20668  sprintf(outbuf.c_delay_start,"%lld",send_buffer->c_delay_start);
20669  sprintf(outbuf.c_depth,"%lld",send_buffer->c_depth);
20670 #endif
20671  sprintf(outbuf.c_stop_flag,"%d",send_buffer->c_stop_flag);
20672  sprintf(outbuf.c_compute_time,"%f",send_buffer->c_compute_time);
20673 
20674  if(mdebug >= 1)
20675  printf("Master sending message to %s \n",host_name);
20676  /*rc = send(child_socket_val, (char *)&outbuf, sizeof(struct client_neutral_command), 0);*/
20677  rc = write(child_socket_val, (char *)&outbuf, sizeof(struct client_neutral_command));
20678  if (rc < 0)
20679  {
20680  perror("write failed\n");
20681  exit(26);
20682  }
20683 }
long long c_depth
Definition: iozone.c:574
int c_version
Definition: iozone.c:557
char c_path_dir[200]
Definition: iozone.c:496
int c_num_child
Definition: iozone.c:559
int c_share_file
Definition: iozone.c:555
int c_read_sync
Definition: iozone.c:505
int c_diag_v
Definition: iozone.c:516
int c_cpuutilflag
Definition: iozone.c:544
rc
Definition: pscanf.h:23
long long c_delay
Definition: iozone.c:567
long long c_delay_start
Definition: iozone.c:573
int mdebug
Definition: iozone.c:1479
int c_verify
Definition: iozone.c:513
int c_L_flag
Definition: iozone.c:525
int c_disrupt_flag
Definition: iozone.c:534
char c_working_dir[200]
Definition: iozone.c:494
int c_testnum
Definition: iozone.c:548
void bzero()
int c_pct_read
Definition: iozone.c:560
int c_stride_flag
Definition: iozone.c:512
long long c_purge
Definition: iozone.c:568
int c_advise_op
Definition: iozone.c:561
char c_read_traj_filename[200]
Definition: iozone.c:499
int c_mmap_mix
Definition: iozone.c:538
char c_execute_name[200]
Definition: iozone.c:497
char c_pit_service[8]
Definition: iozone.c:492
long long c_reclen
Definition: iozone.c:571
int c_Q_flag
Definition: iozone.c:524
int c_no_write
Definition: iozone.c:550
int c_stop_flag
Definition: iozone.c:540
int c_no_copy_flag
Definition: iozone.c:531
long long c_numrecs64
Definition: iozone.c:570
int c_k_flag
Definition: iozone.c:508
int c_no_unlink
Definition: iozone.c:549
char c_pit_hostname[40]
Definition: iozone.c:491
int c_file_lock
Definition: iozone.c:551
int c_dedup_compress
Definition: iozone.c:519
int c_base_time
Definition: iozone.c:558
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
int c_async_flag
Definition: iozone.c:507
int c_rec_lock
Definition: iozone.c:552
int c_mmapflag
Definition: iozone.c:527
int c_compute_flag
Definition: iozone.c:535
char c_file_name[200]
Definition: iozone.c:495
int c_direct_flag
Definition: iozone.c:543
float c_compute_time
Definition: iozone.c:575
int c_include_close
Definition: iozone.c:532
int c_r_traj_flag
Definition: iozone.c:542
int c_command
Definition: iozone.c:547
int c_mmapssflag
Definition: iozone.c:530
int c_dedup_interior
Definition: iozone.c:518
int c_h_flag
Definition: iozone.c:509
int c_op_rate
Definition: iozone.c:522
int c_op_rate_flag
Definition: iozone.c:523
int c_mmapnsflag
Definition: iozone.c:529
int c_sverify
Definition: iozone.c:514
char c_write_traj_filename[200]
Definition: iozone.c:498
int c_noretest
Definition: iozone.c:503
int c_hist_summary
Definition: iozone.c:521
long long c_stride
Definition: iozone.c:565
int c_Kplus_flag
Definition: iozone.c:539
char c_client_name[100]
Definition: iozone.c:493
char c_host_name[100]
Definition: iozone.c:490
int c_dedup_mseed
Definition: iozone.c:520
int c_advise_flag
Definition: iozone.c:562
int c_mfflag
Definition: iozone.c:501
int c_MS_flag
Definition: iozone.c:537
int c_odsync
Definition: iozone.c:515
int c_client_number
Definition: iozone.c:546
int c_multiplier
Definition: iozone.c:554
int c_w_traj_flag
Definition: iozone.c:541
int c_OPS_flag
Definition: iozone.c:526
int c_include_flush
Definition: iozone.c:533
long long c_fetchon
Definition: iozone.c:569
int c_unbuffered
Definition: iozone.c:502
int c_pattern
Definition: iozone.c:556
long long c_child_flag
Definition: iozone.c:572
long long c_rest_val
Definition: iozone.c:566
void exit()
int c_seq_mix
Definition: iozone.c:545
int c_notruncate
Definition: iozone.c:504
int c_mmapasflag
Definition: iozone.c:528
int c_Kplus_readers
Definition: iozone.c:553
Here is the call graph for this function:

◆ mix_perf_test() [1/2]

void mix_perf_test ( )

◆ mix_perf_test() [2/2]

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

Definition at line 22764 of file iozone.c.

22769 {
22770  return;
22771 /*
22772  printf("\nMix mode test only valid in throughput mode.\n");
22773  signal_handler();
22774  exit(180);
22775 */
22776 }

◆ mmap_end() [1/2]

void mmap_end ( )
Here is the caller graph for this function:

◆ mmap_end() [2/2]

void mmap_end ( char *  buffer,
long long  size 
)

Definition at line 18983 of file iozone.c.

18987 {
18988  if(munmap(buffer,(size_t)size)<0)
18989 #ifdef NO_PRINT_LLD
18990  printf("munmap buffer %lx, size %ld failed.\n",(long)buffer,size);
18991 #else
18992  printf("munmap buffer %lx, size %lld failed.\n",(long)buffer,size);
18993 #endif
18994 
18995 }
char * buffer
Definition: iozone.c:1366

◆ multi_throughput_test() [1/2]

void multi_throughput_test ( )
Here is the caller graph for this function:

◆ multi_throughput_test() [2/2]

void multi_throughput_test ( long long  mint,
long long  maxt 
)

Definition at line 12230 of file iozone.c.

12233 {
12234  int *t_rangeptr, *t_rangecurs;
12235  int *saveptr = (int *)0;
12236  int tofree = 0;
12237  long long i;
12238  if(t_count == 0){
12239  t_count = (int) maxt - mint + 1;
12240  t_rangeptr = (int *) malloc((size_t)sizeof(int)*t_count);
12241  saveptr = t_rangeptr;
12242  tofree = 1;
12243  t_rangecurs = t_rangeptr;
12244  for(i=mint; i<= maxt; i++) {
12245  *(t_rangecurs++) = i;
12246  }
12247  }
12248  else {
12249  t_rangeptr = &t_range[0];
12250  }
12251  for(i=0; i < t_count; i++){
12252  num_child = *(t_rangeptr++);
12253  current_client_number=0; /* Need to start with 1 */
12254  throughput_test();
12255  current_x=0;
12256  current_y++;
12257  }
12258  if(Rflag)
12259  dump_throughput();
12260  if(tofree)
12261  free(saveptr);
12262 
12263 }
int current_client_number
Definition: iozone.c:1528
long long maxt
Definition: iozone.c:1324
long long mint
Definition: iozone.c:1324
void dump_throughput()
Definition: iozone.c:18694
void throughput_test()
Definition: iozone.c:3530
int t_count
Definition: iozone.c:1285
long long num_child
Definition: iozone.c:1335
short current_x
Definition: iozone.c:1273
int t_range[100]
Definition: iozone.c:1284
char Rflag
Definition: iozone.c:1303
int i
Definition: fileop.c:140
short current_y
Definition: iozone.c:1273
Here is the call graph for this function:

◆ my_nap() [1/2]

void my_nap ( )
Here is the caller graph for this function:

◆ my_nap() [2/2]

void my_nap ( int  ntime)

Definition at line 19071 of file iozone.c.

19074 {
19075  struct timeval nap_time;
19076  int seconds, microsecs;
19077  seconds = ntime/1000; /* Now in seconds */
19078  microsecs = (ntime*1000)%1000000; /* Remaining microsecs */
19079  nap_time.tv_sec=seconds;
19080  nap_time.tv_usec=microsecs;
19081  select(0,0,0,0,&nap_time);
19082 }
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
Definition: appio.c:199
__time_t tv_sec
Here is the call graph for this function:

◆ my_unap() [1/2]

void my_unap ( )
Here is the caller graph for this function:

◆ my_unap() [2/2]

void my_unap ( unsigned long long  microsecs)

Definition at line 19093 of file iozone.c.

19096 {
19097  struct timeval nap_time;
19098  int seconds;
19099  double timein, timeout;
19100 
19101  seconds = (int)(microsecs/1000000.0); /* Now in seconds */
19102  nap_time.tv_sec=seconds;
19103  nap_time.tv_usec=(int)microsecs;
19104 
19105  timein=time_so_far1();
19106  while(1)
19107  {
19108  timeout=time_so_far1();
19109  /*printf("Sleep for %lld Curtime %g\n",microsecs,timeout-timein);*/
19110  if(timeout-timein > microsecs)
19111  break;
19112  }
19113 
19114 /*
19115  select(0,0,0,0,&nap_time);
19116 */
19117 
19118 
19119 }
__time_t tv_sec
static double time_so_far1()
Definition: iozone.c:19207
Here is the call graph for this function:

◆ mylockf() [1/2]

int mylockf ( )
Here is the caller graph for this function:

◆ mylockf() [2/2]

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

Definition at line 19388 of file iozone.c.

19391 {
19392  struct flock myflock;
19393  int ret;
19394  if(op==0) /* Generic unlock the whole file */
19395  {
19396  myflock.l_type=F_UNLCK;
19397  myflock.l_whence=SEEK_SET;
19398  myflock.l_start=0;
19399  myflock.l_len=0; /* The whole file */
19400  myflock.l_pid=getpid();
19401  ret=fcntl(fd,F_SETLKW, &myflock);
19402  }
19403  else
19404  /* Generic lock the whole file */
19405  {
19406  if(rdwr==0)
19407  myflock.l_type=F_WRLCK; /* Apply write lock */
19408  else
19409  myflock.l_type=F_RDLCK; /* Apply read lock */
19410  myflock.l_whence=SEEK_SET;
19411  myflock.l_start=0;
19412  myflock.l_len=0; /* The whole file */
19413  myflock.l_pid=getpid();
19414  ret=fcntl(fd,F_SETLKW, &myflock);
19415  }
19416  return(ret);
19417 }
int fd
Definition: iozone.c:1291
long long ret
Definition: iozone.c:1346

◆ mylockr() [1/2]

int mylockr ( )
Here is the caller graph for this function:

◆ mylockr() [2/2]

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

Definition at line 19424 of file iozone.c.

19429 {
19430  struct flock myflock;
19431  int ret;
19432  if(op==0) /* Generic unlock the whole file */
19433  {
19434  /*printf("Child: %lld Unlock offset %lld size %lld\n",chid,offset,size);*/
19435  myflock.l_type=F_UNLCK;
19436  myflock.l_whence=SEEK_SET;
19437  myflock.l_start=offset;
19438  myflock.l_len=size; /* The whole file */
19439  myflock.l_pid=getpid();
19440  ret=fcntl(fd,F_SETLKW, &myflock);
19441  }
19442  else
19443  /* Generic lock the range */
19444  {
19445  if(rdwr==0)
19446  {
19447  myflock.l_type=F_WRLCK; /* Apply write lock */
19448  /* printf("Write ");*/
19449  }
19450  else
19451  {
19452  myflock.l_type=F_RDLCK; /* Apply read lock */
19453  /* printf("Read ");*/
19454  }
19455  /*printf("Child: %lld Lock offset %lld size %lld\n",chid, offset,size);*/
19456  myflock.l_whence=SEEK_SET;
19457  myflock.l_start=offset;
19458  myflock.l_len=size; /* The whole file */
19459  myflock.l_pid=getpid();
19460  ret=fcntl(fd,F_SETLKW, &myflock);
19461  }
19462  return(ret);
19463 }
off64_t offset
Definition: iozone.c:1279
int fd
Definition: iozone.c:1291
long long ret
Definition: iozone.c:1346

◆ mythread_create() [1/2]

long long mythread_create ( )
Here is the caller graph for this function:

◆ mythread_create() [2/2]

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

Definition at line 18462 of file iozone.c.

18466 {
18467  pthread_t ts;
18468  pthread_attr_t attr;
18469  int xx;
18470  int *yy;
18471 #ifdef _64BIT_ARCH_
18472  long long meme;
18473  meme = (long long)x;
18474 #else
18475  long meme;
18476  meme = (long)x;
18477 #endif
18478  yy=(int *)x;
18479 
18480 
18481 #ifdef OSFV3
18482 
18483  xx=(int )pthread_create(&ts, pthread_attr_default,
18484  func, (void *)yy);
18485 
18486 #else
18487  pthread_attr_init(&attr);
18488  xx=(int )pthread_create((pthread_t *)&ts, (pthread_attr_t *) &attr,
18489  func, (void *)yy);
18490 #endif
18491  bcopy(&ts,&p_childids[meme],sizeof(pthread_t));
18492  if(xx < (int)0)
18493  printf("Thread create failed. Returned %d Errno = %d\n",xx,errno);
18494  if(debug1 )
18495  {
18496  printf("\nthread created has an id of %lx\n",ts);
18497  printf("meme %ld\n",meme);
18498  }
18499  return((long long)meme);
18500 }
unsigned long int pthread_t
void(* func[])()
Definition: iozone.c:1198
long long debug1
Definition: iozone.c:1373
long long x
Definition: iozone.c:1335
pthread_t p_childids[MAXSTREAMS+1]
Definition: iozone.c:1338
int errno

◆ mythread_self()

pthread_t mythread_self ( )

Definition at line 18555 of file iozone.c.

18557 {
18558  pthread_t xx;
18559  xx = pthread_self();
18560  return(xx);
18561 }
unsigned long int pthread_t

◆ O_stop_child_send()

void O_stop_child_send ( int  child_socket_val)

Definition at line 20708 of file iozone.c.

20711 {
20712  close(child_socket_val);
20713 }
int close()
Here is the call graph for this function:

◆ open_r_traj()

FILE * open_r_traj ( )

Definition at line 19685 of file iozone.c.

19687 {
19688  FILE *fd;
19689  fd=fopen(read_traj_filename,"r");
19690  if(fd == (FILE *)0)
19691  {
19692  printf("Unable to open read telemetry file \"%s\"\n",
19694  exit(174);
19695  }
19696  return(fd);
19697 }
int fd
Definition: iozone.c:1291
char read_traj_filename[MAXNAMESIZE]
Definition: iozone.c:1508
void exit()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ open_w_traj()

FILE * open_w_traj ( )

Definition at line 19707 of file iozone.c.

19709 {
19710  FILE *fd;
19711  fd=fopen(write_traj_filename,"r");
19712  if(fd == (FILE *)0)
19713  {
19714  printf("Unable to open write telemetry file \"%s\"\n",
19716  exit(175);
19717  }
19718  return(fd);
19719 }
int fd
Definition: iozone.c:1291
char write_traj_filename[MAXNAMESIZE]
Definition: iozone.c:1507
void exit()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ openSckt()

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

Definition at line 24099 of file iozone.c.

24102 {
24103  struct addrinfo *ai;
24104  int aiErr;
24105  struct addrinfo *aiHead;
24106  struct addrinfo hints;
24107  sockaddr_in6_t *pSadrIn6;
24108  int sckt;
24109  /*
24110  * Initialize the 'hints' structure for getaddrinfo(3).
24111  */
24112  memset( &hints, 0, sizeof( hints ) );
24113  hints.ai_family = PF_UNSPEC; /* IPv4 or IPv6 records */
24114  hints.ai_socktype = SOCK_STREAM; /* Connection oriented communication.*/
24115  hints.ai_protocol = IPPROTO_TCP; /* TCP transport layer protocol only. */
24116  /*
24117  ** Look up the host/service information.
24118  */
24119  if ( ( aiErr = getaddrinfo( host,
24120  service,
24121  &hints,
24122  &aiHead ) ) != 0 )
24123  {
24124  fprintf( stderr, "(line %d): ERROR - %s.\n", __LINE__,
24125  gai_strerror( aiErr ) );
24126  return INVALID_DESC;
24127  }
24128  /*
24129  ** Go through the list and try to open a connection. Continue until either
24130  ** a connection is established or the entire list is exhausted.
24131  */
24132  for ( ai = aiHead, sckt = INVALID_DESC;
24133  ( ai != NULL ) && ( sckt == INVALID_DESC );
24134  ai = ai->ai_next )
24135  {
24136  /*
24137  ** IPv6 kluge. Make sure the scope ID is set.
24138  */
24139  if ( ai->ai_family == PF_INET6 )
24140  {
24141  pSadrIn6 = (sockaddr_in6_t*) ai->ai_addr;
24142  if ( pSadrIn6->sin6_scope_id == 0 )
24143  {
24144  pSadrIn6->sin6_scope_id = scopeId;
24145  } /* End IF the scope ID wasn't set. */
24146  } /* End IPv6 kluge. */
24147  /*
24148  ** Create a socket.
24149  */
24150  sckt = socket( ai->ai_family, ai->ai_socktype, ai->ai_protocol );
24151  if(sckt == -1)
24152  {
24153  sckt = INVALID_DESC;
24154  continue; /* Try the next address record in the list. */
24155  }
24156  /*
24157  ** Set the target destination for the remote host on this socket. That
24158  ** is, this socket only communicates with the specified host.
24159  */
24160  if (connect( sckt, ai->ai_addr, ai->ai_addrlen ) )
24161  {
24162  (void) close( sckt ); /* Could use system call again here,
24163  but why? */
24164  sckt = INVALID_DESC;
24165  continue; /* Try the next address record in the list. */
24166  }
24167  } /* End FOR each address record returned by getaddrinfo(3). */
24168  /*
24169  ** Clean up & return.
24170  */
24171  freeaddrinfo( aiHead );
24172  return sckt;
24173 } /* End openSckt() */
if(file==NULL) goto out
struct sockaddr_in6 sockaddr_in6_t
Definition: iozone.c:24052
#define INVALID_DESC
Definition: iozone.c:24039
int close()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_client_line() [1/2]

int parse_client_line ( )
Here is the caller graph for this function:

◆ parse_client_line() [2/2]

int parse_client_line ( char *  buffer,
int  line_num 
)

Definition at line 22464 of file iozone.c.

22468 {
22469  int num;
22470  /* Format is clientname, workdir, execute_path */
22471  /* If column #1 contains a # symbol then skip this line */
22472 
22473  if(buffer[0]=='#')
22474  return(0);
22475  num=sscanf(buffer,"%s %s %s %s\n",
22476  child_idents[line_num].child_name,
22477  child_idents[line_num].workdir,
22478  child_idents[line_num].execute_path,
22479  child_idents[line_num].file_name);
22480  if((num > 0) && (num !=3) && (num !=4))
22481  {
22482  printf("Bad Client Identity at entry %d\n",line_num);
22483  printf("Client: -> %s Workdir: -> %s Execute_path: -> %s \n",
22484  child_idents[line_num].child_name,
22485  child_idents[line_num].workdir,
22486  child_idents[line_num].execute_path);
22487  exit(203);
22488  }
22489  if(num == 4)
22490  mfflag++;
22491 
22492  return(1);
22493 }
struct child_ident child_idents[MAXSTREAMS]
char mfflag
Definition: iozone.c:1334
char * buffer
Definition: iozone.c:1366
void exit()
Here is the call graph for this function:

◆ pick_client() [1/2]

int pick_client ( )
Here is the caller graph for this function:

◆ pick_client() [2/2]

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

Definition at line 21319 of file iozone.c.

21323 {
21324  int x;
21325  int c_command,child_index;
21326  struct client_command cc;
21327  struct master_command mc;
21328  struct master_neutral_command *mnc;
21329  char command[512];
21330  struct in_addr my_s_addr;
21331  char my_port_num[10];
21332 
21333 
21334  bzero(&cc,sizeof(struct client_command));
21335  for(x=0;x<512;x++)
21336  command[x]=0;
21337 
21338  current_client_number++; /* Need to start with 1 */
21340 
21342  /* Step 1. Now start client going on remote node. */
21343 
21345  sprintf(command,"%s ",remote_shell);
21346  strcat(command,child_idents[x-1].child_name);
21347  strcat(command," -n '");
21348  strcat(command,child_idents[x-1].execute_path);
21349  strcat(command," -+s -t 1 -r 4 -s 4 -+c ");
21350  strcat(command,controlling_host_name);
21352  {
21353  sprintf(my_port_num," -+i %d",master_listen_port);
21354  strcat(command,my_port_num);
21355  }
21356  strcat(command," '");
21357  junk=system(command);
21358 /*
21359  system("remsh rsnperf '/home/capps/niozone/iozone -+s -t 1 -r 4 -s 8 -+c rsnperf'");
21360 
21361 */
21362  if(mdebug)
21363  printf("%s",command);
21364  /* Format example: */
21365  /* */
21366  /* system("remsh rsnperf '/home/capps/niozone/iozone */
21367  /* -+s -t 1 -r 4 -s 8 -+c rsnperf'"); */
21368  /* */
21369 
21370  /* Step 2. Wait for join from new client. */
21371 
21373 
21374  if(mdebug>=1)
21375  printf("\nMaster listening for child to send join message.\n");
21377  mnc = (struct master_neutral_command *)&master_rcv_buf[0];
21378 
21379  /*
21380  * Convert from string format back to internal representation
21381  */
21382  sscanf(mnc->m_child_port,"%d",&mc.m_child_port);
21383  sscanf(mnc->m_child_async_port,"%d",&mc.m_child_async_port);
21384  sscanf(mnc->m_command,"%d",&mc.m_command);
21385  sscanf(mnc->m_version,"%d",&mc.m_version);
21386  if(mc.m_version != proto_version)
21387  {
21388  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);
21389  }
21390 
21391  c_port = mc.m_child_port;
21392  a_port = mc.m_child_async_port;
21393  c_command = mc.m_command;
21394  if(mdebug>=1)
21395  {
21396  printf("Master back from listen child Joined.\n");
21397  printf("Master: Command %d\n",c_command);
21398  }
21399  /* Step 3. Then start_master_send() for this client. */
21400 
21401  if(mdebug>=1)
21402  printf("Starting master send channel\n");
21404  &my_s_addr);
21405  if(mdebug>=1)
21406  printf("Starting master send async channel\n");
21408  my_s_addr);
21409 
21412  child_idents[x-1].child_number = x-1;
21415 
21416  /* */
21417  /* Step 4. Send message to client telling him his name, number, */
21418  /* rsize, fsize, and test to run. */
21419  strcpy(cc.c_host_name ,controlling_host_name);
21420  strcpy(cc.c_pit_hostname ,pit_hostname);
21421  strcpy(cc.c_pit_service ,pit_service);
21422  strcpy(cc.c_client_name ,child_idents[x-1].child_name);
21423  strcpy(cc.c_working_dir ,child_idents[x-1].workdir);
21424  strcpy(cc.c_file_name ,child_idents[x-1].file_name);
21425  strcpy(cc.c_write_traj_filename ,write_traj_filename);
21426  strcpy(cc.c_read_traj_filename ,read_traj_filename);
21427  cc.c_command = R_JOIN_ACK;
21428  cc.c_client_number = x-1;
21429  cc.c_testnum = testnum;
21430  cc.c_numrecs64 = numrecs64;
21431  cc.c_reclen = reclen;
21432  cc.c_oflag = oflag;
21433  cc.c_mfflag = mfflag;
21434  cc.c_unbuffered = unbuffered;
21435  cc.c_noretest = noretest;
21436  cc.c_notruncate = notruncate;
21437  cc.c_read_sync = read_sync;
21438  cc.c_jflag = jflag;
21439  cc.c_direct_flag = direct_flag;
21440  cc.c_cpuutilflag = cpuutilflag;
21441  cc.c_seq_mix = seq_mix;
21442  cc.c_async_flag = async_flag;
21443  cc.c_k_flag = k_flag;
21444  cc.c_h_flag = h_flag;
21445  cc.c_mflag = mflag;
21446  cc.c_pflag = pflag;
21447  cc.c_stride_flag = stride_flag;
21448  cc.c_fetchon = fetchon;
21449  cc.c_verify = verify;
21450  cc.c_sverify = sverify;
21451  cc.c_odsync = odsync;
21452  cc.c_diag_v = diag_v;
21453  cc.c_dedup = dedup;
21454  cc.c_dedup_interior = dedup_interior;
21455  cc.c_dedup_compress = dedup_compress;
21456  cc.c_dedup_mseed = dedup_mseed;
21457  cc.c_hist_summary = hist_summary;
21458  cc.c_op_rate = op_rate;
21459  cc.c_op_rate_flag = op_rate_flag;
21460  cc.c_file_lock = file_lock;
21461  cc.c_rec_lock = rlocking;
21462  cc.c_Kplus_readers = Kplus_readers;
21463  cc.c_multiplier = multiplier;
21464  cc.c_share_file = share_file;
21465  cc.c_pattern = pattern;
21466  cc.c_version = proto_version;
21467  cc.c_base_time = base_time;
21468  cc.c_num_child = (int)num_child;
21469  cc.c_pct_read = pct_read;
21470  cc.c_advise_op = advise_op;
21471  cc.c_advise_flag = advise_flag;
21472  cc.c_restf = restf;
21473  cc.c_mygen = mygen;
21474  cc.c_Q_flag = Q_flag;
21475  cc.c_L_flag = L_flag;
21476  cc.c_xflag = xflag;
21477  cc.c_w_traj_flag = w_traj_flag;
21478  cc.c_r_traj_flag = r_traj_flag;
21479  cc.c_include_flush = include_flush;
21480  cc.c_OPS_flag = OPS_flag;
21481  cc.c_purge = purge;
21482  cc.c_mmapflag = mmapflag;
21483  cc.c_mmapasflag = mmapasflag;
21484  cc.c_mmapnsflag = mmapnsflag;
21485  cc.c_mmapssflag = mmapssflag;
21486  cc.c_no_copy_flag = no_copy_flag;
21487  cc.c_no_unlink = no_unlink;
21488  cc.c_no_write = no_write;
21489  cc.c_include_close = include_close;
21490  cc.c_disrupt_flag = disrupt_flag;
21491  cc.c_compute_flag = compute_flag;
21492  cc.c_delay = delay;
21493  cc.c_stride = stride;
21494  cc.c_rest_val = rest_val;
21495  cc.c_delay_start = delay_start;
21496  cc.c_compute_time = compute_time;
21497  cc.c_depth = depth;
21498  cc.c_MS_flag = MS_flag;
21499  cc.c_mmap_mix = mmap_mix;
21500  cc.c_Kplus_flag = Kplus_flag;
21501 
21502 
21503  if(mdebug)
21504  printf("Master sending client who he is\n");
21505  master_send(master_send_sockets[x-1],cc.c_client_name, &cc,sizeof(struct client_command));
21506 
21508 
21509  /* */
21510  /* Step 5. Wait until you receive message that the chile is at */
21511  /* the barrier. */
21512  if(mdebug>=1)
21513  printf("Master listening for child to send at barrier message.\n");
21515  mnc = (struct master_neutral_command *)&master_rcv_buf[0];
21516  /*
21517  * Convert from string back to arch specific
21518  */
21519  sscanf(mnc->m_client_number,"%d",&mc.m_client_number);
21520 #ifdef NO_PRINT_LLD
21521  sscanf(mnc->m_child_flag,"%ld",&mc.m_child_flag);
21522 #else
21523  sscanf(mnc->m_child_flag,"%lld",&mc.m_child_flag);
21524 #endif
21525 
21526  child_index = mc.m_client_number;
21527  child_stat = (struct child_stats *)&shmaddr[child_index];
21528  child_stat->flag = (long long)(mc.m_child_flag);
21529  if(mdebug>=1)
21530  printf("Master sees child %d at barrier message.\n",child_index);
21531 
21532  return(x); /* Tell code above that it is the parent returning */
21533 }
long long depth
Definition: iozone.c:1536
#define C_STATE_ZERO
Definition: iozone.c:1449
char pit_hostname[40]
Definition: iozone.c:1400
char m_command[20]
Definition: iozone.c:716
int w_traj_flag
Definition: iozone.c:1523
int current_client_number
Definition: iozone.c:1528
int mdebug
Definition: iozone.c:1479
char compute_flag
Definition: iozone.c:1520
char diag_v
Definition: iozone.c:1304
char m_client_number[20]
Definition: iozone.c:711
char controlling_host_name[100]
Definition: iozone.c:1493
char verify
Definition: iozone.c:1513
char Kplus_flag
Definition: iozone.c:1509
struct child_stats * child_stat
long long stride
Definition: iozone.c:1532
int no_unlink
Definition: iozone.c:1521
int master_listen_port
Definition: iozone.c:1472
void bzero()
int no_write
Definition: iozone.c:1522
void find_remote_shell()
void master_send()
int state
Definition: iozone.c:1499
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
char mmapflag
Definition: iozone.c:1512
char k_flag
Definition: iozone.c:1509
char dedup_compress
Definition: iozone.c:1304
int restf
Definition: iozone.c:1514
int master_send_async_sockets[MAXSTREAMS]
Definition: iozone.c:1471
#define R_JOIN_ACK
Definition: iozone.c:741
int advise_op
Definition: iozone.c:1526
int master_async_socket_num
Definition: iozone.c:1504
char remote_shell[256]
Definition: iozone.c:1397
char file_name[200]
Definition: iozone.c:1498
char m_version[20]
Definition: iozone.c:718
char stride_flag
Definition: iozone.c:1512
char master_rcv_buf[4096]
Definition: iozone.c:1460
void master_listen()
int dedup_mseed
Definition: iozone.c:1299
char disrupt_flag
Definition: iozone.c:1520
char child_name[100]
Definition: iozone.c:1495
int advise_flag
Definition: iozone.c:1526
int a_port
Definition: iozone.c:1454
long long reclen
Definition: iozone.c:1535
char workdir[200]
Definition: iozone.c:1496
char read_sync
Definition: iozone.c:1295
int op_rate
Definition: iozone.c:1301
float compute_time
Definition: iozone.c:1538
#define C_STATE_WAIT_BARRIER
Definition: iozone.c:1451
long base_time
Definition: iozone.c:1323
char noretest
Definition: iozone.c:1510
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
long long delay_start
Definition: iozone.c:1536
int multiplier
Definition: iozone.c:1539
char unbuffered
Definition: iozone.c:1509
char jflag
Definition: iozone.c:1509
int child_port
Definition: iozone.c:1501
long long delay
Definition: iozone.c:1533
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char mmapasflag
Definition: iozone.c:1512
struct child_ident child_idents[MAXSTREAMS]
int pct_read
Definition: iozone.c:1336
int junk
Definition: iozone.c:1402
int master_socket_num
Definition: iozone.c:1503
char odsync
Definition: iozone.c:1516
#define C_STATE_WAIT_WHO
Definition: iozone.c:1450
int op_rate_flag
Definition: iozone.c:1302
char dedup
Definition: iozone.c:1304
long long num_child
Definition: iozone.c:1335
int child_async_port
Definition: iozone.c:1502
#define HOST_LIST_PORT
Definition: iozone.c:1407
char L_flag
Definition: iozone.c:1518
char mfflag
Definition: iozone.c:1334
long long x
Definition: iozone.c:1335
char m_child_async_port[20]
Definition: iozone.c:715
off64_t numrecs64
Definition: iozone.c:1534
char notruncate
Definition: iozone.c:1511
long long flag
Definition: iozone.c:458
char mmapssflag
Definition: iozone.c:1512
int share_file
Definition: iozone.c:1309
int child_number
Definition: iozone.c:1500
char write_traj_filename[MAXNAMESIZE]
Definition: iozone.c:1507
char dedup_interior
Definition: iozone.c:1304
long long fetchon
Definition: iozone.c:1533
char pflag
Definition: iozone.c:1509
unsigned int pattern
Definition: iozone.c:1531
int start_master_send_async(char *child_host_name, int child_port, struct in_addr my_s_addr)
Definition: iozone.c:21184
char xflag
Definition: iozone.c:1520
char mflag
Definition: iozone.c:1509
char oflag
Definition: iozone.c:1509
int proto_version
Definition: iozone.c:1486
int master_listen_socket
Definition: iozone.c:1473
int start_master_send()
int r_traj_flag
Definition: iozone.c:1523
char m_child_port[20]
Definition: iozone.c:714
int c_port
Definition: iozone.c:1454
char h_flag
Definition: iozone.c:1509
char m_child_flag[80]
Definition: iozone.c:724
char seq_mix
Definition: iozone.c:1322
char read_traj_filename[MAXNAMESIZE]
Definition: iozone.c:1508
char Q_flag
Definition: iozone.c:1517
char pit_service[8]
Definition: iozone.c:1401
char no_copy_flag
Definition: iozone.c:1519
int system()
char include_close
Definition: iozone.c:1519
char OPS_flag
Definition: iozone.c:1517
int master_send_sockets[MAXSTREAMS]
Definition: iozone.c:1470
int mygen
Definition: iozone.c:1524
int rlocking
Definition: iozone.c:1308
char mmapnsflag
Definition: iozone.c:1512
long long rest_val
Definition: iozone.c:1540
int Kplus_readers
Definition: iozone.c:1506
char mmap_mix
Definition: iozone.c:1512
int direct_flag
Definition: iozone.c:1527
int hist_summary
Definition: iozone.c:1300
Here is the call graph for this function:

◆ pit()

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

Definition at line 24180 of file iozone.c.

24181 {
24182  char bfr[ MAXBFRSIZE+1 ];
24183  int inBytes;
24184  long long value;
24185  /*
24186  ** Send a datagram to the server to wake it up. The content isn't
24187  ** important, but something must be sent to let it know we want the TOD.
24188  */
24189  junk=write( sckt, "Are you there?", 14 );
24190  /*
24191  ** Read the PIT from the remote host.
24192  */
24193  inBytes = read( sckt, bfr, MAXBFRSIZE );
24194  bfr[ inBytes ] = '\0'; /* Null-terminate the received string. */
24195  /*
24196  * Convert result to timeval structure format
24197  */
24198  sscanf(bfr,"%llu\n",&value);
24199  tp->tv_sec = (long)(value / 1000000);
24200  tp->tv_usec = (long)(value % 1000000);
24201 }
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
#define MAXBFRSIZE
Definition: iozone.c:24040
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
int junk
Definition: iozone.c:1402
__time_t tv_sec
__suseconds_t tv_usec
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pit_gettimeofday() [1/2]

int pit_gettimeofday ( )
Here is the caller graph for this function:

◆ pit_gettimeofday() [2/2]

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

Definition at line 24065 of file iozone.c.

24067 {
24068  int sckt; /* socket descriptor */
24069  unsigned scopeId = 0;
24070 
24071  /* See if the interdimensional rift is active */
24072 
24073  if(pit_hostname[0] == 0)
24074  {
24075  return gettimeofday(tp,foo);
24076  }
24077 
24078  if ( ( sckt = openSckt( pit_hostname,
24079  pit_service,
24080  scopeId ) ) == INVALID_DESC )
24081  {
24082  fprintf( stderr,
24083  "Sorry... a connectionless socket could "
24084  "not be set up.\n");
24085  return -1;
24086  }
24087  /*
24088  ** Get the remote PIT.
24089  */
24090  pit( sckt ,tp );
24091  close(sckt);
24092  return 0;
24093 }
char pit_hostname[40]
Definition: iozone.c:1400
#define INVALID_DESC
Definition: iozone.c:24039
static int openSckt(const char *, const char *, unsigned int)
Definition: iozone.c:24099
int gettimeofday(void *ptr1, void *ptr2)
int close()
char pit_service[8]
Definition: iozone.c:1401
static void pit(int, struct timeval *)
Definition: iozone.c:24180
Here is the call graph for this function:

◆ Poll() [1/2]

void Poll ( )
Here is the caller graph for this function:

◆ Poll() [2/2]

void Poll ( long long  time1)

Definition at line 12163 of file iozone.c.

12166 {
12167  struct timeval howlong;
12168  howlong.tv_sec=(int)(time1/100000);
12169  howlong.tv_usec=(int)(time1%100000); /* Get into u.s. */
12170  select(0, 0, 0, 0, &howlong);
12171 }
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
Definition: appio.c:199
__time_t tv_sec
Here is the call graph for this function:

◆ prepage() [1/2]

void prepage ( )
Here is the caller graph for this function:

◆ prepage() [2/2]

void prepage ( char *  buffer,
long long  reclen 
)

Definition at line 7236 of file iozone.c.

7240 {
7241  char *where;
7242  long long i;
7243  where=(char *)buffer;
7244  for(i=0;i<(reclen/cache_line_size);i++)
7245  {
7246  *(where)=PATTERN;
7247  where+=cache_line_size;
7248  }
7249 }
unsigned long cache_line_size
Definition: iozone.c:1376
#define PATTERN
Definition: iozone.c:822
long long reclen
Definition: iozone.c:1535
char * buffer
Definition: iozone.c:1366
int i
Definition: fileop.c:140

◆ print_header()

void print_header ( )

Definition at line 11351 of file iozone.c.

11353 {
11354  if(Eflag)
11355  {
11356  if(!silent) printf(CONTROL_STRING2,
11357  " ",
11358  " ",
11359  " ",
11360  " ",
11361  " ",
11362  " ",
11363  "random", /*kcollins:2-5-96*/
11364  "random", /*kcollins:2-5-96*/
11365  "bkwd",
11366  "record",
11367  "stride",
11368  " ",
11369  " ",
11370  " ",
11371  " "
11372 #ifdef HAVE_PREAD
11373  ," ",
11374  " ",
11375  " ",
11376  " "
11377 #ifdef HAVE_PREADV
11378  ," ",
11379  " ",
11380  " ",
11381  " "
11382 #endif
11383 #endif
11384  );
11385  if(!silent) printf(CONTROL_STRING2,
11386  "KB",
11387  "reclen",
11388  "write",
11389  "rewrite",
11390  "read",
11391  "reread",
11392  "read", /*kcollins:2-5-96*/
11393  "write", /*kcollins:2-5-96*/
11394  "read",
11395  "rewrite",
11396  "read",
11397  "fwrite",
11398  "frewrite",
11399  "fread",
11400  "freread"
11401 #ifdef HAVE_PREAD
11402  ,"pwrite",
11403  "repwrite",
11404  "pread",
11405  "repread"
11406 #ifdef HAVE_PREADV
11407  ,"pwritev",
11408  "repwritev",
11409  "preadv",
11410  "repreadv"
11411 #endif
11412 #endif
11413  );
11414  }else
11415  if(RWONLYflag){ /*kcollins 8-21-96*/
11416  if(!silent) printf(CONTROL_STRING4, /*kcollins 8-21-96*/
11417  " ", /*kcollins 8-21-96*/
11418  " ", /*kcollins 8-21-96*/
11419  " ", /*kcollins 8-21-96*/
11420  " ", /*kcollins 8-21-96*/
11421  " ", /*kcollins 8-21-96*/
11422  " " /*kcollins 8-21-96*/
11423  ); /*kcollins 8-21-96*/
11424  if(!silent) printf(CONTROL_STRING4, /*kcollins 8-21-96*/
11425  "KB", /*kcollins 8-21-96*/
11426  "reclen", /*kcollins 8-21-96*/
11427  "write", /*kcollins 8-21-96*/
11428  "rewrite", /*kcollins 8-21-96*/
11429  "read", /*kcollins 8-21-96*/
11430  "reread" /*kcollins 8-21-96*/
11431  ); /*kcollins 8-21-96*/
11432  }else{
11433  if(!(mmapflag || async_flag))
11434  {
11435  if(!silent) printf(CONTROL_STRING3,
11436  " ",
11437  " ",
11438  " ",
11439  " ",
11440  " ",
11441  " ",
11442  "random", /*kcollins:2-5-96*/
11443  "random", /*kcollins:2-5-96*/
11444  "bkwd",
11445  "record",
11446  "stride",
11447  "",
11448  "",
11449  "",
11450  ""
11451  );
11452  if(!silent) printf(CONTROL_STRING3,
11453  "KB",
11454  "reclen",
11455  "write",
11456  "rewrite",
11457  "read",
11458  "reread",
11459  "read", /*kcollins:2-5-96*/
11460  "write", /*kcollins:2-5-96*/
11461  "read",
11462  "rewrite",
11463  "read",
11464  "fwrite",
11465  "frewrite",
11466  "fread",
11467  "freread"
11468  );
11469  }else
11470  {
11471  if(!silent) printf(CONTROL_STRING3,
11472  " ",
11473  " ",
11474  " ",
11475  " ",
11476  " ",
11477  " ",
11478  "random", /*kcollins:2-5-96*/
11479  "random", /*kcollins:2-5-96*/
11480  "bkwd",
11481  "record",
11482  "stride",
11483  "",
11484  "",
11485  "",
11486  ""
11487  );
11488  if(!silent) printf(CONTROL_STRING3,
11489  "KB",
11490  "reclen",
11491  "write",
11492  "rewrite",
11493  "read",
11494  "reread",
11495  "read", /*kcollins:2-5-96*/
11496  "write", /*kcollins:2-5-96*/
11497  "read",
11498  "rewrite",
11499  "read",
11500  "",
11501  "",
11502  "",
11503  ""
11504  );
11505  }
11506  }
11507 }
char mmapflag
Definition: iozone.c:1512
#define CONTROL_STRING4
Definition: iozone.c:879
char Eflag
Definition: iozone.c:1303
char async_flag
Definition: iozone.c:1512
#define CONTROL_STRING3
Definition: iozone.c:878
#define CONTROL_STRING2
Definition: iozone.c:877
char silent
Definition: iozone.c:1295
char RWONLYflag
Definition: iozone.c:1333
Here is the caller graph for this function:

◆ purge_buffer_cache()

purge_buffer_cache ( )

Definition at line 12274 of file iozone.c.

12276 {
12277  char command[1024];
12278  int ret,i;
12279  strcpy(command,"umount ");
12280  strcat(command, mountname);
12281  /*
12282  umount might fail if the device is still busy, so
12283  retry unmounting several times with increasing delays
12284  */
12285  for (i = 1; i < 200; ++i) {
12286  ret = system(command);
12287  if (ret == 0)
12288  break;
12289  sleep(i); /* seconds */
12290  }
12291  strcpy(command,"mount ");
12292  strcat(command, mountname);
12293  /*
12294  mount might fail if the device is still busy, so
12295  retry mounting several times with increasing delays
12296  */
12297  for (i = 1; i < 10; ++i) {
12298  ret = system(command);
12299  if (ret == 0)
12300  break;
12301  sleep(i); /* seconds */
12302  }
12303 }
char mountname[MAXNAMESIZE]
Definition: iozone.c:1361
long long ret
Definition: iozone.c:1346
int system()
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ purgeit() [1/2]

void purgeit ( )
Here is the caller graph for this function:

◆ purgeit() [2/2]

void purgeit ( char *  buffer,
long long  reclen 
)

Definition at line 7203 of file iozone.c.

7207 {
7208  char *where;
7209  long rsize;
7210  long tsize;
7211  VOLATILE long long x[200];
7212  long i,cache_lines_per_rec;
7213  long cache_lines_per_cache;
7214  tsize = 200;
7215  cache_lines_per_rec = (long)(reclen/cache_line_size);
7216  cache_lines_per_cache = (long)(cache_size/cache_line_size);
7217  rsize = (long)l_min((long long)cache_lines_per_rec,(long long)cache_lines_per_cache);
7218 #ifdef _64BIT_ARCH_
7219  where=(char *)pbuffer + ((unsigned long long)buffer & (cache_size-1));
7220 #else
7221  where=(char *)pbuffer + ((long)buffer & ((long)cache_size-1));
7222 #endif
7223  for(i=0;i<(rsize);i++)
7224  {
7225  x[i%tsize]=*(where);
7226  where+=cache_line_size;
7227 
7228  }
7229 }
unsigned long cache_line_size
Definition: iozone.c:1376
VOLATILE char * pbuffer
Definition: iozone.c:1368
long long reclen
Definition: iozone.c:1535
long long x
Definition: iozone.c:1335
char * buffer
Definition: iozone.c:1366
long long l_min()
#define VOLATILE
Definition: iozone.c:395
unsigned long cache_size
Definition: iozone.c:1375
int i
Definition: fileop.c:140
Here is the call graph for this function:

◆ r_traj_size()

void r_traj_size ( )

Definition at line 19732 of file iozone.c.

19734 {
19735  FILE *fd;
19736  int ret;
19737  long long traj_offset = 0;
19738  long long traj_size = 0;
19739  long long max_offset = 0;
19740  int tokens;
19741  int dummy;
19742  int lines;
19743  char buf[200];
19744  char sbuf[200];
19745  char *ret1,*where;
19746 
19747  lines=0;
19748  fd=fopen(read_traj_filename,"r");
19749  if(fd == (FILE *)0)
19750  {
19751  printf("Unable to open read telemetry file \"%s\"\n",
19753  exit(174);
19754  }
19755  while(1)
19756  {
19757  tokens=0;
19758  ret1=fgets(buf,200,fd);
19759  if(ret1==(char *)0)
19760  break;
19761  where=(char *)&buf[0];
19762  strcpy(sbuf,buf);
19763  lines++;
19764  if((*where=='#') || (*where=='\n'))
19765  continue;
19766  tokens++;
19767  strtok(where," ");
19768  while( (char *)(strtok( (char *)0," ")) != (char *)0)
19769  {
19770  tokens++;
19771  }
19772  if(tokens==1)
19773  {
19774  printf("\n\tInvalid read telemetry file entry. Line %d",
19775  lines);
19776  signal_handler();
19777  }
19778 #ifdef DEBUG
19779  printf("Tokens = %d\n",tokens);
19780 #endif
19781  if(tokens==3)
19782  {
19783 #ifdef NO_PRINT_LLD
19784  ret=sscanf(sbuf,"%ld %ld %d\n",&traj_offset,&traj_size,&dummy);
19785 #else
19786  ret=sscanf(sbuf,"%lld %lld %d\n",&traj_offset,&traj_size,&dummy);
19787 #endif
19788  }
19789  if(tokens==2)
19790  {
19791 #ifdef NO_PRINT_LLD
19792  ret=sscanf(sbuf,"%ld %ld\n",&traj_offset,&traj_size);
19793 #else
19794  ret=sscanf(sbuf,"%lld %lld\n",&traj_offset,&traj_size);
19795 #endif
19796  }
19797  if((tokens != 2) && (tokens !=3))
19798  {
19799  printf("\n\tInvalid read telemetry file. Line %d\n",lines);
19800  exit(178);
19801  }
19802  if(traj_offset + traj_size > max_offset)
19803  max_offset=traj_offset + traj_size;
19804 
19805  r_traj_ops++;
19806  }
19807  r_traj_fsize=max_offset;
19808 #ifdef DEBUG
19809  printf("File size of read %lld Item count %lld\n",r_traj_fsize,r_traj_ops);
19810 #endif
19811  fclose(fd);
19812 }
long long r_traj_fsize
Definition: iozone.c:1325
int fd
Definition: iozone.c:1291
void signal_handler()
Definition: iozone.c:3336
void dummy(void *array)
Definition: do_loops.c:306
long long ret
Definition: iozone.c:1346
char read_traj_filename[MAXNAMESIZE]
Definition: iozone.c:1508
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
void exit()
long long r_traj_ops
Definition: iozone.c:1325
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rand()

int rand ( )
Here is the caller graph for this function:

◆ random_perf_test() [1/2]

void random_perf_test ( )

◆ random_perf_test() [2/2]

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

Definition at line 8791 of file iozone.c.

8796 {
8797  double randreadtime[2];
8798  double starttime2;
8799  double walltime[2], cputime[2];
8800  double compute_val = (double)0;
8801 #if defined (bsd4_2) || defined(Windows)
8802  long long rand1,rand2,rand3;
8803 #endif
8804  unsigned long long big_rand;
8805  long long j;
8807  long long Index=0;
8808  int flags;
8809  unsigned long long randreadrate[2];
8811  off64_t lock_offset=0;
8812  volatile char *buffer1;
8813  char *wmaddr,*nbuff;
8814  char *maddr,*free_addr;
8815  int fd,wval;
8816  long long *recnum= 0;
8817 #if defined(VXFS) || defined(solaris)
8818  int test_foo=0;
8819 #endif
8820 #ifdef ASYNC_IO
8821  struct cache *gc=0;
8822 #else
8823  long long *gc=0;
8824 #endif
8825 #ifdef MERSENNE
8826  unsigned long long init[4]={0x12345ULL, 0x23456ULL, 0x34567ULL, 0x45678ULL};
8827  unsigned long long length=4;
8828 #endif
8829 
8830  maddr=free_addr=0;
8831  numrecs64 = (kilo64*1024)/reclen;
8832 #ifdef MERSENNE
8833  init_by_array64(init, length);
8834 #else
8835 #ifdef bsd4_2
8836  srand(0);
8837 #else
8838 #ifdef Windows
8839  srand(0);
8840 #else
8841  srand48(0);
8842 #endif
8843 #endif
8844 #endif
8845  recnum = (long long *)malloc(sizeof(*recnum)*numrecs64);
8846  if (recnum){
8847  /* pre-compute random sequence based on
8848  Fischer-Yates (Knuth) card shuffle */
8849  for(i = 0; i < numrecs64; i++){
8850  recnum[i] = i;
8851  }
8852  for(i = 0; i < numrecs64; i++) {
8853  long long tmp;
8854 #ifdef MERSENNE
8855  big_rand=genrand64_int64();
8856 #else
8857 #ifdef bsd4_2
8858  rand1=(long long)rand();
8859  rand2=(long long)rand();
8860  rand3=(long long)rand();
8861  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
8862 #else
8863 #ifdef Windows
8864  rand1=(long long)rand();
8865  rand2=(long long)rand();
8866  rand3=(long long)rand();
8867  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
8868 #else
8869  big_rand = lrand48();
8870 #endif
8871 #endif
8872 #endif
8873  big_rand = big_rand%numrecs64;
8874  tmp = recnum[i];
8875  recnum[i] = recnum[big_rand];
8876  recnum[big_rand] = tmp;
8877  }
8878  }
8879  else
8880  {
8881  fprintf(stderr,"Random uniqueness fallback.\n");
8882  }
8883  flags = O_RDWR;
8884 #if ! defined(DONT_HAVE_O_DIRECT)
8885 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
8886  if(direct_flag)
8887  flags |=O_DIRECT;
8888 #endif
8889 #if defined(TRU64)
8890  if(direct_flag)
8891  flags |=O_DIRECTIO;
8892 #endif
8893 #endif
8894  fd=0;
8895  if(oflag)
8896  flags |= O_SYNC;
8897 #if defined(O_DSYNC)
8898  if(odsync)
8899  flags |= O_DSYNC;
8900 #endif
8901 #if defined(_HPUX_SOURCE) || defined(linux)
8902  if(read_sync)
8903  flags |=O_RSYNC|O_SYNC;
8904 #endif
8906  for( j=0; j<2; j++ )
8907  {
8908  if(j==0)
8909  flags |=O_CREAT;
8910  if (no_write && (j == 1))
8911  continue;
8912  if(cpuutilflag)
8913  {
8914  walltime[j] = time_so_far();
8915  cputime[j] = cputime_so_far();
8916  }
8917  if(Uflag) /* Unmount and re-mount the mountpoint */
8918  {
8920  }
8921  if((fd = I_OPEN(filename, ((int)flags),0640))<0){
8922  printf("\nCan not open temporary file for read/write\n");
8923  perror("open");
8924  exit(66);
8925  }
8926 #ifdef ASYNC_IO
8927  if(async_flag)
8928  async_init(&gc,fd,direct_flag);
8929 #endif
8930 
8931 #ifdef VXFS
8932  if(direct_flag)
8933  {
8934  ioctl(fd,VX_SETCACHE,VX_DIRECT);
8935  ioctl(fd,VX_GETCACHE,&test_foo);
8936  if(test_foo == 0)
8937  {
8938  if(!client_iozone)
8939  printf("\nVxFS advanced setcache feature not available.\n");
8940  exit(3);
8941  }
8942  }
8943 #endif
8944 #if defined(solaris)
8945  if(direct_flag)
8946  {
8947  test_foo = directio(fd, DIRECTIO_ON);
8948  if(test_foo != 0)
8949  {
8950  if(!client_iozone)
8951  printf("\ndirectio not available.\n");
8952  exit(3);
8953  }
8954  }
8955 #endif
8956  if(mmapflag)
8957  {
8958  maddr=(char *)initfile(fd,filebytes64,0,PROT_READ|PROT_WRITE);
8959  }
8960  nbuff=mainbuffer;
8961  if(fetchon)
8962  fetchit(nbuff,reclen);
8963 #ifdef MERSENNE
8964  init_by_array64(init, length);
8965 #else
8966 #ifdef bsd4_2
8967  srand(0);
8968 #else
8969 #ifdef Windows
8970  srand(0);
8971 #else
8972  srand48(0);
8973 #endif
8974 #endif
8975 #endif
8976  compute_val=(double)0;
8977  starttime2 = time_so_far();
8978  if ( j==0 ){
8979  for(i=0; i<numrecs64; i++) {
8980  if(compute_flag)
8981  compute_val+=do_compute(compute_time);
8982  if(multi_buffer)
8983  {
8984  Index +=reclen;
8985  if(Index > (MAXBUFFERSIZE-reclen))
8986  Index=0;
8987  nbuff = mbuffer + Index;
8988  }
8989  if(purge)
8990  purgeit(nbuff,reclen);
8991  if (recnum) {
8992  offset64 = reclen * (long long)recnum[i];
8993  }
8994  else
8995  {
8996 
8997 #ifdef MERSENNE
8998  big_rand =genrand64_int64();
8999  offset64 = reclen * (big_rand%numrecs64);
9000 #else
9001 #ifdef bsd4_2
9002  rand1=(long long)rand();
9003  rand2=(long long)rand();
9004  rand3=(long long)rand();
9005  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
9006  offset64 = reclen * (big_rand%numrecs64);
9007 #else
9008 #ifdef Windows
9009  rand1=(long long)rand();
9010  rand2=(long long)rand();
9011  rand3=(long long)rand();
9012  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
9013  offset64 = reclen * (big_rand%numrecs64);
9014 #else
9015  offset64 = reclen * (lrand48()%numrecs64);
9016 #endif
9017 #endif
9018 #endif
9019  }
9020 
9021  if( !(h_flag || k_flag || mmapflag))
9022  {
9023  if(I_LSEEK( fd, offset64, SEEK_SET )<0)
9024  {
9025  perror("lseek");
9026  exit(68);
9027  };
9028  }
9029  if(rlocking)
9030  {
9031  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
9032  mylockr((int) fd, (int) 1, (int)1,
9033  lock_offset, reclen);
9034  }
9035  if(mmapflag)
9036  {
9037  wmaddr=&maddr[offset64];
9038  fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
9039  }
9040  else
9041  {
9042  if(async_flag)
9043  {
9044  if(no_copy_flag)
9045  async_read_no_copy(gc, (long long)fd, &buffer1, offset64,reclen,
9046  0LL,(numrecs64*reclen),depth);
9047  else
9048  async_read(gc, (long long)fd, nbuff, (offset64),reclen,
9049  0LL,(numrecs64*reclen),0LL);
9050  }
9051  else
9052  {
9053  if(read(fd, (void *)nbuff, (size_t)reclen) != reclen)
9054  {
9055 #ifdef NO_PRINT_LLD
9056  printf("\nError reading block at %ld\n",
9057  offset64);
9058 #else
9059  printf("\nError reading block at %lld\n",
9060  offset64);
9061 #endif
9062  perror("read");
9063  exit(70);
9064  }
9065  }
9066  }
9067  if(verify){
9068  if(async_flag && no_copy_flag)
9069  {
9071  exit(71);
9072  }
9073  }
9074  else
9075  {
9077  exit(72);
9078  }
9079  }
9080  }
9081  if(async_flag && no_copy_flag)
9082  async_release(gc);
9083  if(rlocking)
9084  {
9085  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
9086  mylockr((int) fd, (int) 1, (int)1,
9087  lock_offset, reclen);
9088  }
9089  }
9090  }
9091  else
9092  {
9093  if(verify || dedup || dedup_interior)
9094  fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
9095  for(i=0; i<numrecs64; i++)
9096  {
9097  if(compute_flag)
9098  compute_val+=do_compute(compute_time);
9099  if(multi_buffer)
9100  {
9101  Index +=reclen;
9102  if(Index > (MAXBUFFERSIZE-reclen))
9103  Index=0;
9104  nbuff = mbuffer + Index;
9105  }
9106  if (recnum) {
9107  offset64 = reclen * (long long)recnum[i];
9108  }
9109  else
9110  {
9111 #ifdef bsd4_2
9112  rand1=(long long)rand();
9113  rand2=(long long)rand();
9114  rand3=(long long)rand();
9115  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
9116  offset64 = reclen * (big_rand%numrecs64);
9117 #else
9118 #ifdef Windows
9119  rand1=(long long)rand();
9120  rand2=(long long)rand();
9121  rand3=(long long)rand();
9122  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
9123  offset64 = reclen * (big_rand%numrecs64);
9124 #else
9125  offset64 = reclen * (lrand48()%numrecs64);
9126 #endif
9127 #endif
9128  }
9129  if(async_flag && no_copy_flag)
9130  {
9131  free_addr=nbuff=(char *)malloc((size_t)reclen+page_size);
9132  nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
9133  if(verify || dedup || dedup_interior)
9134  fill_buffer(nbuff,reclen,(long long)pattern,sverify,offset64/reclen);
9135  }
9136  if(purge)
9137  purgeit(nbuff,reclen);
9138 
9139  if((verify & diag_v) || dedup || dedup_interior)
9140  fill_buffer(nbuff,reclen,(long long)pattern,sverify,offset64/reclen);
9141 
9142  if (!(h_flag || k_flag || mmapflag))
9143  {
9144  I_LSEEK( fd, offset64, SEEK_SET );
9145  }
9146  if(rlocking)
9147  {
9148  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
9149  mylockr((int) fd, (int) 1, (int)0,
9150  lock_offset, reclen);
9151  }
9152  if(mmapflag)
9153  {
9154  wmaddr=&maddr[offset64];
9155  fill_area((long long*)nbuff,(long long*)wmaddr,(long long)reclen);
9156  if(!mmapnsflag)
9157  {
9158  if(mmapasflag)
9159  msync(wmaddr,(size_t)reclen,MS_ASYNC);
9160  if(mmapssflag)
9161  msync(wmaddr,(size_t)reclen,MS_SYNC);
9162  }
9163  }
9164  else
9165  {
9166  if(async_flag)
9167  {
9168  if(no_copy_flag)
9169  async_write_no_copy(gc, (long long)fd, nbuff, reclen, offset64,
9170  depth,free_addr);
9171  else
9172  async_write(gc, (long long)fd, nbuff, reclen, offset64, depth);
9173  }
9174  else
9175  {
9176  wval=write(fd, nbuff,(size_t)reclen);
9177  if(wval != reclen)
9178  {
9179 #ifdef NO_PRINT_LLD
9180  printf("\nError writing block at %ld\n",
9181  offset64);
9182 #else
9183  printf("\nError writing block at %lld\n",
9184  offset64);
9185 #endif
9186  if(wval==-1)
9187  perror("write");
9188  signal_handler();
9189  }
9190  }
9191  }
9192  if(rlocking)
9193  {
9194  mylockr((int) fd, (int) 0, (int)0,
9195  lock_offset, reclen);
9196  }
9197  }
9198  } /* end of modifications *kcollins:2-5-96 */
9199 #ifdef ASYNC_IO
9200  if(async_flag)
9201  {
9202  end_async(gc);
9203  gc=0;
9204  }
9205 #endif
9206  if(include_flush)
9207  {
9208  if(mmapflag)
9209  msync(maddr,(size_t)filebytes64,MS_SYNC);/* Clean up before read starts running */
9210  else
9211  {
9212  wval=fsync(fd);
9213  if(wval==-1){
9214  perror("fsync");
9215  signal_handler();
9216  }
9217  }
9218  }
9219  if(include_close)
9220  {
9221  if(mmapflag)
9222  {
9223  mmap_end(maddr,(unsigned long long)filebytes64);
9224  }
9225  wval=close(fd);
9226  if(wval==-1){
9227  perror("close");
9228  signal_handler();
9229  }
9230  }
9231  randreadtime[j] = ((time_so_far() - starttime2)-time_res)-
9232  compute_val;
9233  if(randreadtime[j] < (double).000001)
9234  {
9235  randreadtime[j]=time_res;
9236  if(rec_prob < reclen)
9237  rec_prob = reclen;
9238  res_prob=1;
9239  }
9240  if(!include_close)
9241  {
9242  if(mmapflag)
9243  {
9244  msync(maddr,(size_t)filebytes64,MS_SYNC);/* Clean up before read starts running */
9245  }
9246  else
9247  {
9248  wval=fsync(fd);
9249  if(wval==-1){
9250  perror("fsync");
9251  signal_handler();
9252  }
9253  }
9254  if(mmapflag)
9255  mmap_end(maddr,(unsigned long long)filebytes64);
9256  wval=close(fd);
9257  if(wval==-1){
9258  perror("close");
9259  signal_handler();
9260  }
9261  }
9262  if(cpuutilflag)
9263  {
9264  cputime[j] = cputime_so_far() - cputime[j];
9265  if (cputime[j] < cputime_res)
9266  cputime[j] = 0.0;
9267  walltime[j] = time_so_far() - walltime[j];
9268  if (walltime[j] < cputime[j])
9269  walltime[j] = cputime[j];
9270  }
9271  if(restf)
9272  sleep((int)rest_val);
9273  }
9274  if(OPS_flag || MS_flag){
9276  }
9277  for(j=0;j<2;j++)
9278  {
9279  if(no_write && (j==1))
9280  {
9281  randreadrate[1] = 0.0;
9282  continue;
9283  }
9284  if(MS_flag)
9285  {
9286  randreadrate[j]=1000000.0*(randreadtime[j] / (double)filebytes64);
9287  continue;
9288  }
9289  else
9290  {
9291  randreadrate[j] =
9292  (unsigned long long) ((double) filebytes64 / randreadtime[j]);
9293  }
9294  if(!(OPS_flag || MS_flag))
9295  randreadrate[j] >>= 10;
9296  }
9297  /* Must save walltime & cputime before calling store_value() for each/any cell.*/
9298  if(cpuutilflag)
9299  store_times(walltime[0], cputime[0]);
9300  store_value((off64_t)randreadrate[0]);
9301  if(cpuutilflag)
9302  store_times(walltime[1], cputime[1]);
9303  store_value((off64_t)randreadrate[1]);
9304 #ifdef NO_PRINT_LLD
9305  if(!silent) printf("%8ld",randreadrate[0]);
9306  if(!silent) printf("%8ld",randreadrate[1]);
9307  if(!silent) fflush(stdout);
9308 #else
9309  if(!silent) printf("%8lld",randreadrate[0]);
9310  if(!silent) printf("%8lld",randreadrate[1]);
9311  if(!silent) fflush(stdout);
9312 #endif
9313  if(recnum)
9314  free(recnum);
9315 }
void end_async()
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
store_times(double walltime, double cputime)
Definition: iozone.c:11551
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
char diag_v
Definition: iozone.c:1304
store_value(off64_t value)
Definition: iozone.c:11518
void mmap_end()
char verify
Definition: iozone.c:1513
size_t async_write()
Definition: iozone.c:19038
int no_write
Definition: iozone.c:1522
void fill_buffer()
char mmapflag
Definition: iozone.c:1512
char k_flag
Definition: iozone.c:1509
int fd
Definition: iozone.c:1291
long lrand48()
int restf
Definition: iozone.c:1514
void signal_handler()
Definition: iozone.c:3336
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
long long multi_buffer
Definition: iozone.c:1290
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long reclen
Definition: iozone.c:1535
double tmp
char read_sync
Definition: iozone.c:1295
off64_t offset64
Definition: iozone.c:1280
unsigned long long genrand64_int64(void)
Definition: iozone.c:23922
float compute_time
Definition: iozone.c:1538
void async_init()
Definition: iozone.c:19044
char Uflag
Definition: iozone.c:1329
int async_read_no_copy()
Definition: iozone.c:19050
char * mbuffer
Definition: iozone.c:1366
char client_iozone
Definition: iozone.c:1296
void srand48()
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
void srand()
char * initfile()
long long page_size
Definition: iozone.c:428
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char mmapasflag
Definition: iozone.c:1512
size_t async_write_no_copy()
Definition: iozone.c:19032
void init_by_array64(unsigned long long *, unsigned long long)
char * mainbuffer
Definition: iozone.c:1366
int async_read()
Definition: iozone.c:19026
char odsync
Definition: iozone.c:1516
unsigned int length
char * buffer1
Definition: iozone.c:1366
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
char dedup
Definition: iozone.c:1304
purge_buffer_cache()
Definition: iozone.c:12274
#define MAXBUFFERSIZE
Definition: iozone.c:809
off64_t numrecs64
Definition: iozone.c:1534
char mmapssflag
Definition: iozone.c:1512
long long verify_buffer(char *buffer, long long length, off64_t recnum, long long recsize, unsigned long long patt, char sverify)
Definition: iozone.c:6940
char dedup_interior
Definition: iozone.c:1304
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
int close()
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
char oflag
Definition: iozone.c:1509
void async_release()
Definition: iozone.c:19056
int rand()
char h_flag
Definition: iozone.c:1509
char silent
Definition: iozone.c:1295
long long res_prob
Definition: iozone.c:1294
char no_copy_flag
Definition: iozone.c:1519
static double time_so_far()
Definition: iozone.c:6844
char include_close
Definition: iozone.c:1519
char OPS_flag
Definition: iozone.c:1517
void exit()
int rlocking
Definition: iozone.c:1308
char mmapnsflag
Definition: iozone.c:1512
int fsync()
double cputime_res
Definition: iozone.c:1271
long long rest_val
Definition: iozone.c:1540
long long off64_t
Definition: iozone.c:357
int i
Definition: fileop.c:140
int direct_flag
Definition: iozone.c:1527
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ read_perf_test() [1/2]

void read_perf_test ( )

◆ read_perf_test() [2/2]

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

Definition at line 8282 of file iozone.c.

8287 {
8288  double starttime2;
8289  double compute_val = (double)0;
8290  double readtime[2];
8291  double walltime[2], cputime[2];
8292 #ifdef unix
8293  double qtime_u_start,qtime_u_stop;
8294  double qtime_s_start,qtime_s_stop;
8295 #endif
8296  long long j;
8297  long long traj_size;
8298  off64_t i,numrecs64,traj_offset;
8299  off64_t lock_offset=0;
8300  long long Index = 0;
8301  unsigned long long readrate[2];
8303  volatile char *buffer1;
8304  char *nbuff;
8305  char *maddr;
8306  char *wmaddr;
8307  int fd,open_flags;
8308  int test_foo,ltest;
8309  long wval;
8310  double qtime_start,qtime_stop;
8311  double hist_time;
8312 #ifdef ASYNC_IO
8313  struct cache *gc=0;
8314 
8315 #else
8316  long long *gc=0;
8317 #endif
8318 #ifdef unix
8319  qtime_u_start=qtime_u_stop=0;
8320  qtime_s_start=qtime_s_stop=0;
8321 #endif
8322  hist_time=qtime_start=qtime_stop=0;
8323  maddr=0;
8324  traj_offset=0;
8325  test_foo=0;
8326  numrecs64 = (kilo64*1024)/reclen;
8327 
8328  open_flags = O_RDONLY;
8329 #if defined(_HPUX_SOURCE) || defined(linux)
8330  if(read_sync)
8331  open_flags |=O_RSYNC|O_SYNC;
8332 #endif
8333 #if ! defined(DONT_HAVE_O_DIRECT)
8334 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
8335  if(direct_flag)
8336  open_flags |=O_DIRECT;
8337 #endif
8338 #if defined(TRU64)
8339  if(direct_flag)
8340  open_flags |=O_DIRECTIO;
8341 #endif
8342 #endif
8343  if(r_traj_flag)
8344  {
8347  } else
8349  fd = 0;
8350  if(Q_flag && (!rol_opened))
8351  {
8352  rol_opened++;
8353  rqfd=fopen("rol.dat","a");
8354  if(rqfd==0)
8355  {
8356  printf("Unable to open rol.dat\n");
8357  exit(56);
8358  }
8359  fprintf(rqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
8360  rrqfd=fopen("rrol.dat","a");
8361  if(rrqfd==0)
8362  {
8363  printf("Unable to open rrol.dat\n");
8364  exit(57);
8365  }
8366  fprintf(rrqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
8367  }
8368  /*
8369  * begin real testing
8370  */
8371  if(noretest)
8372  ltest=1;
8373  else
8374  ltest=2;
8375 
8376  for( j=0; j<ltest; j++ )
8377  {
8378 
8379  if(cpuutilflag)
8380  {
8381  walltime[j] = time_so_far();
8382  cputime[j] = cputime_so_far();
8383  }
8384 
8385  if(Uflag) /* Unmount and re-mount the mountpoint */
8386  {
8388  }
8389 #if defined(Windows)
8390  if(unbuffered)
8391  {
8392  hand=CreateFile(filename,
8393  GENERIC_READ|GENERIC_WRITE,
8394  FILE_SHARE_WRITE|FILE_SHARE_READ,
8395  NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
8396  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
8397  NULL);
8398  }
8399  else
8400  {
8401 #endif
8402  if((fd = I_OPEN(filename, open_flags,0))<0)
8403  {
8404  printf("\nCan not open temporary file %s for read\n",filename);
8405  perror("open");
8406  exit(58);
8407  }
8408 #if defined(Windows)
8409  }
8410 #endif
8411 #ifdef ASYNC_IO
8412  if(async_flag)
8413  async_init(&gc,fd,direct_flag);
8414 #endif
8415 
8416 #ifdef VXFS
8417  if(direct_flag)
8418  {
8419  ioctl(fd,VX_SETCACHE,VX_DIRECT);
8420  ioctl(fd,VX_GETCACHE,&test_foo);
8421  if(test_foo == 0)
8422  {
8423  if(!client_iozone)
8424  printf("\nVxFS advanced setcache feature not available.\n");
8425  exit(3);
8426  }
8427  }
8428 #endif
8429 #if defined(solaris)
8430  if(direct_flag)
8431  {
8432  test_foo = directio(fd, DIRECTIO_ON);
8433  if(test_foo != 0)
8434  {
8435  if(!client_iozone)
8436  printf("\ndirectio not available.\n");
8437  exit(3);
8438  }
8439  }
8440 #endif
8441  if(file_lock)
8442  if(mylockf((int) fd, (int) 1, (int)1) != 0)
8443  printf("File lock for read failed. %d\n",errno);
8444  if(mmapflag)
8445  {
8446  maddr=(char *)initfile(fd,filebytes64,0,PROT_READ);
8447  }
8448 #if defined(Windows)
8449  if(!unbuffered)
8450 #endif
8451  fsync(fd);
8452  /*
8453  * Need to prime the instruction cache & TLB
8454  */
8455  nbuff=mainbuffer;
8456  if(fetchon)
8457  fetchit(nbuff,reclen);
8458 #if defined(Windows)
8459  if(!unbuffered)
8460  {
8461 #endif
8462  if(read(fd, (void *)nbuff, (size_t) reclen) != reclen)
8463  {
8464 #ifdef _64BIT_ARCH_
8465  printf("\nError reading block %d %llx\n", 0,
8466  (unsigned long long)nbuff);
8467 #else
8468  printf("\nError reading block %d %lx\n", 0,
8469  (long)nbuff);
8470 #endif
8471  perror("read");
8472  exit(60);
8473  }
8474  I_LSEEK(fd,0,SEEK_SET);
8475 #if defined(Windows)
8476  }
8477  if(unbuffered)
8478  SetFilePointer(hand,(LONG)0,0,FILE_BEGIN);
8479 #endif
8480  nbuff=mainbuffer;
8481 
8482  if(fetchon)
8483  fetchit(nbuff,reclen);
8484  starttime2 = time_so_far();
8485 #ifdef unix
8486  if(Q_flag || hist_summary)
8487  {
8488  qtime_u_start=utime_so_far();
8489  qtime_s_start=stime_so_far();
8490  }
8491 #endif
8492  if(r_traj_flag)
8493  {
8494  rewind(r_traj_fd);
8495  }
8496  compute_val=(double)0;
8499  for(i=0; i<numrecs64; i++)
8500  {
8501  if(disrupt_flag && ((i%DISRUPT)==0))
8502  {
8503 #if defined(Windows)
8504 
8505  if(unbuffered)
8506  disruptw(hand);
8507  else
8508  disrupt(fd);
8509 #else
8510  disrupt(fd);
8511 #endif
8512  }
8513  if(r_traj_flag)
8514  {
8515  traj_offset=get_traj(r_traj_fd, (long long *)&traj_size,(float *)&compute_time, (long)0);
8516  reclen=traj_size;
8517 #if defined(Windows)
8518  if(unbuffered)
8519  SetFilePointer(hand,(LONG)traj_offset,0,FILE_BEGIN);
8520  else
8521 #endif
8522  I_LSEEK(fd,traj_offset,SEEK_SET);
8523  }
8524  if(Q_flag)
8525  {
8526 #if defined(Windows)
8527  if(unbuffered)
8528  traj_offset=SetFilePointer(hand,(LONG)0,0,FILE_CURRENT);
8529  else
8530 #endif
8531  traj_offset=I_LSEEK(fd,0,SEEK_CUR);
8532  }
8533  if(rlocking)
8534  {
8535  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
8536  mylockr((int) fd, (int) 1, (int)1,
8537  lock_offset, reclen);
8538  }
8539  if(compute_flag)
8540  compute_val+=do_compute(compute_time);
8541  if(multi_buffer)
8542  {
8543  Index +=reclen;
8544  if(Index > (MAXBUFFERSIZE-reclen))
8545  Index=0;
8546  nbuff = mbuffer + Index;
8547  }
8548  if(purge)
8549  purgeit(nbuff,reclen);
8550  if(Q_flag || hist_summary)
8551  qtime_start=time_so_far();
8552  if(mmapflag)
8553  {
8554  wmaddr=&maddr[i*reclen];
8555  fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
8556  }
8557  else
8558  {
8559  if(async_flag)
8560  {
8561  if(no_copy_flag)
8562  async_read_no_copy(gc, (long long)fd, &buffer1, (i*reclen), reclen,
8563  1LL,(numrecs64*reclen),depth);
8564  else
8565  async_read(gc, (long long)fd, nbuff, (i*reclen),reclen,
8566  1LL,(numrecs64*reclen),depth);
8567  }
8568  else
8569  {
8570 #if defined(Windows)
8571  if(unbuffered)
8572  {
8573  ReadFile(hand, nbuff, reclen,(LPDWORD)&wval,
8574  0);
8575  }
8576  else
8577 #endif
8578  wval=read((int)fd, (void*)nbuff, (size_t) reclen);
8579  if(wval != reclen)
8580  {
8581 #ifdef _64BIT_ARCH_
8582 #ifdef NO_PRINT_LLD
8583  printf("\nError reading block %ld %lx\n", i,
8584  (unsigned long long)nbuff);
8585 #else
8586  printf("\nError reading block %lld %llx\n", i,
8587  (unsigned long long)nbuff);
8588 #endif
8589 #else
8590 #ifdef NO_PRINT_LLD
8591  printf("\nError reading block %ld %x\n", i,
8592  (long)nbuff);
8593 #else
8594  printf("\nError reading block %lld %lx\n", i,
8595  (long)nbuff);
8596 #endif
8597 #endif
8598  perror("read");
8599  exit(61);
8600  }
8601  }
8602  }
8603  if(verify) {
8604  if(async_flag && no_copy_flag)
8605  {
8607  exit(62);
8608  }
8609  }
8610  else
8611  {
8612  if(verify_buffer(nbuff,reclen,(off64_t)i,reclen,(long long)pattern,sverify)){
8613  exit(63);
8614  }
8615  }
8616  }
8617  if(async_flag && no_copy_flag)
8618  async_release(gc);
8619  buffer1=0;
8620  if(hist_summary)
8621  {
8622  qtime_stop=time_so_far();
8623  hist_time =(qtime_stop-qtime_start-time_res);
8624  hist_insert(hist_time);
8625  }
8626  if(Q_flag)
8627  {
8628  qtime_stop=time_so_far();
8629  if(j==0)
8630 #ifdef NO_PRINT_LLD
8631  fprintf(rqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,(qtime_stop-qtime_start-time_res)*1000000,reclen);
8632  else
8633  fprintf(rrqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,(qtime_stop-qtime_start-time_res)*1000000,reclen);
8634 #else
8635  fprintf(rqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,(qtime_stop-qtime_start-time_res)*1000000,reclen);
8636  else
8637  fprintf(rrqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,(qtime_stop-qtime_start-time_res)*1000000,reclen);
8638 #endif
8639  }
8642  }
8643  if(rlocking)
8644  {
8645  mylockr((int) fd, (int) 0, (int)1,
8646  lock_offset, reclen);
8647  }
8648  if(file_lock)
8649  if(mylockf((int) fd, (int) 0, (int)1))
8650  printf("Read unlock failed. %d\n",errno);
8651 #ifdef unix
8652  if(Q_flag)
8653  {
8654  qtime_u_stop=utime_so_far();
8655  qtime_s_stop=stime_so_far();
8656  if(j==0)
8657  fprintf(rqfd,"\nSystem time %10.3f User time %10.3f Real %10.3f (seconds)\n",
8658  (qtime_s_stop-qtime_s_start)/sc_clk_tck,
8659  (qtime_u_stop-qtime_u_start)/sc_clk_tck,
8660  time_so_far()-starttime2);
8661  else
8662  fprintf(rrqfd,"\nSystem time %10.3f User time %10.3f Real %10.3f (seconds)\n",
8663  (qtime_s_stop-qtime_s_start)/sc_clk_tck,
8664  (qtime_u_stop-qtime_u_start)/sc_clk_tck,
8665  time_so_far()-starttime2);
8666  }
8667 #endif
8668 #ifdef ASYNC_IO
8669  if(async_flag)
8670  {
8671  end_async(gc);
8672  gc=0;
8673  }
8674 #endif
8675  if(include_flush)
8676  {
8677  if(mmapflag)
8678  msync(maddr,(size_t)filebytes64,MS_SYNC);
8679  else
8680  fsync(fd);
8681  }
8682  if(include_close)
8683  {
8684  if(mmapflag)
8685  {
8686  mmap_end(maddr,(unsigned long long)filebytes64);
8687  }
8688 #if defined(Windows)
8689  if(unbuffered)
8690  CloseHandle(hand);
8691  else
8692 #endif
8693  close(fd);
8694  }
8695  readtime[j] = ((time_so_far() - starttime2)-time_res)-compute_val;
8696  if(readtime[j] < (double).000001)
8697  {
8698  readtime[j]= time_res;
8699  if(rec_prob < reclen)
8700  rec_prob = reclen;
8701  res_prob=1;
8702  }
8703  if(!include_close)
8704  {
8705  if(mmapflag)
8706  msync(maddr,(size_t)filebytes64,MS_SYNC);
8707  else
8708  fsync(fd);
8709  if(mmapflag)
8710  {
8711  mmap_end(maddr,(unsigned long long)filebytes64);
8712  }
8713 #if defined(Windows)
8714  if(unbuffered)
8715  CloseHandle(hand);
8716  else
8717 #endif
8718  close(fd);
8719  }
8720  if(cpuutilflag)
8721  {
8722  cputime[j] = cputime_so_far() - cputime[j];
8723  if (cputime[j] < cputime_res)
8724  cputime[j] = 0.0;
8725  walltime[j] = time_so_far() - walltime[j];
8726  if (walltime[j] < cputime[j])
8727  walltime[j] = cputime[j];
8728  }
8729  if(restf)
8730  sleep((int)rest_val);
8731  }
8732  if(OPS_flag || MS_flag){
8734  /*filebytes64=filebytes64/reclen;*/
8735  } else
8737 
8738  for(j=0;j<ltest;j++)
8739  {
8740  if(MS_flag)
8741  {
8742  readrate[j]=1000000.0*(readtime[j] / (double)filebytes64);
8743  continue;
8744  }
8745  else
8746  {
8747  readrate[j] =
8748  (unsigned long long) ((double) filebytes64 / readtime[j]);
8749  }
8750  if(!(OPS_flag || MS_flag))
8751  readrate[j] >>= 10;
8752 
8753  }
8754  data1[0]=readrate[0];
8755  data2[0]=1;
8756  if(noretest)
8757  {
8758  readrate[1]=(long long)0;
8759  if(cpuutilflag)
8760  {
8761  walltime[1]=0.0;
8762  cputime[1]=0.0;
8763  }
8764  }
8765  /* Must save walltime & cputime before calling store_value() for each/any cell.*/
8766  if(cpuutilflag)
8767  store_times(walltime[0], cputime[0]);
8768  store_value((off64_t)readrate[0]);
8769  if(cpuutilflag)
8770  store_times(walltime[1], cputime[1]);
8771  store_value((off64_t)readrate[1]);
8772 #ifdef NO_PRINT_LLD
8773  if(!silent) printf("%9ld",readrate[0]);
8774  if(!silent) printf("%9ld",readrate[1]);
8775  if(!silent) fflush(stdout);
8776 #else
8777  if(!silent) printf("%9lld",readrate[0]);
8778  if(!silent) printf("%9lld",readrate[1]);
8779  if(!silent) fflush(stdout);
8780 #endif
8781 }
void end_async()
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
store_times(double walltime, double cputime)
Definition: iozone.c:11551
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
FILE * rrqfd
Definition: iozone.c:1342
FILE * rqfd
Definition: iozone.c:1342
FILE * r_traj_fd
Definition: iozone.c:1367
long long r_traj_fsize
Definition: iozone.c:1325
char rol_opened
Definition: iozone.c:1341
store_value(off64_t value)
Definition: iozone.c:11518
void mmap_end()
long long get_traj()
char verify
Definition: iozone.c:1513
char mmapflag
Definition: iozone.c:1512
int fd
Definition: iozone.c:1291
#define DISRUPT
Definition: iozone.c:779
int restf
Definition: iozone.c:1514
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
long long multi_buffer
Definition: iozone.c:1290
char disrupt_flag
Definition: iozone.c:1520
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
void disrupt()
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long reclen
Definition: iozone.c:1535
char read_sync
Definition: iozone.c:1295
int mylockf()
float compute_time
Definition: iozone.c:1538
void async_init()
Definition: iozone.c:19044
char Uflag
Definition: iozone.c:1329
int async_read_no_copy()
Definition: iozone.c:19050
char * mbuffer
Definition: iozone.c:1366
char client_iozone
Definition: iozone.c:1296
char noretest
Definition: iozone.c:1510
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
char unbuffered
Definition: iozone.c:1509
char * initfile()
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char * mainbuffer
Definition: iozone.c:1366
int async_read()
Definition: iozone.c:19026
char * buffer1
Definition: iozone.c:1366
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
purge_buffer_cache()
Definition: iozone.c:12274
#define MAXBUFFERSIZE
Definition: iozone.c:809
off64_t numrecs64
Definition: iozone.c:1534
long long verify_buffer(char *buffer, long long length, off64_t recnum, long long recsize, unsigned long long patt, char sverify)
Definition: iozone.c:6940
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
int close()
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
void async_release()
Definition: iozone.c:19056
int r_traj_flag
Definition: iozone.c:1523
char silent
Definition: iozone.c:1295
char Q_flag
Definition: iozone.c:1517
long long res_prob
Definition: iozone.c:1294
char no_copy_flag
Definition: iozone.c:1519
long long r_traj_ops_completed
Definition: iozone.c:1326
static double time_so_far()
Definition: iozone.c:6844
char include_close
Definition: iozone.c:1519
void hist_insert()
char OPS_flag
Definition: iozone.c:1517
void exit()
int rlocking
Definition: iozone.c:1308
long long r_traj_ops
Definition: iozone.c:1325
int fsync()
double cputime_res
Definition: iozone.c:1271
long long rest_val
Definition: iozone.c:1540
long long off64_t
Definition: iozone.c:357
int errno
int i
Definition: fileop.c:140
long long r_traj_bytes_completed
Definition: iozone.c:1326
int direct_flag
Definition: iozone.c:1527
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ read_stride_perf_test() [1/2]

void read_stride_perf_test ( )

◆ read_stride_perf_test() [2/2]

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.

9938 {
9939  double strideintime;
9940  double starttime1;
9941  double compute_val = (double)0;
9942  double walltime, cputime;
9943  off64_t numrecs64,current_position;
9944  long long Index = 0;
9945  off64_t i,savepos64 = 0;
9946  unsigned long long strideinrate;
9948  off64_t lock_offset=0;
9949  long long uu;
9950  off64_t stripewrap=0;
9951  int fd,open_flags;
9952  volatile char *buffer1;
9953  char *nbuff;
9954  char *maddr;
9955  char *wmaddr;
9956 #if defined(VXFS) || defined(solaris)
9957  int test_foo=0;
9958 #endif
9959 #ifdef ASYNC_IO
9960  struct cache *gc=0;
9961 #else
9962  long long *gc=0;
9963 #endif
9964 
9965  walltime=cputime=0;
9966  nbuff=maddr=wmaddr=0;
9967  open_flags=O_RDONLY;
9968 #if ! defined(DONT_HAVE_O_DIRECT)
9969 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
9970  if(direct_flag)
9971  open_flags |=O_DIRECT;
9972 #endif
9973 #if defined(TRU64)
9974  if(direct_flag)
9975  open_flags |=O_DIRECTIO;
9976 #endif
9977 #endif
9978 #if defined(_HPUX_SOURCE) || defined(linux)
9979  if(read_sync)
9980  open_flags |=O_RSYNC|O_SYNC;
9981 #endif
9982  next64 = (off64_t)0;
9983  numrecs64 = (kilos64*1024)/reclen;
9985  if(Uflag) /* Unmount and re-mount the mountpoint */
9986  {
9988  }
9989  if((fd = I_OPEN(filename, (int)open_flags, 0640))<0)
9990  {
9991  printf("\nCan not open temporary file for read\n");
9992  perror("open");
9993  exit(86);
9994  }
9995 #ifdef ASYNC_IO
9996  if(async_flag)
9997  async_init(&gc,fd,direct_flag);
9998 #endif
9999 
10000 #ifdef VXFS
10001  if(direct_flag)
10002  {
10003  ioctl(fd,VX_SETCACHE,VX_DIRECT);
10004  ioctl(fd,VX_GETCACHE,&test_foo);
10005  if(test_foo == 0)
10006  {
10007  if(!client_iozone)
10008  printf("\nVxFS advanced setcache feature not available.\n");
10009  exit(3);
10010  }
10011  }
10012 #endif
10013 #if defined(solaris)
10014  if(direct_flag)
10015  {
10016  test_foo = directio(fd, DIRECTIO_ON);
10017  if(test_foo != 0)
10018  {
10019  if(!client_iozone)
10020  printf("\ndirectio not available.\n");
10021  exit(3);
10022  }
10023  }
10024 #endif
10025  if(mmapflag)
10026  {
10027  maddr=(char *)initfile(fd,filebytes64,0,PROT_READ);
10028  }
10029  fsync(fd);
10030  current_position=0;
10031  nbuff=mainbuffer;
10033  if(fetchon)
10034  fetchit(nbuff,reclen);
10035  starttime1 = time_so_far();
10036  if(cpuutilflag)
10037  {
10038  walltime = time_so_far();
10039  cputime = cputime_so_far();
10040  }
10041  for(i=0; i<numrecs64; i++){
10042  if(rlocking)
10043  {
10044  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
10045  mylockr((int) fd, (int) 1, (int)1,
10046  lock_offset, reclen);
10047  }
10048  if(compute_flag)
10049  compute_val+=do_compute(compute_time);
10050  if(multi_buffer)
10051  {
10052  Index +=reclen;
10053  if(Index > (MAXBUFFERSIZE-reclen))
10054  Index=0;
10055  nbuff = mbuffer + Index;
10056  }
10057  if(purge)
10058  purgeit(nbuff,reclen);
10059  if(verify)
10060  {
10061  savepos64=current_position/reclen;
10062  }
10063  if(mmapflag)
10064  {
10065  wmaddr = &maddr[current_position];
10066  fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
10067  }
10068  else
10069  {
10070  if(async_flag)
10071  {
10072  if(no_copy_flag)
10073  async_read_no_copy(gc, (long long)fd, &buffer1, current_position,
10075  else
10076  async_read(gc, (long long)fd, nbuff, current_position, reclen,
10078  }
10079  else
10080  {
10081  if((uu=read((int)fd, (void*)nbuff, (size_t) reclen)) != reclen)
10082  {
10083 #ifdef NO_PRINT_LLD
10084  printf("\nError reading block %ld, fd= %d Filename %s Read returned %ld\n", i, fd,filename,uu);
10085  printf("\nSeeked to %ld Reclen = %ld\n", savepos64,reclen);
10086 #else
10087  printf("\nError reading block %lld, fd= %d Filename %s Read returned %lld\n", i, fd,filename,uu);
10088  printf("\nSeeked to %lld Reclen = %lld\n", savepos64,reclen);
10089 #endif
10090  perror("read");
10091  exit(88);
10092  }
10093  }
10094  }
10095  if(rlocking)
10096  {
10097  mylockr((int) fd, (int) 0, (int)1,
10098  lock_offset, reclen);
10099  }
10100  current_position+=reclen;
10101  if(verify){
10102  if(async_flag && no_copy_flag)
10103  {
10104  if(verify_buffer(buffer1,reclen, (off64_t)savepos64 ,reclen,(long long)pattern,sverify)){
10105  exit(89);
10106  }
10107  }
10108  else
10109  {
10110  if(verify_buffer(nbuff,reclen, (off64_t)savepos64 ,reclen,(long long)pattern,sverify)){
10111  exit(90);
10112  }
10113  }
10114  }
10115  if(async_flag && no_copy_flag)
10116  async_release(gc);
10117 
10118  /* This is a bit tricky. The goal is to read with a stride through
10119  the file. The problem is that you need to touch all of the file
10120  blocks. So.. the first pass through you read with a constant stride.
10121  When you hit eof then add 1 to the beginning offset of the next
10122  time through the file. The rub here is that eventually adding
10123  1 will cause the initial start location plus the STRIDE to be
10124  beyond eof. So... when this happens the initial offset for the
10125  next pass needs to be set back to 0.
10126  */
10127  if(current_position + (stride * reclen) >= (numrecs64 * reclen)-reclen)
10128  {
10129  current_position=0;
10130 
10131  stripewrap++;
10132 
10133  if(numrecs64 <= stride)
10134  {
10135  current_position=0;
10136  }
10137  else
10138  {
10139  current_position = (off64_t)((stripewrap)%numrecs64)*reclen;
10140  }
10141 
10142  if (!(h_flag || k_flag || mmapflag))
10143  {
10144  if(I_LSEEK(fd,current_position,SEEK_SET)<0)
10145  {
10146  perror("lseek");
10147  exit(91);
10148  }
10149  }
10150  }
10151  else
10152  {
10153  current_position+=(stride*reclen)-reclen;
10154  if (!(h_flag || k_flag || mmapflag))
10155  {
10156  if(I_LSEEK(fd,current_position,SEEK_SET)<0)
10157  {
10158  perror("lseek");
10159  exit(93);
10160  };
10161  }
10162  }
10163  }
10164  if(cpuutilflag)
10165  {
10166  cputime = cputime_so_far() - cputime;
10167  if (cputime < cputime_res)
10168  cputime = 0.0;
10169  walltime = time_so_far() - walltime;
10170  if (walltime < cputime)
10171  walltime = cputime;
10172  }
10173 
10174 #ifdef ASYNC_IO
10175  if(async_flag)
10176  {
10177  end_async(gc);
10178  gc=0;
10179  }
10180 #endif
10181  if(include_flush)
10182  {
10183  if(mmapflag)
10184  msync(maddr,(size_t)filebytes64,MS_SYNC);
10185  else
10186  fsync(fd);
10187  }
10188  if(include_close)
10189  {
10190  if(mmapflag)
10191  {
10192  mmap_end(maddr,(unsigned long long)filebytes64);
10193  }
10194  close(fd);
10195  }
10196  strideintime = ((time_so_far() - starttime1)-time_res)
10197  -compute_val;
10198  if(strideintime < (double).000001)
10199  {
10200  strideintime= time_res;
10201  if(rec_prob < reclen)
10202  rec_prob = reclen;
10203  res_prob=1;
10204  }
10205 
10206  if(!include_close)
10207  {
10208  if(mmapflag)
10209  msync(maddr,(size_t)filebytes64,MS_SYNC);
10210  else
10211  fsync(fd);
10212  if(mmapflag)
10213  {
10214  mmap_end(maddr,(unsigned long long)filebytes64);
10215  }
10216  close(fd);
10217  }
10218 
10219  if(OPS_flag || MS_flag){
10221  }
10222  if(MS_flag)
10223  {
10224  strideinrate=1000000.0*(strideintime / (double)filebytes64);
10225  }
10226  else
10227  {
10228  strideinrate = (unsigned long long) ((double) filebytes64 / strideintime);
10229  }
10230  if(!(OPS_flag || MS_flag))
10231  strideinrate >>= 10;
10232  /* Must save walltime & cputime before calling store_value() for each/any cell.*/
10233  if(cpuutilflag)
10234  store_times(walltime, cputime);
10235  store_value((off64_t)strideinrate);
10236 #ifdef NO_PRINT_LLD
10237  if(!silent) printf(" %8ld",strideinrate);
10238 #else
10239  if(!silent) printf(" %8lld",strideinrate);
10240 #endif
10241  if(!silent) fflush(stdout);
10242  if(restf)
10243  sleep((int)rest_val);
10244 }
void end_async()
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
store_times(double walltime, double cputime)
Definition: iozone.c:11551
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
store_value(off64_t value)
Definition: iozone.c:11518
void mmap_end()
char verify
Definition: iozone.c:1513
long long stride
Definition: iozone.c:1532
char mmapflag
Definition: iozone.c:1512
char k_flag
Definition: iozone.c:1509
int fd
Definition: iozone.c:1291
int restf
Definition: iozone.c:1514
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
long long multi_buffer
Definition: iozone.c:1290
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long reclen
Definition: iozone.c:1535
char read_sync
Definition: iozone.c:1295
float compute_time
Definition: iozone.c:1538
void async_init()
Definition: iozone.c:19044
char Uflag
Definition: iozone.c:1329
int async_read_no_copy()
Definition: iozone.c:19050
char * mbuffer
Definition: iozone.c:1366
char client_iozone
Definition: iozone.c:1296
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
char * initfile()
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char * mainbuffer
Definition: iozone.c:1366
int async_read()
Definition: iozone.c:19026
char * buffer1
Definition: iozone.c:1366
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
purge_buffer_cache()
Definition: iozone.c:12274
#define MAXBUFFERSIZE
Definition: iozone.c:809
off64_t numrecs64
Definition: iozone.c:1534
long long verify_buffer(char *buffer, long long length, off64_t recnum, long long recsize, unsigned long long patt, char sverify)
Definition: iozone.c:6940
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
int close()
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
void async_release()
Definition: iozone.c:19056
char h_flag
Definition: iozone.c:1509
char silent
Definition: iozone.c:1295
long long res_prob
Definition: iozone.c:1294
char no_copy_flag
Definition: iozone.c:1519
static double time_so_far()
Definition: iozone.c:6844
char include_close
Definition: iozone.c:1519
char OPS_flag
Definition: iozone.c:1517
void exit()
int rlocking
Definition: iozone.c:1308
int fsync()
off64_t next64
Definition: iozone.c:1340
double cputime_res
Definition: iozone.c:1271
long long rest_val
Definition: iozone.c:1540
long long off64_t
Definition: iozone.c:357
int i
Definition: fileop.c:140
int direct_flag
Definition: iozone.c:1527
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ record_command_line() [1/2]

void record_command_line ( )
Here is the caller graph for this function:

◆ record_command_line() [2/2]

void record_command_line ( int  argc,
char **  argv 
)

Definition at line 3145 of file iozone.c.

3149 {
3150  int ix, len = 0;
3151 
3152  /* print and save the entire command line */
3153  if(!silent) printf("\tCommand line used:");
3154  for (ix=0; ix < argc; ix++) {
3155  if(!silent) printf(" %s", argv[ix]);
3156  if ((len + strlen(argv[ix])) < sizeof(command_line)) {
3157  strcat (command_line, argv[ix]);
3158  strcat (command_line, " ");
3159  len += strlen(argv[ix]) + 1;
3160  }
3161  else {
3162  printf ("Command line too long to save completely.\n");
3163  break;
3164  }
3165  }
3166  if(!silent) printf("\n");
3167 }
char command_line[1024]
Definition: iozone.c:1387
char silent
Definition: iozone.c:1295

◆ reverse_perf_test() [1/2]

void reverse_perf_test ( )

◆ reverse_perf_test() [2/2]

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

Definition at line 9324 of file iozone.c.

9329 {
9330  double revreadtime[2];
9331  double starttime2;
9332  double walltime[2], cputime[2];
9333  double compute_val = (double)0;
9334  long long j;
9336  long long Index = 0;
9337  unsigned long long revreadrate[2];
9339  off64_t lock_offset=0;
9340  int fd,open_flags;
9341  char *maddr,*wmaddr;
9342  volatile char *buffer1;
9343  int ltest;
9344  char *nbuff;
9345 #if defined(VXFS) || defined(solaris)
9346  int test_foo=0;
9347 #endif
9348 #ifdef ASYNC_IO
9349  struct cache *gc=0;
9350 #else
9351  long long *gc=0;
9352 #endif
9353 
9354  maddr=wmaddr=0;
9355  open_flags=O_RDONLY;
9356 #if ! defined(DONT_HAVE_O_DIRECT)
9357 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
9358  if(direct_flag)
9359  open_flags |=O_DIRECT;
9360 #endif
9361 #if defined(TRU64)
9362  if(direct_flag)
9363  open_flags |=O_DIRECTIO;
9364 #endif
9365 #endif
9366 #if defined(_HPUX_SOURCE) || defined(linux)
9367  if(read_sync)
9368  open_flags |=O_RSYNC|O_SYNC;
9369 #endif
9370  numrecs64 = (kilo64*1024)/reclen;
9372  fd = 0;
9373  if(noretest)
9374  ltest=1;
9375  else
9376  ltest=2;
9377  for( j=0; j<ltest; j++ )
9378  {
9379  if(cpuutilflag)
9380  {
9381  walltime[j] = time_so_far();
9382  cputime[j] = cputime_so_far();
9383  }
9384  if(Uflag) /* Unmount and re-mount the mountpoint */
9385  {
9387  }
9388  if((fd = I_OPEN(filename, open_flags,0))<0){
9389  printf("\nCan not open temporary file for read\n");
9390  perror("open");
9391  exit(75);
9392  }
9393 #ifdef ASYNC_IO
9394  if(async_flag)
9395  async_init(&gc,fd,direct_flag);
9396 #endif
9397 
9398 #ifdef VXFS
9399  if(direct_flag)
9400  {
9401  ioctl(fd,VX_SETCACHE,VX_DIRECT);
9402  ioctl(fd,VX_GETCACHE,&test_foo);
9403  if(test_foo == 0)
9404  {
9405  if(!client_iozone)
9406  printf("\nVxFS advanced setcache feature not available.\n");
9407  exit(3);
9408  }
9409  }
9410 #endif
9411 #if defined(solaris)
9412  if(direct_flag)
9413  {
9414  test_foo = directio(fd, DIRECTIO_ON);
9415  if(test_foo != 0)
9416  {
9417  if(!client_iozone)
9418  printf("\ndirectio not available.\n");
9419  exit(3);
9420  }
9421  }
9422 #endif
9423  if(mmapflag)
9424  {
9425  maddr=(char *)initfile(fd,filebytes64,0,PROT_READ);
9426  }
9427  fsync(fd);
9428  nbuff=mainbuffer;
9430  if(fetchon)
9431  fetchit(nbuff,reclen);
9432  starttime2 = time_so_far();
9433  if (!(h_flag || k_flag || mmapflag))
9434  {
9436  {
9437  if(I_LSEEK( fd, -reclen, SEEK_END )<0)
9438  {
9439  perror("lseek");
9440  exit(77);
9441  };
9442  }
9443  else
9444  {
9445  if(I_LSEEK( fd, filebytes64-reclen, SEEK_SET )<0)
9446  {
9447  perror("lseek");
9448  exit(77);
9449  };
9450  }
9451  }
9452  compute_val=(double)0;
9453  for(i=0; i<numrecs64; i++)
9454  {
9455  if(rlocking)
9456  {
9457  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
9458  mylockr((int) fd, (int) 1, (int)1,
9459  lock_offset, reclen);
9460  }
9461  if(compute_flag)
9462  compute_val+=do_compute(compute_time);
9463  if(multi_buffer)
9464  {
9465  Index +=reclen;
9466  if(Index > (MAXBUFFERSIZE-reclen))
9467  Index=0;
9468  nbuff = mbuffer + Index;
9469  }
9470 
9471  if(purge)
9472  purgeit(nbuff,reclen);
9473  if(mmapflag)
9474  {
9475  wmaddr = &maddr[((numrecs64-1)-i)*reclen];
9476  fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
9477  }
9478  else
9479  if(async_flag)
9480  {
9481  if(no_copy_flag)
9482  async_read_no_copy(gc, (long long)fd, &buffer1, ((((numrecs64-1)-i)*reclen)),
9483  reclen, -1LL,(numrecs64*reclen),depth);
9484  else
9485  async_read(gc, (long long)fd, nbuff, (((numrecs64-1)-i)*reclen),
9486  reclen,-1LL,(numrecs64*reclen),depth);
9487  }else
9488  {
9489  if(read((int)fd, (void*)nbuff, (size_t) reclen) != reclen)
9490  {
9491 #ifdef NO_PRINT_LLD
9492  printf("\nError reading block %ld\n", i);
9493 #else
9494  printf("\nError reading block %lld\n", i);
9495 #endif
9496  perror("read");
9497  exit(79);
9498  }
9499  }
9500  if(verify){
9501  if(async_flag && no_copy_flag)
9502  {
9504  exit(80);
9505  }
9506  }
9507  else
9508  {
9509  if(verify_buffer(nbuff,reclen,(off64_t)(numrecs64-1)-i,reclen,(long long)pattern,sverify)){
9510  exit(81);
9511  }
9512  }
9513  }
9514  if(async_flag && no_copy_flag)
9515  async_release(gc);
9516  if(rlocking)
9517  {
9518  mylockr((int) fd, (int) 0, (int)1,
9519  lock_offset, reclen);
9520  }
9521  if (!(h_flag || k_flag || mmapflag))
9522  {
9523  I_LSEEK( fd, (off64_t)-2*reclen, SEEK_CUR );
9524  }
9525  }
9526 #ifdef ASYNC_IO
9527  if(async_flag)
9528  {
9529  end_async(gc);
9530  gc=0;
9531  }
9532 #endif
9533  if(include_flush)
9534  {
9535  if(mmapflag)
9536  msync(maddr,(size_t)filebytes64,MS_SYNC);
9537  else
9538  fsync(fd);
9539  }
9540  if(include_close)
9541  {
9542  if(mmapflag)
9543  {
9544  mmap_end(maddr,(unsigned long long)filebytes64);
9545  }
9546  close(fd);
9547  }
9548  revreadtime[j] = ((time_so_far() - starttime2)-time_res)
9549  -compute_val;
9550  if(revreadtime[j] < (double).000001)
9551  {
9552  revreadtime[j]= time_res;
9553  if(rec_prob < reclen)
9554  rec_prob = reclen;
9555  res_prob=1;
9556  }
9557  if(!include_close)
9558  {
9559  if(mmapflag)
9560  msync(maddr,(size_t)filebytes64,MS_SYNC);
9561  else
9562  fsync(fd);
9563  if(mmapflag)
9564  {
9565  mmap_end(maddr,(unsigned long long)filebytes64);
9566  }
9567  close(fd);
9568  }
9569  if(cpuutilflag)
9570  {
9571  cputime[j] = cputime_so_far() - cputime[j];
9572  if (cputime[j] < cputime_res)
9573  cputime[j] = 0.0;
9574  walltime[j] = time_so_far() - walltime[j];
9575  if (walltime[j] < cputime[j])
9576  walltime[j] = cputime[j];
9577  }
9578  if(restf)
9579  sleep((int)rest_val);
9580  }
9581  if(OPS_flag || MS_flag){
9583  }
9584  for(j=0;j<ltest;j++){
9585  if(MS_flag)
9586  {
9587  revreadrate[j]=1000000.0*(revreadtime[j] / (double)filebytes64);
9588  continue;
9589  }
9590  else
9591  {
9592  revreadrate[j] =
9593  (unsigned long long) ((double) filebytes64 / revreadtime[j]);
9594  }
9595  if(!(OPS_flag || MS_flag))
9596  revreadrate[j] >>= 10;
9597  }
9598  /* Must save walltime & cputime before calling store_value() for each/any cell.*/
9599  if(cpuutilflag)
9600  store_times(walltime[0], cputime[0]);
9601  store_value((off64_t)revreadrate[0]);
9602 #ifdef NO_PRINT_LLD
9603  if(!silent) printf("%8ld",revreadrate[0]);
9604 #else
9605  if(!silent) printf("%8lld",revreadrate[0]);
9606 #endif
9607  if(!silent) fflush(stdout);
9608 }
int check_filename()
void end_async()
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
store_times(double walltime, double cputime)
Definition: iozone.c:11551
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
store_value(off64_t value)
Definition: iozone.c:11518
void mmap_end()
char verify
Definition: iozone.c:1513
char mmapflag
Definition: iozone.c:1512
char k_flag
Definition: iozone.c:1509
int fd
Definition: iozone.c:1291
int restf
Definition: iozone.c:1514
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
long long multi_buffer
Definition: iozone.c:1290
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long reclen
Definition: iozone.c:1535
char read_sync
Definition: iozone.c:1295
float compute_time
Definition: iozone.c:1538
void async_init()
Definition: iozone.c:19044
char Uflag
Definition: iozone.c:1329
int async_read_no_copy()
Definition: iozone.c:19050
char * mbuffer
Definition: iozone.c:1366
char client_iozone
Definition: iozone.c:1296
char noretest
Definition: iozone.c:1510
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
char * initfile()
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char * mainbuffer
Definition: iozone.c:1366
int async_read()
Definition: iozone.c:19026
char * buffer1
Definition: iozone.c:1366
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
purge_buffer_cache()
Definition: iozone.c:12274
#define MAXBUFFERSIZE
Definition: iozone.c:809
off64_t numrecs64
Definition: iozone.c:1534
long long verify_buffer(char *buffer, long long length, off64_t recnum, long long recsize, unsigned long long patt, char sverify)
Definition: iozone.c:6940
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
int close()
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
void async_release()
Definition: iozone.c:19056
char h_flag
Definition: iozone.c:1509
char silent
Definition: iozone.c:1295
long long res_prob
Definition: iozone.c:1294
char no_copy_flag
Definition: iozone.c:1519
static double time_so_far()
Definition: iozone.c:6844
char include_close
Definition: iozone.c:1519
char OPS_flag
Definition: iozone.c:1517
void exit()
int rlocking
Definition: iozone.c:1308
int fsync()
double cputime_res
Definition: iozone.c:1271
long long rest_val
Definition: iozone.c:1540
long long off64_t
Definition: iozone.c:357
int i
Definition: fileop.c:140
int direct_flag
Definition: iozone.c:1527
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ rewriterec_perf_test() [1/2]

void rewriterec_perf_test ( )

◆ rewriterec_perf_test() [2/2]

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

Definition at line 9617 of file iozone.c.

9622 {
9623  double writeintime;
9624  double starttime1;
9625  double walltime, cputime;
9626  double compute_val = (double)0;
9627  long long i;
9629  long long flags;
9630  long long Index=0;
9631  unsigned long long writeinrate;
9633  off64_t lock_offset=0;
9634  int fd,wval;
9635  char *maddr;
9636  char *wmaddr,*free_addr,*nbuff;
9637 #if defined(VXFS) || defined(solaris)
9638  int test_foo=0;
9639 #endif
9640 #ifdef ASYNC_IO
9641  struct cache *gc=0;
9642 #else
9643  long long *gc=0;
9644 #endif
9645 
9646  walltime=cputime=0;
9647  maddr=wmaddr=free_addr=nbuff=0;
9648  numrecs64 = (kilo64*1024)/reclen;
9650 /* flags = O_RDWR|O_CREAT|O_TRUNC;*/
9651  flags = O_RDWR|O_CREAT;
9652 #if ! defined(DONT_HAVE_O_DIRECT)
9653 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
9654  if(direct_flag)
9655  flags |=O_DIRECT;
9656 #endif
9657 #if defined(TRU64)
9658  if(direct_flag)
9659  flags |=O_DIRECTIO;
9660 #endif
9661 #endif
9662  if(oflag)
9663  flags |= O_SYNC;
9664 #if defined(O_DSYNC)
9665  if(odsync)
9666  flags |= O_DSYNC;
9667 #endif
9668 #if defined(_HPUX_SOURCE) || defined(linux)
9669  if(read_sync)
9670  flags |=O_RSYNC|O_SYNC;
9671 #endif
9672 /*
9673  if (!no_unlink)
9674  {
9675  if(check_filename(filename))
9676  unlink(filename);
9677  }
9678 */
9679  if(Uflag) /* Unmount and re-mount the mountpoint */
9680  {
9682  }
9683  if((fd = I_OPEN(filename, (int)flags,0640))<0)
9684  {
9685  printf("\nCan not open temporary file %s for write.\n",filename);
9686  perror("open");
9687  exit(84);
9688  }
9689 #ifdef VXFS
9690  if(direct_flag)
9691  {
9692  ioctl(fd,VX_SETCACHE,VX_DIRECT);
9693  ioctl(fd,VX_GETCACHE,&test_foo);
9694  if(test_foo == 0)
9695  {
9696  if(!client_iozone)
9697  printf("\nVxFS advanced setcache feature not available.\n");
9698  exit(3);
9699  }
9700  }
9701 #endif
9702 #if defined(solaris)
9703  if(direct_flag)
9704  {
9705  test_foo = directio(fd, DIRECTIO_ON);
9706  if(test_foo != 0)
9707  {
9708  if(!client_iozone)
9709  printf("\ndirectio not available.\n");
9710  exit(3);
9711  }
9712  }
9713 #endif
9714  if(mmapflag)
9715  {
9716  maddr=(char *)initfile(fd,filebytes64,1,PROT_READ|PROT_WRITE);
9717  }
9718 #ifdef ASYNC_IO
9719  if(async_flag)
9720  async_init(&gc,fd,direct_flag);
9721 #endif
9722  wval=fsync(fd);
9723  if(wval==-1){
9724  perror("fsync");
9725  signal_handler();
9726  }
9727  nbuff=mainbuffer;
9729  if(fetchon)
9730  fetchit(nbuff,reclen);
9731  /*
9732  wval=write(fd, nbuff, (size_t) reclen);
9733  if(wval != reclen)
9734  {
9735 #ifdef NO_PRINT_LLD
9736  printf("\nError writing block %ld, fd= %d\n", 0, fd);
9737 #else
9738  printf("\nError writing block %lld, fd= %d\n", 0, fd);
9739 #endif
9740  if(wval==-1)
9741  perror("write");
9742  signal_handler();
9743  }
9744  */
9745  if(verify || dedup || dedup_interior)
9746  fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
9747  starttime1 = time_so_far();
9748  if(cpuutilflag)
9749  {
9750  walltime = time_so_far();
9751  cputime = cputime_so_far();
9752  }
9753  for(i=0; i<numrecs64; i++){
9754  if(rlocking)
9755  {
9756  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
9757  mylockr((int) fd, (int) 1, (int)0,
9758  lock_offset, reclen);
9759  }
9760  if(compute_flag)
9761  compute_val+=do_compute(compute_time);
9762  if(multi_buffer)
9763  {
9764  Index +=reclen;
9765  if(Index > (MAXBUFFERSIZE-reclen))
9766  Index=0;
9767  nbuff = mbuffer + Index;
9768  }
9769  if(async_flag && no_copy_flag)
9770  {
9771  free_addr=nbuff=(char *)malloc((size_t)reclen+page_size);
9772  nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
9773  if(verify || dedup || dedup_interior)
9774  fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
9775  }
9776  if((verify & diag_v) || dedup || dedup_interior)
9777  fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
9778  if(purge)
9779  purgeit(nbuff,reclen);
9780  if(mmapflag)
9781  {
9782  wmaddr = &maddr[i*reclen];
9783  fill_area((long long*)nbuff,(long long*)wmaddr,(long long)reclen);
9784  if(!mmapnsflag)
9785  {
9786  if(mmapasflag)
9787  msync(wmaddr,(size_t)reclen,MS_ASYNC);
9788  if(mmapssflag)
9789  msync(wmaddr,(size_t)reclen,MS_SYNC);
9790  }
9791  }
9792  else
9793  {
9794  if(async_flag)
9795  {
9796  if(no_copy_flag)
9797  async_write_no_copy(gc, (long long)fd, nbuff, reclen, (i*reclen), depth,free_addr);
9798  else
9799  async_write(gc, (long long)fd, nbuff, reclen, (i*reclen), depth);
9800  }
9801  else
9802  {
9803  wval=write(fd, nbuff, (size_t) reclen);
9804  if(wval != reclen)
9805  {
9806 #ifdef NO_PRINT_LLD
9807  printf("\nError writing block %ld, fd= %d\n", i, fd);
9808 #else
9809  printf("\nError writing block %lld, fd= %d\n", i, fd);
9810 #endif
9811  if(wval==-1)
9812  perror("write");
9813  signal_handler();
9814  }
9815  }
9816  }
9817  if(rlocking)
9818  {
9819  mylockr((int) fd, (int) 0, (int)0,
9820  lock_offset, reclen);
9821  }
9822  if (!(h_flag || k_flag || mmapflag))
9823  {
9824  I_LSEEK(fd, (off64_t)0,SEEK_SET);
9825  }
9826  }
9827 
9828 #ifdef ASYNC_IO
9829  if(async_flag)
9830  {
9831  end_async(gc);
9832  gc=0;
9833  }
9834 #endif
9835  if(include_flush)
9836  {
9837  if(mmapflag)
9838  msync(maddr,(size_t)filebytes64,MS_SYNC);/* Clean up before read starts running */
9839  else
9840  {
9841  wval=fsync(fd);
9842  if(wval==-1){
9843  perror("fsync");
9844  signal_handler();
9845  }
9846  }
9847  }
9848  if(include_close)
9849  {
9850  if(mmapflag)
9851  mmap_end(maddr,(unsigned long long)filebytes64);
9852  wval=close(fd);
9853  if(wval==-1){
9854  perror("close");
9855  signal_handler();
9856  }
9857  }
9858  writeintime = ((time_so_far() - starttime1)-time_res)-
9859  compute_val;
9860  if(cpuutilflag)
9861  {
9862  cputime = cputime_so_far() - cputime;
9863  if (cputime < cputime_res)
9864  cputime = 0.0;
9865  walltime = time_so_far() - walltime;
9866  if (walltime < cputime)
9867  walltime = cputime;
9868  }
9869  if(writeintime < (double).000001)
9870  {
9871  writeintime= time_res;
9872  if(rec_prob < reclen)
9873  rec_prob = reclen;
9874  res_prob=1;
9875  }
9876 
9877  if(!include_close)
9878  {
9879  if(mmapflag)
9880  msync(maddr,(size_t)filebytes64,MS_SYNC);/* Clean up before read starts running */
9881  else
9882  {
9883  wval=fsync(fd);
9884  if(wval==-1){
9885  perror("fsync");
9886  signal_handler();
9887  }
9888  }
9889  if(mmapflag)
9890  mmap_end(maddr,(unsigned long long)filebytes64);
9891  wval=close(fd);
9892  if(wval==-1){
9893  perror("close");
9894  signal_handler();
9895  }
9896 
9897  }
9898 
9899  if(OPS_flag || MS_flag){
9901  }
9902  if(MS_flag)
9903  {
9904  writeinrate=1000000.0*(writeintime / (double)filebytes64);
9905  }
9906  else
9907  {
9908  writeinrate = (unsigned long long) ((double) filebytes64 / writeintime);
9909  }
9910  if(!(OPS_flag || MS_flag))
9911  writeinrate >>= 10;
9912  /* Must save walltime & cputime before calling store_value() for each/any cell.*/
9913  if(cpuutilflag)
9914  store_times(walltime, cputime);
9915  store_value((off64_t)writeinrate);
9916 #ifdef NO_PRINT_LLD
9917  if(!silent) printf(" %8ld",writeinrate);
9918 #else
9919  if(!silent) printf(" %8lld",writeinrate);
9920 #endif
9921  if(!silent) fflush(stdout);
9922  if(restf)
9923  sleep((int)rest_val);
9924 }
void end_async()
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
store_times(double walltime, double cputime)
Definition: iozone.c:11551
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
char diag_v
Definition: iozone.c:1304
store_value(off64_t value)
Definition: iozone.c:11518
void mmap_end()
char verify
Definition: iozone.c:1513
size_t async_write()
Definition: iozone.c:19038
void fill_buffer()
char mmapflag
Definition: iozone.c:1512
char k_flag
Definition: iozone.c:1509
int fd
Definition: iozone.c:1291
int restf
Definition: iozone.c:1514
void signal_handler()
Definition: iozone.c:3336
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
long long multi_buffer
Definition: iozone.c:1290
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long reclen
Definition: iozone.c:1535
char read_sync
Definition: iozone.c:1295
float compute_time
Definition: iozone.c:1538
void async_init()
Definition: iozone.c:19044
char Uflag
Definition: iozone.c:1329
char * mbuffer
Definition: iozone.c:1366
char client_iozone
Definition: iozone.c:1296
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
char * initfile()
long long page_size
Definition: iozone.c:428
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char mmapasflag
Definition: iozone.c:1512
size_t async_write_no_copy()
Definition: iozone.c:19032
char * mainbuffer
Definition: iozone.c:1366
char odsync
Definition: iozone.c:1516
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
char dedup
Definition: iozone.c:1304
purge_buffer_cache()
Definition: iozone.c:12274
#define MAXBUFFERSIZE
Definition: iozone.c:809
off64_t numrecs64
Definition: iozone.c:1534
char mmapssflag
Definition: iozone.c:1512
char dedup_interior
Definition: iozone.c:1304
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
int close()
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
char oflag
Definition: iozone.c:1509
char h_flag
Definition: iozone.c:1509
char silent
Definition: iozone.c:1295
long long res_prob
Definition: iozone.c:1294
char no_copy_flag
Definition: iozone.c:1519
static double time_so_far()
Definition: iozone.c:6844
char include_close
Definition: iozone.c:1519
char OPS_flag
Definition: iozone.c:1517
void exit()
int rlocking
Definition: iozone.c:1308
char mmapnsflag
Definition: iozone.c:1512
int fsync()
double cputime_res
Definition: iozone.c:1271
long long rest_val
Definition: iozone.c:1540
long long off64_t
Definition: iozone.c:357
int i
Definition: fileop.c:140
int direct_flag
Definition: iozone.c:1527
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ send_stop()

void send_stop ( )

Definition at line 22607 of file iozone.c.

22609 {
22610  struct master_command mc;
22611 
22612  bzero(&mc, sizeof(struct master_command));
22613  mc.m_command = R_STOP_FLAG;
22614  mc.m_mygen = mygen;
22615  mc.m_version = proto_version;
22616  mc.m_client_number = chid;
22617  mc.m_client_error = client_error;
22618  if(cdebug)
22619  {
22620  fprintf(newstdout,"Child %d sending stop flag to master\n",(int)chid);
22621  fflush(newstdout);
22622  }
22623  child_send(controlling_host_name,(struct master_command *)&mc, sizeof(struct master_command));
22624  client_error=0; /* clear error, it has been delivered */
22625 }
char controlling_host_name[100]
Definition: iozone.c:1493
void bzero()
void child_send()
int cdebug
Definition: iozone.c:1478
long long chid
Definition: iozone.c:1529
#define R_STOP_FLAG
Definition: iozone.c:742
FILE * newstdout
Definition: iozone.c:1475
int proto_version
Definition: iozone.c:1486
int mygen
Definition: iozone.c:1524
int client_error
Definition: iozone.c:1398
Here is the call graph for this function:
Here is the caller graph for this function:

◆ show_help()

void show_help ( )

Definition at line 3318 of file iozone.c.

3320 {
3321  long long i;
3322  if(!silent) printf("iozone: help mode\n\n");
3323  for(i=0; strlen(help[i]); i++)
3324  {
3325  if(!silent) printf("%s\n", help[i]);
3326  }
3327 }
char * help[]
Definition: iozone.c:129
char silent
Definition: iozone.c:1295
int i
Definition: fileop.c:140
Here is the caller graph for this function:

◆ signal_handler()

void signal_handler ( )

Definition at line 3336 of file iozone.c.

3338 {
3339  long long i;
3340  if(distributed)
3341  {
3342  if(master_iozone)
3343  cleanup_children();
3344  }
3345  if((long long)getpid()==myid)
3346  {
3347  if(!silent) printf("\niozone: interrupted\n\n");
3348 #ifndef VMS
3349  if (!no_unlink)
3350  {
3352  unlink(filename); /* delete the file */
3353  }
3354  for(i=1;i<num_child;i++)
3355  {
3356  if(check_filename(dummyfile[i]))
3357  unlink(dummyfile[i]); /* delete the file */
3358  }
3359  if (!no_unlink)
3360  {
3361  if(check_filename(dummyfile[0]))
3362  unlink(dummyfile[0]); /* delete the file */
3363  }
3364 
3365 #endif
3366  if(Rflag && !trflag){
3367  dump_excel();
3368  }
3369  if(Rflag && trflag){
3370  dump_throughput();
3371  }
3372 
3373  if(!silent) printf("exiting iozone\n\n");
3374  if(res_prob)
3375  {
3376  printf("Timer resolution is poor. Some small transfers may have \n");
3377  printf("reported inaccurate results. Sizes %ld Kbytes and below.\n",
3378  (long)rec_prob/1024);
3379  }
3380  if(trflag && !use_thread)
3381  for(i=0;i<num_child;i++)
3382  kill((pid_t)childids[i],SIGTERM);
3383  if(r_traj_flag)
3384  fclose(r_traj_fd);
3385  if(w_traj_flag)
3386  fclose(w_traj_fd);
3387  }
3388  if(sp_msfd)
3389  close(sp_msfd);
3390  if(sp_mrfd)
3391  close(sp_mrfd);
3392  exit(0);
3393 }
int check_filename()
long long rec_prob
Definition: iozone.c:1294
int w_traj_flag
Definition: iozone.c:1523
FILE * r_traj_fd
Definition: iozone.c:1367
int no_unlink
Definition: iozone.c:1521
char trflag
Definition: iozone.c:1320
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
int sp_msfd
Definition: iozone.c:1292
long long myid
Definition: iozone.c:1335
char distributed
Definition: iozone.c:1296
char use_thread
Definition: iozone.c:1372
char master_iozone
Definition: iozone.c:1296
void dump_throughput()
Definition: iozone.c:18694
void cleanup_children()
Definition: iozone.c:22647
long long num_child
Definition: iozone.c:1335
int sp_mrfd
Definition: iozone.c:1292
void dump_excel()
Definition: iozone.c:11653
long long childids[MAXSTREAMS+1]
Definition: iozone.c:1335
int kill(__pid_t __pid, int __sig) __attribute__((__nothrow__
int close()
FILE * w_traj_fd
Definition: iozone.c:1367
int r_traj_flag
Definition: iozone.c:1523
char silent
Definition: iozone.c:1295
long long res_prob
Definition: iozone.c:1294
char Rflag
Definition: iozone.c:1303
int unlink()
void exit()
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sp_do_child_t()

void sp_do_child_t ( void  )

Definition at line 23183 of file iozone.c.

23185 {
23186  int i,y;
23187  int offset;
23188  int sp_tcount=0;
23189  /* child */
23190  /*
23191  * Child reads from master
23192  */
23195  for(i=0;i<sp_count;i++)
23196  {
23197  offset=0;
23198  while(offset<sp_msize)
23199  {
23201  if(y < 0)
23202  {
23203  if(cdebug)
23204  {
23205  fprintf(newstdout,"Child error %d offset %d\n",
23206  errno,offset);
23207  fflush(newstdout);
23208  }
23209  exit(1);
23210  }
23211  offset+=y;
23212  if(cdebug)
23213  {
23214  fprintf(newstdout,"Child offset %d read %d\n",offset,y);
23215  fflush(newstdout);
23216  }
23217  }
23218  sp_tcount+=offset;
23219  }
23221 
23222  close(sp_crfd);
23223  sleep(1); /* Wait for master to get into sp_get_result */
23225  (float)(sp_tcount/1024)/(sp_finish_time-sp_start_time));
23226 
23227  sleep(1);
23228  /*
23229  * Child writes to master
23230  */
23232  &sp_my_cs_addr);
23233  sp_tcount=0;
23234  offset=0;
23236  for(i=0;i<sp_count;i++)
23237  {
23239  sp_tcount+=y;
23240  }
23242  close(sp_csfd);
23243  sleep(1);
23245  (float)(sp_tcount/1024)/(sp_finish_time-sp_start_time));
23246  if(cdebug)
23247  {
23248  fprintf(newstdout,"child exits\n");
23249  fflush(newstdout);
23250  }
23251 }
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
int sp_master_listen_port
Definition: iozone.c:22786
int sp_start_child_send()
int sp_csfd
Definition: iozone.c:1292
off64_t offset
Definition: iozone.c:1279
char * sp_buf
Definition: iozone.c:22795
void sp_send_result(int, int, float)
Definition: iozone.c:22940
int sp_master_results_port
Definition: iozone.c:22789
double sp_start_time
Definition: iozone.c:22801
char * sp_dest
Definition: iozone.c:22781
int sp_start_child_listen(int listen_port, int size_of_message)
Definition: iozone.c:23090
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
int sp_msize
Definition: iozone.c:22799
int cdebug
Definition: iozone.c:1478
double sp_finish_time
Definition: iozone.c:22801
int sp_child_listen_port
Definition: iozone.c:22783
int close()
FILE * newstdout
Definition: iozone.c:1475
int sp_tcount
Definition: iozone.c:22800
int sp_count
Definition: iozone.c:22799
static double time_so_far()
Definition: iozone.c:6844
void exit()
int sp_crfd
Definition: iozone.c:1292
struct in_addr sp_my_cs_addr
Definition: iozone.c:22791
int errno
int i
Definition: fileop.c:140
long long y
Definition: iozone.c:1335
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sp_do_master_t()

void sp_do_master_t ( void  )

Definition at line 23261 of file iozone.c.

23263 {
23264  int i,y,sp_offset;
23265  int sp_tcount = 0;
23266 
23267 
23268  /*
23269  * Master writes to child
23270  */
23272  &sp_my_ms_addr);
23274  for(i=0;i<sp_count;i++)
23275  {
23277  sp_tcount+=y;
23278  }
23280  close(sp_msfd);
23281  sp_msfd=0;
23283  printf("%-20s sent %10d kbytes @ %10.2f Kbytes/sec \n",
23284  sp_master_host,sp_tcount/1024,
23285  (float)(sp_tcount/1024)/(sp_finish_time-sp_start_time));
23286 
23287  /* printf("\n"); */
23288  /*
23289  * Master reads from child
23290  */
23292  sp_offset=0;
23294  sp_tcount=0;
23295  for(i=0;i<sp_count;i++)
23296  {
23297  sp_offset=0;
23298  while(sp_offset<sp_msize)
23299  {
23300  y=read(sp_mrfd,&sp_buf[sp_offset],sp_msize-sp_offset);
23301  if(y < 0)
23302  {
23303  printf("Master error %d offset %d\n",errno,
23304  sp_offset);
23305  exit(1);
23306  }
23307  sp_offset+=y;
23308  /* printf("Master offset %d read %d\n",offset,y);*/
23309  }
23310  sp_tcount+=sp_offset;
23311  }
23314  printf("%-20s received %10d kbytes @ %10.2f Kbytes/sec \n",
23316  (float)(sp_tcount/1024)/(sp_finish_time-sp_start_time));
23317  printf("\n");
23318  wait(NULL);
23319  close(sp_mrfd);
23320  sp_mrfd=0;
23321 }
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
int sp_master_listen_port
Definition: iozone.c:22786
int sp_start_master_send(char *sp_child_host_name, int sp_child_listen_port, struct in_addr *sp_my_ms_addr)
Definition: iozone.c:22968
char * sp_buf
Definition: iozone.c:22795
int sp_msfd
Definition: iozone.c:1292
int sp_master_results_port
Definition: iozone.c:22789
double sp_start_time
Definition: iozone.c:22801
char * sp_dest
Definition: iozone.c:22781
void sp_get_result(int, int)
Definition: iozone.c:22905
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
int sp_msize
Definition: iozone.c:22799
int wait()
double sp_finish_time
Definition: iozone.c:22801
char sp_master_host[256]
Definition: iozone.c:22809
int sp_mrfd
Definition: iozone.c:1292
int sp_child_listen_port
Definition: iozone.c:22783
int sp_start_master_listen()
int close()
struct in_addr sp_my_ms_addr
Definition: iozone.c:22792
int sp_tcount
Definition: iozone.c:22800
int sp_count
Definition: iozone.c:22799
static double time_so_far()
Definition: iozone.c:6844
void exit()
int errno
int i
Definition: fileop.c:140
long long y
Definition: iozone.c:1335
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sp_get_result()

void sp_get_result ( int  port,
int  flag 
)

Definition at line 22905 of file iozone.c.

22908 {
22909  int tcfd;
22910  float throughput;
22911  int count;
22912  char mybuf[1024];
22913  int sp_offset,xx;
22914 
22915  tcfd=sp_start_master_listen(port, 1024);
22916  sp_offset=0;
22917  while(sp_offset < 1024)
22918  {
22919  xx=read(tcfd,&mybuf[sp_offset],1024);
22920  sp_offset+=xx;
22921  }
22922  sscanf(mybuf,"%d %f",&count,&throughput);
22923  if(!flag)
22924  printf("%-20s received %10d Kbytes @ %10.2f Kbytes/sec \n",
22925  sp_remote_host,count,throughput);
22926  else
22927  printf("%-20s sent %10d Kbytes @ %10.2f Kbytes/sec \n",
22928  sp_remote_host,count,throughput);
22929  close(tcfd);
22930 }
char sp_remote_host[256]
Definition: iozone.c:22808
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
int sp_start_master_listen()
int close()
static long count
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sp_send_result()

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

Definition at line 22940 of file iozone.c.

22944 {
22945  int msfd;
22946  char mybuf[1024];
22947  sprintf(mybuf,"%d %f",count, throughput);
22949  junk=write(msfd,mybuf,1024);
22950  if(cdebug)
22951  {
22952  fprintf(newstdout,"Sending result\n");
22953  fflush(newstdout);
22954  }
22955  close(msfd);
22956 }
int sp_start_child_send()
char * sp_dest
Definition: iozone.c:22781
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
int cdebug
Definition: iozone.c:1478
int junk
Definition: iozone.c:1402
int close()
FILE * newstdout
Definition: iozone.c:1475
static long count
struct in_addr sp_my_cs_addr
Definition: iozone.c:22791
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sp_start_child_listen()

int sp_start_child_listen ( int  listen_port,
int  size_of_message 
)

Definition at line 23090 of file iozone.c.

23094 {
23095  int tsize;
23096  int s,ns;
23097  unsigned int me;
23098  int rc;
23099  int xx;
23100  int tmp_port;
23101  struct sockaddr_in *addr;
23102  int sockerr;
23103  int recv_buf_size=65536;
23104  int optval=1;
23105  xx = 0;
23106  me=sizeof(struct sockaddr_in);
23107  tsize=size_of_message; /* Number of messages to receive */
23108  s = socket(AF_INET, SOCK_STREAM, 0);
23109  if (s < 0)
23110  {
23111  perror("socket failed:");
23112  exit(19);
23113  }
23114  sockerr = setsockopt (s, SOL_SOCKET, SO_RCVBUF, (char *)
23115  &recv_buf_size, sizeof(int));
23116  if ( sockerr == -1 ) {
23117  perror("Error in setsockopt 7\n");
23118  }
23119  sockerr = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)
23120  &optval, sizeof(int));
23121  if ( sockerr == -1 ) {
23122  perror("Error in setsockopt 8\n");
23123  }
23124  bzero(&sp_child_sync_sock, sizeof(struct sockaddr_in));
23125  tmp_port=sp_child_listen_port;
23126  sp_child_sync_sock.sin_port = htons(tmp_port);
23127  sp_child_sync_sock.sin_family = AF_INET;
23128  sp_child_sync_sock.sin_addr.s_addr = INADDR_ANY;
23129  rc = -1;
23130  while (rc < 0)
23131  {
23132  rc = bind(s, (struct sockaddr *)&sp_child_sync_sock,
23133  sizeof(struct sockaddr_in));
23134  if(rc < 0)
23135  {
23136  tmp_port++;
23137  sp_child_sync_sock.sin_port=htons(tmp_port);
23138  continue;
23139  }
23140  }
23141  sp_child_listen_port = ntohs(sp_child_sync_sock.sin_port);
23142  if(cdebug ==1)
23143  {
23144  fprintf(newstdout,"Child: Listen: Bound at port %d\n", tmp_port);
23145  fflush(newstdout);
23146  }
23147  if(rc < 0)
23148  {
23149  if(cdebug ==1)
23150  {
23151  fprintf(newstdout,"bind failed. Errno %d\n", errno);
23152  fflush(newstdout);
23153  }
23154  exit(20);
23155  }
23156 
23157  addr=&sp_child_async_sock;
23158  listen(s,10);
23159  if(cdebug)
23160  {
23161  fprintf(newstdout,"Child enters accept\n");
23162  fflush(newstdout);
23163  }
23164  ns=accept(s,(void *)addr,&me);
23165  if(cdebug)
23166  {
23167  fprintf(newstdout,"Child attached for receive. Sock %d %d\n", ns,errno);
23168  fflush(newstdout);
23169  }
23170  close(s);
23171  return(ns);
23172 }
rc
Definition: pscanf.h:23
void bzero()
int cdebug
Definition: iozone.c:1478
double s
Definition: byte_profile.c:36
struct sockaddr_in sp_child_sync_sock sp_child_async_sock
Definition: iozone.c:22793
int sp_child_listen_port
Definition: iozone.c:22783
int close()
FILE * newstdout
Definition: iozone.c:1475
void exit()
int errno
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sp_start_child_send() [1/2]

int sp_start_child_send ( )
Here is the caller graph for this function:

◆ sp_start_child_send() [2/2]

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.

23425 {
23426  int rc,sp_child_socket_val;
23427  struct sockaddr_in addr,raddr;
23428  struct hostent *he;
23429  int port,tmp_port;
23430  struct in_addr *ip;
23431  int ecount=0;
23432  struct timespec req,rem;
23433 
23434  req.tv_sec = 0;
23435  req.tv_nsec = 10000000;
23436  rem.tv_sec = 0;
23437  rem.tv_nsec = 10000000;
23438 
23439  he = gethostbyname(sp_master_host_name);
23440  if (he == NULL)
23441  {
23442  printf("Child: Bad hostname >%s<\n",sp_master_host_name);
23443  fflush(stdout);
23444  exit(22);
23445  }
23446  if(cdebug ==1)
23447  {
23448  fprintf(newstdout,"Child: start child send: %s\n", he->h_name);
23449  fprintf(newstdout,"To: %s at port %d\n",sp_master_host_name,
23451  fflush(newstdout);
23452  }
23453  ip = (struct in_addr *)he->h_addr_list[0];
23454 
23455  port=sp_master_listen_port;
23456  sp_my_cs_addr->s_addr = ip->s_addr;
23457 
23458  raddr.sin_family = AF_INET;
23459  raddr.sin_port = htons(port);
23460  raddr.sin_addr.s_addr = ip->s_addr;
23461  sp_child_socket_val = socket(AF_INET, SOCK_STREAM, 0);
23462  if (sp_child_socket_val < 0)
23463  {
23464  perror("child: socket failed:");
23465  exit(23);
23466  }
23467  bzero(&addr, sizeof(struct sockaddr_in));
23468  tmp_port=sp_child_esend_port;
23469  addr.sin_port = htons(tmp_port);
23470  addr.sin_family = AF_INET;
23471  addr.sin_addr.s_addr = INADDR_ANY;
23472  rc = -1;
23473  while (rc < 0)
23474  {
23475  rc = bind(sp_child_socket_val, (struct sockaddr *)&addr,
23476  sizeof(struct sockaddr_in));
23477  if(rc < 0)
23478  {
23479  tmp_port++;
23480  addr.sin_port=htons(tmp_port);
23481  continue;
23482  }
23483  }
23484  if(cdebug ==1)
23485  {
23486  fprintf(newstdout,"Child: Bound port %d\n",tmp_port);
23487  fflush(newstdout);
23488  }
23489  if (rc < 0)
23490  {
23491  perror("Child: bind failed for sync channel to child.\n");
23492  exit(24);
23493  }
23494 #if defined(Windows)
23495  sleep(1);
23496 #else
23497  nanosleep(&req,&rem);
23498 #endif
23499 again:
23500  rc = connect(sp_child_socket_val, (struct sockaddr *)&raddr,
23501  sizeof(struct sockaddr_in));
23502  if (rc < 0)
23503  {
23504  if(ecount++<300)
23505  {
23506 #if defined(Windows)
23507  sleep(1);
23508 #else
23509  nanosleep(&req,&rem);
23510 #endif
23511  goto again;
23512  }
23513 
23514  fprintf(newstdout,"child: connect failed. Errno %d \n",errno);
23515  fflush(newstdout);
23516  exit(25);
23517  }
23518  if(cdebug ==1)
23519  {
23520  fprintf(newstdout,"child Connected\n");
23521  fflush(newstdout);
23522  }
23523  return (sp_child_socket_val);
23524 }
rc
Definition: pscanf.h:23
int sp_master_listen_port
Definition: iozone.c:22786
__time_t tv_sec
void bzero()
int sp_child_esend_port
Definition: iozone.c:22784
int cdebug
Definition: iozone.c:1478
int ecount
Definition: iozone.c:1310
FILE * newstdout
Definition: iozone.c:1475
void exit()
struct in_addr sp_my_cs_addr
Definition: iozone.c:22791
int errno
Here is the call graph for this function:

◆ sp_start_master_listen() [1/2]

int sp_start_master_listen ( )
Here is the caller graph for this function:

◆ sp_start_master_listen() [2/2]

int sp_start_master_listen ( int  sp_master_listen_port,
int  sp_size_of_message 
)

Definition at line 23331 of file iozone.c.

23335 {
23336  int tsize;
23337  int s,ns;
23338  unsigned int me;
23339  int rc;
23340  int xx;
23341  int tmp_port;
23342  struct sockaddr_in *addr;
23343  int sockerr;
23344  int recv_buf_size=65536;
23345  int optval=1;
23346  xx = 0;
23347  me=sizeof(struct sockaddr_in);
23348  tsize=sp_size_of_message; /* Number of messages to receive */
23349  s = socket(AF_INET, SOCK_STREAM, 0);
23350  if (s < 0)
23351  {
23352  perror("socket failed:");
23353  exit(19);
23354  }
23355  sockerr = setsockopt (s, SOL_SOCKET, SO_RCVBUF, (char *)
23356  &recv_buf_size, sizeof(int));
23357  if ( sockerr == -1 ) {
23358  perror("Error in setsockopt 9\n");
23359  }
23360  sockerr = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)
23361  &optval, sizeof(int));
23362  if ( sockerr == -1 ) {
23363  perror("Error in setsockopt 10\n");
23364  }
23365  bzero(&sp_master_sync_sock, sizeof(struct sockaddr_in));
23366  tmp_port=sp_master_listen_port;
23367  sp_master_sync_sock.sin_port = htons(tmp_port);
23368  sp_master_sync_sock.sin_family = AF_INET;
23369  sp_master_sync_sock.sin_addr.s_addr = INADDR_ANY;
23370  rc = -1;
23371  while (rc < 0)
23372  {
23373  rc = bind(s, (struct sockaddr *)&sp_master_sync_sock,
23374  sizeof(struct sockaddr_in));
23375  if(rc < 0)
23376  {
23377  tmp_port++;
23378  sp_master_sync_sock.sin_port=htons(tmp_port);
23379  continue;
23380  }
23381  }
23382  sp_master_listen_port = ntohs(sp_master_sync_sock.sin_port);
23383  if(mdebug ==1)
23384  {
23385  printf("Master: Listen: Bound at port %d\n", tmp_port);
23386  fflush(stdout);
23387  }
23388  if(rc < 0)
23389  {
23390  perror("bind failed\n");
23391  exit(20);
23392  }
23393 
23394  addr=&sp_master_async_sock;
23395  listen(s,10);
23396  if(mdebug)
23397  {
23398  printf("Master enters accept\n");
23399  fflush(stdout);
23400  }
23401  ns=accept(s,(void *)addr,&me);
23402  if(mdebug)
23403  {
23404  printf("Master attached for receive. Sock %d %d\n", ns,errno);
23405  fflush(stdout);
23406  }
23407  close(s);
23408  return(ns);
23409 }
rc
Definition: pscanf.h:23
int mdebug
Definition: iozone.c:1479
int sp_master_listen_port
Definition: iozone.c:22786
void bzero()
double s
Definition: byte_profile.c:36
int close()
struct sockaddr_in sp_master_sync_sock sp_master_async_sock
Definition: iozone.c:22794
void exit()
int errno
Here is the call graph for this function:

◆ sp_start_master_send()

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.

22973 {
22974  int rc,master_socket_val;
22975  struct sockaddr_in addr,raddr;
22976  struct hostent *he;
22977  int port,tmp_port;
22978  int ecount=0;
22979  struct in_addr *ip;
22980  struct timespec req,rem;
22981 
22982  req.tv_sec = 0;
22983  req.tv_nsec = 10000000;
22984  rem.tv_sec = 0;
22985  rem.tv_nsec = 10000000;
22986 
22987  he = gethostbyname(sp_child_host_name);
22988  if (he == NULL)
22989  {
22990  printf("Master: Bad hostname >%s<\n",sp_child_host_name);
22991  fflush(stdout);
22992  exit(22);
22993  }
22994  if(mdebug ==1)
22995  {
22996  printf("Master: start master send: %s\n", he->h_name);
22997  fflush(stdout);
22998  }
22999  ip = (struct in_addr *)he->h_addr_list[0];
23000 #ifndef UWIN
23001  if(mdebug ==1)
23002  {
23003  printf("Master: child name: %s\n", (char *)inet_ntoa(*ip));
23004  printf("Master: child Port: %d\n", sp_child_listen_port);
23005  fflush(stdout);
23006  }
23007 #endif
23008 
23009  port=sp_child_listen_port;
23010  sp_my_ms_addr->s_addr = ip->s_addr;
23011  /*port=CHILD_LIST_PORT;*/
23012 
23013  raddr.sin_family = AF_INET;
23014  raddr.sin_port = htons(port);
23015  raddr.sin_addr.s_addr = ip->s_addr;
23016  master_socket_val = socket(AF_INET, SOCK_STREAM, 0);
23017  if (master_socket_val < 0)
23018  {
23019  perror("Master: socket failed:");
23020  exit(23);
23021  }
23022  bzero(&addr, sizeof(struct sockaddr_in));
23023  tmp_port=sp_master_esend_port;
23024  addr.sin_port = htons(tmp_port);
23025  addr.sin_family = AF_INET;
23026  addr.sin_addr.s_addr = INADDR_ANY;
23027  rc = -1;
23028  while (rc < 0)
23029  {
23030  rc = bind(master_socket_val, (struct sockaddr *)&addr,
23031  sizeof(struct sockaddr_in));
23032  if(rc < 0)
23033  {
23034  tmp_port++;
23035  addr.sin_port=htons(tmp_port);
23036  continue;
23037  }
23038  }
23039  if(mdebug ==1)
23040  {
23041  printf("Master: Bound port\n");
23042  fflush(stdout);
23043  }
23044  if (rc < 0)
23045  {
23046  perror("Master: bind failed for sync channel to child.\n");
23047  exit(24);
23048  }
23049 #if defined(Windows)
23050  sleep(1);
23051 #else
23052  nanosleep(&req,&rem);
23053 #endif
23054 
23055 again:
23056  rc = connect(master_socket_val, (struct sockaddr *)&raddr,
23057  sizeof(struct sockaddr_in));
23058  if (rc < 0)
23059  {
23060  if(ecount++ < 300)
23061  {
23062 #if defined(Windows)
23063  sleep(1);
23064 #else
23065  nanosleep(&req,&rem);
23066 #endif
23067  /*sleep(1);*/
23068  goto again;
23069  }
23070  perror("Master: connect failed\n");
23071  printf("Error %d\n",errno);
23072  exit(25);
23073  }
23074  if(mdebug ==1)
23075  {
23076  printf("Master Connected\n");
23077  fflush(stdout);
23078  }
23079  return (master_socket_val);
23080 }
rc
Definition: pscanf.h:23
int mdebug
Definition: iozone.c:1479
__time_t tv_sec
void bzero()
char * inet_ntoa()
int ecount
Definition: iozone.c:1310
int sp_child_listen_port
Definition: iozone.c:22783
int sp_master_esend_port
Definition: iozone.c:22787
struct in_addr sp_my_ms_addr
Definition: iozone.c:22792
void exit()
int errno
Here is the call graph for this function:
Here is the caller graph for this function:

◆ speed_main()

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.

22829 {
22830  int x;
22831 
22832 
22834  sp_msize=(int)reclen;
22835  sp_count=((int)kilos*1024)/(int)reclen;
22836  if(!client_flag)
22837  {
22838  printf("\n");
22839  strcpy(sp_remote_host,client_name);
22840  strcpy(sp_location,e_path);
22841  }
22842 
22843  if(client_flag)
22844  sp_child_mode=1;
22845  sp_buf=(char *)malloc(sp_msize);
22846  bzero(sp_buf,sp_msize); /* get page faults out of the way */
22847 
22848  if(sp_child_mode)
22849  {
22850  close(0);
22851  close(1);
22852  close(2);
22853  if(cdebug)
22854  {
22855  newstdin=freopen("/tmp/don_in","r+",stdin);
22856  newstdout=freopen("/tmp/don_out","a+",stdout);
22857  newstderr=freopen("/tmp/don_err","a+",stderr);
22858  }
22860  sp_do_child_t();
22861  free(sp_buf);
22862  exit(0);
22863  }
22864  x=fork();
22865  if(x==0)
22866  {
22868  sprintf(sp_command,"%s %s %s -+s -t 1 -r %d -s %d -+c %s -+t ",
22870  sp_location, (int)reclen/1024,
22871  (int)kilos,sp_master_host);
22872  /*printf("%s\n",sp_command);*/
22874  exit(0);
22875  }
22876  else
22877  {
22878  if(!sp_once)
22879  {
22880  printf("***************************************************\n");
22881  printf("* >>>>> Client Network Speed check <<<<< *\n");
22882  printf("***************************************************\n\n");
22883  printf("Master: %s\n",sp_master_host);
22884  printf("Transfer size %d bytes \n",sp_msize);
22885  printf("Count %d\n",sp_count);
22886  printf("Total size %d kbytes \n\n",
22887  (sp_msize*sp_count)/1024);
22888  sp_once=1;
22889  }
22891  sleep(1);
22892  sp_do_master_t();
22893  free(sp_buf);
22894  }
22895 }
char sp_remote_host[256]
Definition: iozone.c:22808
char sp_command[1024]
Definition: iozone.c:22796
char controlling_host_name[100]
Definition: iozone.c:1493
void sp_do_master_t(void)
Definition: iozone.c:23261
void bzero()
void find_remote_shell()
FILE * newstdin
Definition: iozone.c:1475
char * sp_buf
Definition: iozone.c:22795
void sp_do_child_t(void)
Definition: iozone.c:23183
char sp_remote_shell[100]
Definition: iozone.c:22797
int sp_once
Definition: iozone.c:22799
long long reclen
Definition: iozone.c:1535
char * sp_dest
Definition: iozone.c:22781
FILE * newstderr
Definition: iozone.c:1475
int sp_msize
Definition: iozone.c:22799
int cdebug
Definition: iozone.c:1478
int junk
Definition: iozone.c:1402
char sp_master_host[256]
Definition: iozone.c:22809
long long x
Definition: iozone.c:1335
int close()
FILE * newstdout
Definition: iozone.c:1475
char sp_location[256]
Definition: iozone.c:22810
int sp_count
Definition: iozone.c:22799
int system()
void exit()
int sp_child_mode
Definition: iozone.c:22798
Here is the call graph for this function:
Here is the caller graph for this function:

◆ srand()

void srand ( )
Here is the caller graph for this function:

◆ srand48()

void srand48 ( )
Here is the caller graph for this function:

◆ start_child_listen() [1/2]

int start_child_listen ( )
Here is the caller graph for this function:

◆ start_child_listen() [2/2]

int start_child_listen ( int  size_of_message)

Definition at line 20759 of file iozone.c.

20762 {
20763  int tsize;
20764  int s;
20765  int rc;
20766  int xx;
20767  int tmp_port;
20768  int sockerr;
20769  int recv_buf_size=65536;
20770  int optval=1;
20771  struct linger dummy={1,0};
20772  xx = 0;
20773  tsize=size_of_message; /* Number of messages to receive */
20774  s = socket(AF_INET, SOCK_STREAM, 0);
20775  if (s < 0)
20776  {
20777  perror("socket failed:");
20778  exit(19);
20779  }
20780  sockerr = setsockopt (s, SOL_SOCKET, SO_RCVBUF, (char *)
20781  &recv_buf_size, sizeof(int));
20782  if ( sockerr == -1 ) {
20783  perror("Error in setsockopt 3\n");
20784  }
20785  sockerr = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)
20786  &optval, sizeof(int));
20787  if ( sockerr == -1 ) {
20788  perror("Error in setsockopt 4\n");
20789  }
20790  sockerr = setsockopt (s, SOL_SOCKET, SO_LINGER, (char *)
20791  &dummy, sizeof(struct linger));
20792  if ( sockerr == -1 ) {
20793  perror("Error in setsockopt 4\n");
20794  }
20795  bzero(&child_sync_sock, sizeof(struct sockaddr_in));
20796  tmp_port=CHILD_LIST_PORT+chid;
20797  child_sync_sock.sin_port = htons(tmp_port);
20798  child_sync_sock.sin_family = AF_INET;
20799  child_sync_sock.sin_addr.s_addr = INADDR_ANY;
20800  rc = -1;
20801  while (rc < 0)
20802  {
20803  rc = bind(s, (struct sockaddr *)&child_sync_sock,
20804  sizeof(struct sockaddr_in));
20805  if(rc < 0)
20806  {
20807  tmp_port++;
20808  child_sync_sock.sin_port=htons(tmp_port);
20809  continue;
20810  }
20811  }
20812  child_port = ntohs(child_sync_sock.sin_port);
20813  if(cdebug ==1)
20814  {
20815  fprintf(newstdout,"Child %d: Listen: Bound at port %d\n",(int)chid, tmp_port);
20816  fflush(newstdout);
20817  }
20818  if(rc < 0)
20819  {
20820  fprintf(newstdout,"Child bind failed. Errno %d\n",errno);
20821  fflush(newstdout);
20822  exit(20);
20823  }
20824  return(s);
20825 }
rc
Definition: pscanf.h:23
void bzero()
void dummy(void *array)
Definition: do_loops.c:306
int cdebug
Definition: iozone.c:1478
double s
Definition: byte_profile.c:36
long long chid
Definition: iozone.c:1529
int child_port
Definition: iozone.c:1455
FILE * newstdout
Definition: iozone.c:1475
#define CHILD_LIST_PORT
Definition: iozone.c:1416
void exit()
int errno
Here is the call graph for this function:

◆ start_child_listen_async() [1/2]

int start_child_listen_async ( )
Here is the caller graph for this function:

◆ start_child_listen_async() [2/2]

int start_child_listen_async ( int  size_of_message)

Definition at line 20939 of file iozone.c.

20942 {
20943  int tsize;
20944  int s;
20945  int rc;
20946  int xx;
20947  int tmp_port;
20948  int sockerr;
20949  int recv_buf_size=65536;
20950  int optval=1;
20951  xx = 0;
20952  tsize=size_of_message; /* Number of messages to receive */
20953  s = socket(AF_INET, SOCK_STREAM, 0);
20954  if (s < 0)
20955  {
20956  perror("socket failed:");
20957  exit(19);
20958  }
20959  sockerr = setsockopt (s, SOL_SOCKET, SO_RCVBUF, (char *)
20960  &recv_buf_size, sizeof(int));
20961  if ( sockerr == -1 ) {
20962  perror("Error in setsockopt 5\n");
20963  }
20964  sockerr = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)
20965  &optval, sizeof(int));
20966  if ( sockerr == -1 ) {
20967  perror("Error in setsockopt 6\n");
20968  }
20969  bzero(&child_async_sock, sizeof(struct sockaddr_in));
20970  tmp_port=CHILD_ALIST_PORT;
20971  child_async_sock.sin_port = htons(tmp_port);
20972  child_async_sock.sin_family = AF_INET;
20973  child_async_sock.sin_addr.s_addr = INADDR_ANY;
20974  rc = -1;
20975  while (rc < 0)
20976  {
20977  rc = bind(s, (struct sockaddr *)&child_async_sock,
20978  sizeof(struct sockaddr_in));
20979  if(rc < 0)
20980  {
20981  tmp_port++;
20982  child_async_sock.sin_port=htons(tmp_port);
20983  continue;
20984  }
20985  }
20986  child_async_port = ntohs(child_async_sock.sin_port);
20987  if(cdebug ==1)
20988  {
20989  fprintf(newstdout,"Child %d: Async Listen: Bound at port %d\n",
20990  (int)chid,tmp_port);
20991  fflush(newstdout);
20992  }
20993  if(rc < 0)
20994  {
20995  fprintf(newstdout,"bind failed. Errno %d \n",errno);
20996  fflush(newstdout);
20997  exit(20);
20998  }
20999  return(s);
21000 }
rc
Definition: pscanf.h:23
void bzero()
int child_async_port
Definition: iozone.c:1456
int cdebug
Definition: iozone.c:1478
double s
Definition: byte_profile.c:36
long long chid
Definition: iozone.c:1529
FILE * newstdout
Definition: iozone.c:1475
struct sockaddr_in child_sync_sock child_async_sock
Definition: iozone.c:1481
void exit()
int errno
#define CHILD_ALIST_PORT
Definition: iozone.c:1419
Here is the call graph for this function:

◆ start_child_listen_loop()

void start_child_listen_loop ( )

Definition at line 22287 of file iozone.c.

22289 {
22290  int i;
22291  struct child_stats *child_stat;
22292  struct client_command cc;
22293  struct client_neutral_command *cnc;
22294 
22295  client_listen_pid=fork();
22296  if(client_listen_pid!=0)
22297  return;
22298  if(cdebug>=1)
22299  {
22300  fprintf(newstdout,"Child %d starting client listen loop\n",(int)chid);
22301  fflush(newstdout);
22302  }
22303  while(1)
22304  {
22305  bzero(&cc,sizeof(struct client_command));
22308  /*
22309  * Convert from string format to arch format
22310  */
22311  sscanf(cnc->c_command,"%d",&cc.c_command);
22312  sscanf(cnc->c_client_number,"%d",&cc.c_client_number);
22313  sscanf(cnc->c_stop_flag,"%d",&cc.c_stop_flag);
22314 
22315  switch(cc.c_command) {
22316  case R_STOP_FLAG:
22317  i = cc.c_client_number;
22318  if(cdebug)
22319  {
22320  fprintf(newstdout,"child loop: R_STOP_FLAG for client %d\n",i);
22321  fflush(newstdout);
22322  }
22323  child_stat = (struct child_stats *)&shmaddr[i];
22324  *stop_flag = cc.c_stop_flag; /* In shared memory with other copy */
22325  sent_stop=1;
22326  break;
22327  case R_TERMINATE:
22328  if(cdebug)
22329  {
22330  fprintf(newstdout,"Child loop: R_TERMINATE: Client %d \n",
22331  (int)cc.c_client_number);
22332  fflush(newstdout);
22333  }
22334  sleep(2);
22335  /* Aync listener goes away */
22337  exit(0);
22338  case R_DEATH:
22339  if(cdebug)
22340  {
22341  fprintf(newstdout,"Child loop: R_DEATH: Client %d \n",
22342  (int)cc.c_client_number);
22343  fflush(newstdout);
22344  }
22345  i = cc.c_client_number;
22347  sleep(2);
22348  /* Aync listener goes away */
22350  exit(0);
22351  }
22352 
22353  }
22354 }
struct child_stats * child_stat
void bzero()
int client_listen_pid
Definition: iozone.c:1457
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
#define R_DEATH
Definition: iozone.c:744
int l_async_sock
Definition: iozone.c:1459
#define R_TERMINATE
Definition: iozone.c:743
void child_listen_async()
char c_command[20]
Definition: iozone.c:656
char sent_stop
Definition: iozone.c:1304
int cdebug
Definition: iozone.c:1478
char c_client_number[20]
Definition: iozone.c:655
long long chid
Definition: iozone.c:1529
void child_remove_files()
VOLATILE char * stop_flag
Definition: iozone.c:1537
void stop_child_listen()
#define R_STOP_FLAG
Definition: iozone.c:742
FILE * newstdout
Definition: iozone.c:1475
char child_async_rcv_buf[4096]
Definition: iozone.c:1464
void exit()
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start_child_proc() [1/2]

long long start_child_proc ( )
Here is the caller graph for this function:

◆ start_child_proc() [2/2]

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

Definition at line 21286 of file iozone.c.

21290 {
21291  long long x;
21292  if(distributed && master_iozone)
21293  {
21294  x=(long long)pick_client(testnum,numrecs64, reclen);
21295  }
21296  else
21297  {
21298  x=(long long)fork();
21299  }
21300  if(mdebug)
21301  printf("Starting proc %d\n",(int)x);
21302  return(x);
21303 }
int pick_client()
int mdebug
Definition: iozone.c:1479
long long reclen
Definition: iozone.c:1535
char distributed
Definition: iozone.c:1296
char master_iozone
Definition: iozone.c:1296
long long x
Definition: iozone.c:1335
off64_t numrecs64
Definition: iozone.c:1534
Here is the call graph for this function:

◆ start_master_listen()

int start_master_listen ( )

Definition at line 20277 of file iozone.c.

20279 {
20280  int s;
20281  int rc;
20282  int tmp_port;
20283  int sockerr;
20284  struct sockaddr_in addr;
20285  int recv_buf_size=65536*4;
20286  int optval=1;
20287  struct linger dummy={1,0};
20288 
20289  s = socket(AF_INET, SOCK_STREAM, 0);
20290  if (s < 0)
20291  {
20292  perror("socket failed:");
20293  exit(19);
20294  }
20295  sockerr = setsockopt (s, SOL_SOCKET, SO_RCVBUF, (char *)
20296  &recv_buf_size, sizeof(int));
20297  if ( sockerr == -1 ) {
20298  perror("Error in setsockopt 1\n");
20299  }
20300  sockerr = setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *)
20301  &optval, sizeof(int));
20302  if ( sockerr == -1 ) {
20303  perror("Error in setsockopt 2\n");
20304  }
20305  sockerr = setsockopt (s, SOL_SOCKET, SO_LINGER, (char *)
20306  &dummy, sizeof(struct linger));
20307  if ( sockerr == -1 ) {
20308  perror("Error in setsockopt 2\n");
20309  }
20310  tmp_port=HOST_LIST_PORT;
20311  bzero(&addr, sizeof(struct sockaddr_in));
20312  addr.sin_port = htons(tmp_port);
20313  addr.sin_family = AF_INET;
20314  addr.sin_addr.s_addr = INADDR_ANY;
20315  rc = -1;
20316  while (rc < 0)
20317  {
20318  rc = bind(s, (struct sockaddr *)&addr,
20319  sizeof(struct sockaddr_in));
20320  if(rc < 0)
20321  {
20322  tmp_port++;
20323  addr.sin_port=htons(tmp_port);
20324  continue;
20325  }
20326  master_listen_port = ntohs(addr.sin_port);
20327  }
20328  if(rc < 0)
20329  {
20330  perror("bind failed\n");
20331  exit(20);
20332  }
20333 
20334  if(mdebug)
20335  printf("Master listening on socket %d Port %d\n",s,tmp_port);
20336  return(s);
20337 }
rc
Definition: pscanf.h:23
int mdebug
Definition: iozone.c:1479
int master_listen_port
Definition: iozone.c:1472
void bzero()
void dummy(void *array)
Definition: do_loops.c:306
double s
Definition: byte_profile.c:36
#define HOST_LIST_PORT
Definition: iozone.c:1407
void exit()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start_master_listen_loop() [1/2]

void start_master_listen_loop ( )
Here is the caller graph for this function:

◆ start_master_listen_loop() [2/2]

void start_master_listen_loop ( int  num)

Definition at line 22150 of file iozone.c.

22153 {
22154  int i;
22155  struct child_stats *child_stat;
22156  struct master_neutral_command *mnc;
22157  struct master_command mc;
22158  int temp;
22159  struct timespec req,rem;
22160 
22161  req.tv_sec = 0;
22162  req.tv_nsec = 10000000;
22163  rem.tv_sec = 0;
22164  rem.tv_nsec = 10000000;
22165 
22166 
22167  master_join_count=num;
22168  master_listen_pid=fork();
22169  if(master_listen_pid!=0)
22170  return;
22171  if(mdebug>=1)
22172  printf("Starting Master listen loop m %d c %d count %d\n",master_iozone,
22173  client_iozone,num);
22174 
22175  while(master_join_count)
22176  {
22178  mnc=(struct master_neutral_command *)&master_rcv_buf[0];
22179 
22180  /*
22181  * Convert from string format to arch format
22182  */
22183  sscanf(mnc->m_command,"%d",&mc.m_command);
22184  sscanf(mnc->m_client_number,"%d",&mc.m_client_number);
22185  sscanf(mnc->m_client_error,"%d",&mc.m_client_error);
22186  sscanf(mnc->m_mygen,"%d",&mc.m_mygen);
22187  sscanf(mnc->m_version,"%d",&mc.m_version);
22188  if(mc.m_version != proto_version)
22189  {
22190  printf("Client # %d is not running the same version of Iozone !\n",
22191  mc.m_client_number);
22192  }
22193  if(mc.m_client_error != 0)
22194  {
22195  printf("\nClient # %d reporting an error %s !\n",
22196  mc.m_client_number,strerror(mc.m_client_error));
22197  }
22198 #ifdef NO_PRINT_LLD
22199  sscanf(mnc->m_child_flag,"%ld",&mc.m_child_flag);
22200 #else
22201  sscanf(mnc->m_child_flag,"%lld",&mc.m_child_flag);
22202 #endif
22203  sscanf(mnc->m_actual,"%f",&mc.m_actual);
22204  sscanf(mnc->m_throughput,"%f",&mc.m_throughput);
22205  sscanf(mnc->m_cputime,"%f",&mc.m_cputime);
22206  sscanf(mnc->m_walltime,"%f",&mc.m_walltime);
22207  sscanf(mnc->m_stop_flag,"%d",&temp);
22208  mc.m_stop_flag = temp;
22209 
22210  switch(mc.m_command) {
22211  case R_STAT_DATA:
22212  if(mc.m_mygen != mygen)
22213  {
22214  /*
22215  * >>> You are NOT one of my children !!! <<<
22216  * Probably children left behind from another run !!!
22217  * Ignore their messages, and go on without them.
22218  */
22219  printf("*** Unknown Iozone children responding !!! ***\n");
22220  continue;
22221  }
22222  i = mc.m_client_number;
22223  if(mdebug)
22224  printf("loop: R_STAT_DATA for client %d\n",i);
22225  child_stat = (struct child_stats *)&shmaddr[i];
22226  child_stat->flag = mc.m_child_flag;
22227  child_stat->actual = mc.m_actual;
22228  child_stat->throughput = mc.m_throughput;
22229  child_stat->cputime = mc.m_cputime;
22230  child_stat->walltime = mc.m_walltime;
22231  *stop_flag = mc.m_stop_flag;
22233  break;
22234  case R_FLAG_DATA:
22235  if(mc.m_mygen != mygen)
22236  {
22237  /* You are NOT one of my children !!! */
22238  printf("*** Unknown Iozone children responding !!! ***\n");
22239  continue;
22240  }
22241  if(mdebug)
22242  printf("loop: R_FLAG_DATA: Client %d flag %d \n",
22243  (int)mc.m_client_number,
22244  (int)mc.m_child_flag);
22245  i = mc.m_client_number;
22246  child_stat = (struct child_stats *)&shmaddr[i];
22247  child_stat->flag = (long long)(mc.m_child_flag);
22248  break;
22249  case R_STOP_FLAG:
22250  if(mc.m_mygen != mygen)
22251  {
22252  /* You are NOT one of my children !!! */
22253  printf("*** Unknown Iozone children responding !!! ***\n");
22254  continue;
22255  }
22256  if(mdebug)
22257  printf("Master loop: R_STOP_FLAG: Client %d STOP_FLAG \n",
22258  (int)mc.m_client_number);
22259  *stop_flag=1;
22260  distribute_stop();
22261  break;
22262  }
22263 
22264  }
22265  /* Let the clients report results before exiting.
22266  Also, exiting too quickly can close the async
22267  socket to the child, and cause it to become ill.
22268  On Solaris, it gets stuck in a 0=read() loop. */
22269 
22270 #if defined(Windows)
22271  sleep(1);
22272 #else
22273  nanosleep(&req,&rem);
22274 #endif
22275 
22276  exit(0);
22277 }
char m_command[20]
Definition: iozone.c:716
int mdebug
Definition: iozone.c:1479
char m_client_number[20]
Definition: iozone.c:711
__time_t tv_sec
struct child_stats * child_stat
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
char m_throughput[80]
Definition: iozone.c:720
float actual
Definition: iozone.c:463
char m_version[20]
Definition: iozone.c:718
char master_rcv_buf[4096]
Definition: iozone.c:1460
void master_listen()
float throughput
Definition: iozone.c:462
int master_listen_pid
Definition: iozone.c:1461
char client_iozone
Definition: iozone.c:1296
char master_iozone
Definition: iozone.c:1296
char m_client_error[20]
Definition: iozone.c:712
#define R_FLAG_DATA
Definition: iozone.c:733
float cputime
Definition: iozone.c:461
char m_walltime[80]
Definition: iozone.c:722
VOLATILE char * stop_flag
Definition: iozone.c:1537
long long flag
Definition: iozone.c:458
int master_join_count
Definition: iozone.c:1458
void distribute_stop()
Definition: iozone.c:22564
#define R_STOP_FLAG
Definition: iozone.c:742
#define R_STAT_DATA
Definition: iozone.c:732
int proto_version
Definition: iozone.c:1486
int master_listen_socket
Definition: iozone.c:1473
char m_child_flag[80]
Definition: iozone.c:724
float walltime
Definition: iozone.c:460
int mygen
Definition: iozone.c:1524
void exit()
char m_cputime[80]
Definition: iozone.c:721
int i
Definition: fileop.c:140
Here is the call graph for this function:

◆ start_master_send() [1/2]

int start_master_send ( )
Here is the caller graph for this function:

◆ start_master_send() [2/2]

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.

21075 {
21076  int rc,master_socket_val;
21077  struct sockaddr_in addr,raddr;
21078  struct hostent *he;
21079  int port,tmp_port;
21080  int ecount = 0;
21081  struct in_addr *ip;
21082  struct timespec req,rem;
21083 
21084  req.tv_sec = 0;
21085  req.tv_nsec = 10000000;
21086  rem.tv_sec = 0;
21087  rem.tv_nsec = 10000000;
21088 
21089  he = gethostbyname(child_host_name);
21090  if (he == NULL)
21091  {
21092  printf("Master: Bad hostname >%s<\n",child_host_name);
21093  fflush(stdout);
21094  exit(22);
21095  }
21096  if(mdebug ==1)
21097  {
21098  printf("Master: start master send: %s\n", he->h_name);
21099  fflush(stdout);
21100  }
21101  ip = (struct in_addr *)he->h_addr_list[0];
21102 #ifndef UWIN
21103  if(mdebug ==1)
21104  {
21105  printf("Master: child name: %s\n", (char *)inet_ntoa(*ip));
21106  printf("Master: child Port: %d\n", child_port);
21107  fflush(stdout);
21108  }
21109 #endif
21110 
21111  port=child_port;
21112  my_s_addr->s_addr = ip->s_addr;
21113  /*port=CHILD_LIST_PORT;*/
21114 
21115  raddr.sin_family = AF_INET;
21116  raddr.sin_port = htons(port);
21117  raddr.sin_addr.s_addr = ip->s_addr;
21118  master_socket_val = socket(AF_INET, SOCK_STREAM, 0);
21119  if (master_socket_val < 0)
21120  {
21121  perror("Master: socket failed:");
21122  exit(23);
21123  }
21124  bzero(&addr, sizeof(struct sockaddr_in));
21125  tmp_port=HOST_ESEND_PORT;
21126  addr.sin_port = htons(tmp_port);
21127  addr.sin_family = AF_INET;
21128  addr.sin_addr.s_addr = INADDR_ANY;
21129  rc = -1;
21130  while (rc < 0)
21131  {
21132  rc = bind(master_socket_val, (struct sockaddr *)&addr,
21133  sizeof(struct sockaddr_in));
21134  if(rc < 0)
21135  {
21136  tmp_port++;
21137  addr.sin_port=htons(tmp_port);
21138  continue;
21139  }
21140  }
21141  if(mdebug ==1)
21142  {
21143  printf("Master: Bound port\n");
21144  fflush(stdout);
21145  }
21146  if (rc < 0)
21147  {
21148  perror("Master: bind failed for sync channel to child.\n");
21149  exit(24);
21150  }
21151  nanosleep(&req,&rem);
21152 again:
21153  rc = connect(master_socket_val, (struct sockaddr *)&raddr,
21154  sizeof(struct sockaddr_in));
21155  if (rc < 0)
21156  {
21157  if(ecount++ < 300)
21158  {
21159  nanosleep(&req,&rem);
21160  /*sleep(1);*/
21161  goto again;
21162  }
21163  perror("Master: connect failed\n");
21164  printf("Error %d\n",errno);
21165  exit(25);
21166  }
21167  if(mdebug ==1)
21168  {
21169  printf("Master Connected\n");
21170  fflush(stdout);
21171  }
21172  return (master_socket_val);
21173 }
rc
Definition: pscanf.h:23
int mdebug
Definition: iozone.c:1479
#define HOST_ESEND_PORT
Definition: iozone.c:1408
__time_t tv_sec
void bzero()
char * inet_ntoa()
int ecount
Definition: iozone.c:1310
int child_port
Definition: iozone.c:1455
void exit()
int errno
Here is the call graph for this function:

◆ start_master_send_async()

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.

21189 {
21190  int rc,master_socket_val;
21191  struct sockaddr_in addr,raddr;
21192  int port,tmp_port;
21193  int ecount = 0;
21194  struct timespec req,rem;
21195 
21196  req.tv_sec = 0;
21197  req.tv_nsec = 10000000;
21198  rem.tv_sec = 0;
21199  rem.tv_nsec = 10000000;
21200 
21201 
21202  port=child_port;
21203  nanosleep(&req,&rem);
21204 
21205 over:
21206  raddr.sin_family = AF_INET;
21207  raddr.sin_port = htons(port);
21208  raddr.sin_addr.s_addr = my_s_addr.s_addr;
21209  master_socket_val = socket(AF_INET, SOCK_STREAM, 0);
21210  if (master_socket_val < 0)
21211  {
21212  perror("Master: async socket failed:");
21213  exit(23);
21214  }
21215  bzero(&addr, sizeof(struct sockaddr_in));
21216  tmp_port=HOST_ASEND_PORT;
21217  addr.sin_port = htons(tmp_port);
21218  addr.sin_family = AF_INET;
21219  addr.sin_addr.s_addr = INADDR_ANY;
21220  rc = -1;
21221  while (rc < 0)
21222  {
21223  rc = bind(master_socket_val, (struct sockaddr *)&addr,
21224  sizeof(struct sockaddr_in));
21225  if(rc < 0)
21226  {
21227  tmp_port++;
21228  addr.sin_port=htons(tmp_port);
21229  continue;
21230  }
21231  }
21232  if(mdebug ==1)
21233  {
21234  printf("Master: Bound async port\n");
21235  fflush(stdout);
21236  }
21237  if (rc < 0)
21238  {
21239  perror("Master: bind async failed\n");
21240  exit(24);
21241  }
21242 again:
21243 
21244  rc = connect(master_socket_val, (struct sockaddr *)&raddr,
21245  sizeof(struct sockaddr_in));
21246  if (rc < 0)
21247  {
21248  if(ecount++ < 300)
21249  {
21250  /* Really need this sleep for Windows */
21251 #if defined (Windows)
21252  sleep(1);
21253 #else
21254  nanosleep(&req,&rem);
21255 #endif
21256  goto again;
21257  }
21258  perror("Master: async connect failed\n");
21259  close(master_socket_val);
21260 #if defined (Windows)
21261  sleep(1);
21262 #else
21263  nanosleep(&req,&rem);
21264 #endif
21265  /*sleep(1);*/
21266  ecount=0;
21267  goto over;
21268  }
21269  if(mdebug ==1)
21270  {
21271  printf("Master async Connected\n");
21272  fflush(stdout);
21273  }
21274  return (master_socket_val);
21275 }
rc
Definition: pscanf.h:23
int mdebug
Definition: iozone.c:1479
__time_t tv_sec
void bzero()
#define HOST_ASEND_PORT
Definition: iozone.c:1409
int ecount
Definition: iozone.c:1310
int child_port
Definition: iozone.c:1455
int close()
void exit()
Here is the caller graph for this function:

◆ start_monitor()

start_monitor ( char *  test)

Definition at line 23678 of file iozone.c.

23681 {
23682  char command_line[256];
23683  if(strlen(imon_start)!=0)
23684  {
23685  if(imon_sync)
23686  sprintf(command_line,"%s %s",imon_start,test);
23687  else
23688  sprintf(command_line,"%s %s&",imon_start,test);
23690  }
23691 }
char imon_sync
Definition: iozone.c:1319
int junk
Definition: iozone.c:1402
char imon_start[256]
Definition: iozone.c:1318
char command_line[1024]
Definition: iozone.c:1387
int system()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop_child_listen() [1/2]

void stop_child_listen ( )
Here is the caller graph for this function:

◆ stop_child_listen() [2/2]

void stop_child_listen ( int  child_socket_val)

Definition at line 20693 of file iozone.c.

20696 {
20697  close(child_socket_val);
20698 }
int close()
Here is the call graph for this function:

◆ stop_child_send()

void stop_child_send ( )

◆ stop_master_listen() [1/2]

void stop_master_listen ( )
Here is the caller graph for this function:

◆ stop_master_listen() [2/2]

void stop_master_listen ( int  master_socket_val)

Definition at line 20723 of file iozone.c.

20726 {
20727  if(mdebug)
20728  printf("Stop master listen\n");
20729 /*
20730  shutdown(master_socket_val,SHUT_RDWR);
20731 */
20732  close(master_socket_val);
20733  master_socket_val = 0;
20734 }
int mdebug
Definition: iozone.c:1479
int close()
Here is the call graph for this function:

◆ stop_master_listen_loop()

void stop_master_listen_loop ( )

Definition at line 22064 of file iozone.c.

22066 {
22067  if(mdebug>=1)
22068  printf("Stopping Master listen loop");
22069  kill(master_listen_pid,SIGKILL);
22070 }
int mdebug
Definition: iozone.c:1479
int master_listen_pid
Definition: iozone.c:1461
int kill(__pid_t __pid, int __sig) __attribute__((__nothrow__
Here is the call graph for this function:

◆ stop_master_send() [1/2]

void stop_master_send ( )

◆ stop_master_send() [2/2]

void stop_master_send ( int  child_socket_val)

Definition at line 20744 of file iozone.c.

20747 {
20748  close(child_socket_val);
20749 }
int close()
Here is the call graph for this function:

◆ stop_monitor()

stop_monitor ( char *  test)

Definition at line 23696 of file iozone.c.

23699 {
23700  char command_line[256];
23701  if(strlen(imon_stop)!=0)
23702  {
23703  if(imon_sync)
23704  sprintf(command_line,"%s %s",imon_stop,test);
23705  else
23706  sprintf(command_line,"%s %s &",imon_stop,test);
23708  }
23709 }
char imon_sync
Definition: iozone.c:1319
int junk
Definition: iozone.c:1402
char imon_stop[256]
Definition: iozone.c:1318
char command_line[1024]
Definition: iozone.c:1387
int system()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ store_dvalue() [1/2]

void store_dvalue ( )
Here is the caller graph for this function:

◆ store_dvalue() [2/2]

void store_dvalue ( double  value)

Definition at line 18780 of file iozone.c.

18783 {
18785  current_x++;
18786  if(current_x > max_x)
18787  max_x=current_x;
18788  if(current_y > max_y)
18789  max_y=current_y;
18790  if(max_x >= MAX_X)
18791  {
18792  printf("\nMAX_X too small\n");
18793  exit(163);
18794  }
18795  if(max_y >= MAXSTREAMS)
18796  {
18797  printf("\nMAXSTREAMS too small\n");
18798  exit(164);
18799  }
18800 }
long long max_y
Definition: iozone.c:1275
#define MAX_X
Definition: iozone.c:825
short current_x
Definition: iozone.c:1273
double report_darray[MAX_X][MAXSTREAMS]
Definition: iozone.c:1270
void exit()
#define MAXSTREAMS
Definition: iozone.c:813
short current_y
Definition: iozone.c:1273
long long max_x
Definition: iozone.c:1275
Here is the call graph for this function:

◆ store_times()

store_times ( double  walltime,
double  cputime 
)

Definition at line 11551 of file iozone.c.

11554 {
11555  runtimes [current_x][current_y].walltime = walltime;
11556  runtimes [current_x][current_y].cputime = cputime;
11557  runtimes [current_x][current_y].cpuutil = cpu_util(cputime, walltime);
11558 }
float cpuutil
Definition: iozone.c:472
float walltime
Definition: iozone.c:470
struct runtime runtimes[MAX_X][MAX_Y]
Definition: iozone.c:1330
float cputime
Definition: iozone.c:471
short current_x
Definition: iozone.c:1273
static double cpu_util()
short current_y
Definition: iozone.c:1273
Here is the call graph for this function:
Here is the caller graph for this function:

◆ store_value()

store_value ( off64_t  value)

Definition at line 11518 of file iozone.c.

11521 {
11523  current_x++;
11524  if(current_x > max_x)
11525  max_x=current_x;
11526  if(current_y > max_y)
11527  max_y=current_y;
11528  if(max_x >= MAX_X)
11529  {
11530  printf("\nMAX_X too small\n");
11531  exit(117);
11532  }
11533  if(max_y >= MAX_Y)
11534  {
11535  printf("\nMAX_Y too small\n");
11536  exit(118);
11537  }
11538 }
long long max_y
Definition: iozone.c:1275
#define MAX_Y
Definition: iozone.c:827
#define MAX_X
Definition: iozone.c:825
short current_x
Definition: iozone.c:1273
off64_t report_array[MAX_X][MAX_Y]
Definition: iozone.c:1269
void exit()
short current_y
Definition: iozone.c:1273
long long max_x
Definition: iozone.c:1275
Here is the call graph for this function:
Here is the caller graph for this function:

◆ system()

int system ( )
Here is the caller graph for this function:

◆ tell_children_begin() [1/2]

void tell_children_begin ( )
Here is the caller graph for this function:

◆ tell_children_begin() [2/2]

void tell_children_begin ( long long  childnum)

Definition at line 22365 of file iozone.c.

22368 {
22369  struct client_command cc;
22370  int x;
22371  bzero(&cc,sizeof(struct client_command));
22372  x = (int) childnum;
22373  if(mdebug>=1)
22374  printf("Master: Tell child %d to begin\n",x);
22375  cc.c_command = R_FLAG_DATA;
22376  cc.c_child_flag = CHILD_STATE_BEGIN;
22377  cc.c_client_number = (int)childnum;
22378  master_send(master_send_sockets[x],child_idents[x].child_name, &cc,sizeof(struct client_command));
22379 }
int mdebug
Definition: iozone.c:1479
void bzero()
void master_send()
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
#define R_FLAG_DATA
Definition: iozone.c:733
struct child_ident child_idents[MAXSTREAMS]
long long x
Definition: iozone.c:1335
int master_send_sockets[MAXSTREAMS]
Definition: iozone.c:1470
Here is the call graph for this function:

◆ tell_master_ready() [1/2]

void tell_master_ready ( )
Here is the caller graph for this function:

◆ tell_master_ready() [2/2]

void tell_master_ready ( long long  chid)

Definition at line 22082 of file iozone.c.

22085 {
22086  struct master_command mc;
22087  bzero(&mc,sizeof(struct master_command));
22088  if(cdebug>=1)
22089  {
22090  fprintf(newstdout,"Child %d: Tell master to go\n",(int)chid);
22091  fflush(newstdout);
22092  }
22093  mc.m_command = R_FLAG_DATA;
22094  mc.m_mygen = mygen;
22095  mc.m_version = proto_version;
22096  mc.m_child_flag = CHILD_STATE_READY;
22097  mc.m_client_number = (int)chid;
22098  mc.m_client_error = client_error;
22099  child_send(controlling_host_name,(struct master_command *)&mc, sizeof(struct master_command));
22100 }
char controlling_host_name[100]
Definition: iozone.c:1493
void bzero()
void child_send()
#define R_FLAG_DATA
Definition: iozone.c:733
int cdebug
Definition: iozone.c:1478
long long chid
Definition: iozone.c:1529
FILE * newstdout
Definition: iozone.c:1475
int proto_version
Definition: iozone.c:1486
int mygen
Definition: iozone.c:1524
int client_error
Definition: iozone.c:1398
#define CHILD_STATE_READY
Definition: iozone.c:944
Here is the call graph for this function:

◆ tell_master_stats() [1/2]

void tell_master_stats ( )
Here is the caller graph for this function:

◆ tell_master_stats() [2/2]

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.

22031 {
22032  struct master_command mc;
22033  bzero(&mc,sizeof(struct master_command));
22034  mc.m_client_number = (int) chid;
22035  mc.m_client_error = (int) client_error;
22036  mc.m_throughput= throughput;
22037  mc.m_testnum = testnum;
22038  mc.m_actual = actual;
22039  mc.m_cputime = cpu_time;
22040  mc.m_walltime = wall_time;
22041  mc.m_stop_flag = stop_flag;
22042  mc.m_child_flag = child_flag;
22043  mc.m_command = R_STAT_DATA;
22044  mc.m_mygen = mygen;
22045  mc.m_version = proto_version;
22046  if(cdebug>=1)
22047  {
22048  fprintf(newstdout,"Child %d: Tell master stats and terminate\n",(int)chid);
22049  fflush(newstdout);
22050  }
22051  child_send(controlling_host_name,(struct master_command *)&mc, sizeof(struct master_command));
22052 }
char controlling_host_name[100]
Definition: iozone.c:1493
void bzero()
void child_send()
int cdebug
Definition: iozone.c:1478
long long chid
Definition: iozone.c:1529
VOLATILE char * stop_flag
Definition: iozone.c:1537
FILE * newstdout
Definition: iozone.c:1475
#define R_STAT_DATA
Definition: iozone.c:732
int proto_version
Definition: iozone.c:1486
int mygen
Definition: iozone.c:1524
int client_error
Definition: iozone.c:1398
Here is the call graph for this function:

◆ terminate_child_async()

void terminate_child_async ( )

Definition at line 22538 of file iozone.c.

22540 {
22541  int i;
22542  struct client_command cc;
22543  bzero(&cc,sizeof(struct client_command));
22544  cc.c_command = R_TERMINATE;
22545  for(i=0;i<num_child;i++)
22546  {
22548  cc.c_client_number = (int)i;
22549  if(mdebug)
22550  printf("Master terminating async channels to children.\n");
22551  master_send(master_send_async_sockets[i],child_idents[i].child_name, &cc,sizeof(struct client_command));
22552  }
22553 }
#define C_STATE_ZERO
Definition: iozone.c:1449
int mdebug
Definition: iozone.c:1479
void bzero()
void master_send()
int state
Definition: iozone.c:1499
int master_send_async_sockets[MAXSTREAMS]
Definition: iozone.c:1471
#define R_TERMINATE
Definition: iozone.c:743
struct child_ident child_idents[MAXSTREAMS]
long long num_child
Definition: iozone.c:1335
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ thread_cleanup_test() [1/2]

void*() thread_cleanup_test ( )
Here is the caller graph for this function:

◆ thread_cleanup_test() [2/2]

void* thread_cleanup_test ( x  )

Definition at line 18369 of file iozone.c.

18371 {
18372  long long xx;
18373  struct child_stats *child_stat;
18374  char *dummyfile[MAXSTREAMS]; /* name of dummy file */
18375 
18376 
18377 #ifdef NO_THREADS
18378  xx=chid;
18379 #else
18380  if(use_thread)
18381  xx = (long long)((long)x);
18382  else
18383  {
18384  xx=chid;
18385  }
18386 #endif
18387  dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
18388  if(mfflag)
18389  {
18390 #ifdef NO_PRINT_LLD
18391  sprintf(dummyfile[xx],"%s",filearray[xx]);
18392 #else
18393  sprintf(dummyfile[xx],"%s",filearray[xx]);
18394 #endif
18395  }
18396  else
18397  {
18398 #ifdef NO_PRINT_LLD
18399  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx],xx);
18400 #else
18401  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx],xx);
18402 #endif
18403  }
18404  if(!no_unlink)
18405  {
18406  if(check_filename(dummyfile[xx]))
18407  unlink(dummyfile[xx]);
18408  }
18409 
18410  child_stat = (struct child_stats *)&shmaddr[xx];
18411  /*****************/
18412  /* Children only */
18413  /*****************/
18414  child_stat=(struct child_stats *)&shmaddr[xx];
18416  if(distributed && client_iozone)
18417  {
18420  }
18421  else
18422  {
18423  while(child_stat->flag!=CHILD_STATE_BEGIN) /* Wait for signal from parent */
18424  Poll((long long)1);
18425  }
18426 
18427  *stop_flag=1;
18428  if(distributed && client_iozone)
18429  send_stop();
18430  if(distributed && client_iozone)
18432  child_stat->actual,
18434  (char)*stop_flag,
18435  (long long)CHILD_STATE_HOLD);
18436  child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
18437  free(dummyfile[xx]);
18438 
18439  if(distributed && client_iozone)
18440  return(0);
18441 #ifdef NO_THREADS
18442  exit(0);
18443 #else
18444  if(use_thread)
18445  thread_exit();
18446  else
18447  exit(0);
18448 #endif
18449 return(0);
18450 }
int check_filename()
#define CHILD_STATE_HOLD
Definition: iozone.c:942
struct child_stats * child_stat
int no_unlink
Definition: iozone.c:1521
void tell_master_stats()
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
#define MAXNAMESIZE
Definition: iozone.c:833
float actual
Definition: iozone.c:463
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
int thread_exit()
Definition: iozone.c:18526
char distributed
Definition: iozone.c:1296
char use_thread
Definition: iozone.c:1372
float throughput
Definition: iozone.c:462
char client_iozone
Definition: iozone.c:1296
void wait_for_master_go()
float cputime
Definition: iozone.c:461
long long chid
Definition: iozone.c:1529
void tell_master_ready()
char mfflag
Definition: iozone.c:1334
long long x
Definition: iozone.c:1335
VOLATILE char * stop_flag
Definition: iozone.c:1537
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
#define THREAD_CLEANUP_TEST
Definition: iozone.c:1442
long long flag
Definition: iozone.c:458
void send_stop()
Definition: iozone.c:22607
void Poll()
float walltime
Definition: iozone.c:460
int unlink()
void exit()
#define MAXSTREAMS
Definition: iozone.c:813
#define CHILD_STATE_READY
Definition: iozone.c:944
Here is the call graph for this function:

◆ thread_exit()

int thread_exit ( )

Definition at line 18526 of file iozone.c.

18528 {
18529  pthread_exit((void *)NULL);
18530 return(0);
18531 }
Here is the caller graph for this function:

◆ thread_fread_test() [1/2]

void*() thread_fread_test ( )
Here is the caller graph for this function:

◆ thread_fread_test() [2/2]

void* thread_fread_test ( x  )

Definition at line 24871 of file iozone.c.

24873 {
24874  struct child_stats *child_stat;
24875  double starttime1 = 0;
24876  double temp_time;
24877  double hist_time;
24878  double desired_op_rate_time;
24879  double actual_rate;
24880  double walltime, cputime;
24881  double compute_val = (double)0;
24882  float delay = (float)0;
24883  double thread_qtime_stop,thread_qtime_start;
24884  off64_t traj_offset;
24885  long long w_traj_bytes_completed;
24886  long long w_traj_ops_completed;
24887  FILE *w_traj_fd;
24888  int fd;
24889  long long recs_per_buffer;
24890  long long stopped,i;
24891  off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far;
24892  long long xx,xx2;
24893  char *dummyfile [MAXSTREAMS]; /* name of dummy file */
24894  char *nbuff;
24895  char *maddr;
24896  char *wmaddr,*free_addr;
24897  char now_string[30];
24898  int anwser,bind_cpu;
24899 #if defined(VXFS) || defined(solaris)
24900  int test_foo = 0;
24901 #endif
24903  char tmpname[256];
24904  FILE *thread_wqfd;
24905  FILE *thread_Lwqfd;
24906 
24907  if(compute_flag)
24909  nbuff=maddr=wmaddr=free_addr=0;
24910  thread_qtime_stop=thread_qtime_start=0;
24911  thread_wqfd=w_traj_fd=thread_Lwqfd=(FILE *)0;
24912  traj_offset=walltime=cputime=0;
24913  anwser=bind_cpu=0;
24914  char *stdio_buf;
24915  long long Index = 0;
24916  FILE *stream = NULL;
24917  char *filename;
24918 
24919  if(w_traj_flag)
24920  {
24923  }
24924  else
24925  {
24927  }
24928  written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
24930  recs_per_buffer = cache_size/reclen ;
24931 #ifdef NO_THREADS
24932  xx=chid;
24933 #else
24934  if(use_thread)
24935  {
24936  xx = (long long)((long)x);
24937  }
24938  else
24939  {
24940  xx=chid;
24941  }
24942 #endif
24943 #ifndef NO_THREADS
24944 #ifdef _HPUX_SOURCE
24945  if(ioz_processor_bind)
24946  {
24947  bind_cpu=(begin_proc+(int)xx)%num_processors;
24948  pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
24949  (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
24950  my_nap(40); /* Switch to new cpu */
24951  }
24952 #endif
24953 #endif
24954  if(use_thread)
24955  nbuff=barray[xx];
24956  else
24957  nbuff=buffer;
24958  if(debug1 )
24959  {
24960  if(use_thread)
24961 #ifdef NO_PRINT_LLD
24962  printf("\nStarting child %ld\n",xx);
24963 #else
24964  printf("\nStarting child %lld\n",xx);
24965 #endif
24966  else
24967 #ifdef NO_PRINT_LLD
24968  printf("\nStarting process %d slot %ld\n",getpid(),xx);
24969 #else
24970  printf("\nStarting process %d slot %lld\n",getpid(),xx);
24971 #endif
24972 
24973  }
24974  dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
24975  xx2=xx;
24976  if(share_file)
24977  xx2=(long long)0;
24978  if(mfflag)
24979  {
24980 #ifdef NO_PRINT_LLD
24981  sprintf(dummyfile[xx],"%s",filearray[xx2]);
24982 #else
24983  sprintf(dummyfile[xx],"%s",filearray[xx2]);
24984 #endif
24985  }
24986  else
24987  {
24988 #ifdef NO_PRINT_LLD
24989  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
24990 #else
24991  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
24992 #endif
24993  }
24994 
24995  filename=dummyfile[xx];
24996 
24997  if(mmapflag || async_flag)
24998  return(0);
24999 
25000  stdio_buf=(char *)malloc((size_t)reclen);
25001 
25002  if(Uflag) /* Unmount and re-mount the mountpoint */
25003  {
25005  }
25006 #ifdef IRIX64
25007  if((stream=(FILE *)fopen(filename,"r")) == 0)
25008  {
25009  printf("\nCan not fdopen temp file: %s\n",
25010  filename);
25011  perror("fdopen");
25012  exit(51);
25013  }
25014 #else
25015  if((stream=(FILE *)I_FOPEN(filename,"r")) == 0)
25016  {
25017  printf("\nCan not fdopen temp file: %s\n",
25018  filename);
25019  perror("fdopen");
25020  exit(52);
25021  }
25022 #endif
25023  fd=I_OPEN(filename,O_RDONLY,0);
25024  fsync(fd);
25025  close(fd);
25026  if(direct_flag)
25027  setvbuf(stream,stdio_buf,_IONBF,reclen);
25028  else
25029  setvbuf(stream,stdio_buf,_IOFBF,reclen);
25030 
25032  if(fetchon)
25034  compute_val=(double)0;
25035 
25036  /*******************************************************************/
25037  /*******************************************************************/
25038 
25039  child_stat = (struct child_stats *)&shmaddr[xx];
25040  child_stat->throughput = 0;
25041  child_stat->actual = 0;
25042  child_stat->flag=CHILD_STATE_READY; /* Tell parent child is ready to go */
25043 
25044  if(distributed && client_iozone)
25046  if(distributed && client_iozone)
25047  {
25048  if(cdebug)
25049  {
25050  printf("Child %d waiting for go from master\n",(int)xx);
25051  fflush(stdout);
25052  }
25054  if(cdebug)
25055  {
25056  printf("Child %d received go from master\n",(int)xx);
25057  fflush(stdout);
25058  }
25059  }
25060  else
25061  {
25062  while(child_stat->flag!=CHILD_STATE_BEGIN) /* Wait for signal from parent */
25063  Poll((long long)1);
25064  }
25065 
25066  written_so_far=0;
25067  child_stat = (struct child_stats *)&shmaddr[xx];
25068  child_stat->actual = 0;
25069  child_stat->throughput = 0;
25070  stopped=0;
25071  if(Q_flag)
25072  {
25073  sprintf(tmpname,"Child_%d_frol.dat",(int)xx);
25074  thread_wqfd=fopen(tmpname,"a");
25075  if(thread_wqfd==0)
25076  {
25078  if(distributed && client_iozone)
25079  send_stop();
25080  printf("Unable to open %s\n",tmpname);
25081  exit(40);
25082  }
25083  fprintf(thread_wqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
25084  }
25085  if(L_flag)
25086  {
25087  sprintf(tmpname,"Child_%d.log",(int)xx);
25088  thread_Lwqfd=fopen(tmpname,"a");
25089  if(thread_Lwqfd==0)
25090  {
25092  if(distributed && client_iozone)
25093  send_stop();
25094  printf("Unable to open %s\n",tmpname);
25095  exit(40);
25096  }
25097  get_date(now_string);
25098  fprintf(thread_Lwqfd,"%-25s %s","fread test start: ",now_string);
25099  }
25100  starttime1 = time_so_far();
25101  if(cpuutilflag)
25102  {
25103  walltime = starttime1;
25104  cputime = cputime_so_far();
25105  }
25106 
25107 
25108 
25109  /*******************************************************************/
25110 
25111  for(i=0; i<numrecs64; i++)
25112  {
25113  if(compute_flag)
25114  compute_val+=do_compute(compute_time);
25115  if(multi_buffer)
25116  {
25117  Index +=reclen;
25118  if(Index > (MAXBUFFERSIZE-reclen))
25119  Index=0;
25120  buffer = mbuffer + Index;
25121  }
25122  if(purge)
25124  if(Q_flag || hist_summary || op_rate_flag)
25125  {
25126  thread_qtime_start=time_so_far();
25127  }
25128  if(fread(buffer, (size_t) reclen,1, stream) != 1)
25129  {
25130 #ifdef _64BIT_ARCH_
25131 #ifdef NO_PRINT_LLD
25132  printf("\nError freading block %ld %x\n", i,
25133  (unsigned long)buffer);
25134 #else
25135  printf("\nError freading block %lld %llx\n", i,
25136  (unsigned long long)buffer);
25137 #endif
25138 #else
25139 #ifdef NO_PRINT_LLD
25140  printf("\nError freading block %ld %lx\n", i,
25141  (long)buffer);
25142 #else
25143  printf("\nError freading block %lld %lx\n", i,
25144  (long)buffer);
25145 #endif
25146 #endif
25147  perror("read");
25148  exit(54);
25149  }
25150  if(verify){
25152  exit(55);
25153  }
25154  }
25155  if(hist_summary)
25156  {
25157  thread_qtime_stop=time_so_far();
25158  hist_time =(thread_qtime_stop-thread_qtime_start);
25159  hist_insert(hist_time);
25160  }
25161  if(op_rate_flag)
25162  {
25163  thread_qtime_stop=time_so_far();
25164  desired_op_rate_time = ((double)1.0/(double)op_rate);
25165  actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
25166  if( actual_rate < desired_op_rate_time)
25167  my_unap((unsigned long long)((desired_op_rate_time-actual_rate)*1000000.0 ));
25168  }
25169  if(Q_flag)
25170  {
25171  thread_qtime_stop=time_so_far();
25172 #ifdef NO_PRINT_LLD
25173  fprintf(thread_wqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
25174 #else
25175  fprintf(thread_wqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
25176 #endif
25177  }
25180  written_so_far+=reclen/1024;
25181 
25182  }
25183  if(include_flush)
25184  fflush(stream);
25185  if(include_close)
25186  {
25187  fclose(stream);
25188  }
25189 
25190  /*******************************************************************/
25191 
25192  if(!stopped){
25193  temp_time = time_so_far();
25194  child_stat->throughput = ((temp_time - starttime1)-time_res)
25195  -compute_val;
25196  if(child_stat->throughput < (double).000001)
25197  {
25199  if(rec_prob < reclen)
25200  rec_prob = reclen;
25201  res_prob=1;
25202  }
25203 
25204  if(OPS_flag){
25205  /*written_so_far=(written_so_far*1024)/reclen;*/
25206  written_so_far=w_traj_ops_completed;
25207  }
25209  (double)written_so_far/child_stat->throughput;
25210  child_stat->actual = (double)written_so_far;
25211  }
25212  if(cdebug)
25213  {
25214  printf("Child %d: throughput %f actual %f \n",(int)chid, child_stat->throughput,
25215  child_stat->actual);
25216  fflush(stdout);
25217  }
25218  if(cpuutilflag)
25219  {
25221  if (cputime < cputime_res)
25222  cputime = 0.0;
25226  }
25227  if(distributed && client_iozone)
25229  child_stat->actual,
25231  (char)*stop_flag,
25232  (long long)CHILD_STATE_HOLD);
25233 
25234  if (debug1) {
25235  printf(" child/slot: %lld, wall-cpu: %8.3f %8.3fC" " -> %6.2f%%\n",
25236  xx, walltime, cputime,
25238  }
25239  child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
25240  stopped=0;
25241 
25242  /*******************************************************************/
25243  /* End fead performance test. *************************************/
25244  /*******************************************************************/
25245 
25246  if(debug1)
25247 #ifdef NO_PRINT_LLD
25248  printf("\nChild finished %ld\n",xx);
25249 #else
25250  printf("\nChild finished %lld\n",xx);
25251 #endif
25252  if(Q_flag && (thread_wqfd !=0) )
25253  fclose(thread_wqfd);
25254  free(dummyfile[xx]);
25255  if(w_traj_flag)
25256  fclose(w_traj_fd);
25257 
25258  if(L_flag)
25259  {
25260  get_date(now_string);
25261  fprintf(thread_Lwqfd,"%-25s %s","Fread test finished: ",now_string);
25262  fclose(thread_Lwqfd);
25263  }
25264 
25265  /*******************************************************************/
25266 
25267  if(!include_close)
25268  {
25269  fflush(stream);
25270  fclose(stream);
25271  }
25272  stream = NULL;
25273 
25274  if(restf)
25275  sleep((int)(int)rest_val);
25276 
25277  free(stdio_buf);
25278  if(OPS_flag || MS_flag){
25280  }
25281 
25282  /*******************************************************************/
25283  if(hist_summary)
25284  dump_hist("Fread",(int)xx);
25285  if(distributed && client_iozone)
25286  return(0);
25287 #ifdef NO_THREADS
25288  exit(0);
25289 #else
25290  if(use_thread)
25291  thread_exit();
25292  else
25293  exit(0);
25294 #endif
25295 
25296 return(0);
25297 }
void fetchit()
void purgeit()
long long rec_prob
Definition: iozone.c:1294
int w_traj_flag
Definition: iozone.c:1523
char compute_flag
Definition: iozone.c:1520
#define CHILD_STATE_HOLD
Definition: iozone.c:942
char verify
Definition: iozone.c:1513
struct child_stats * child_stat
long long w_traj_bytes_completed
Definition: iozone.c:1327
void tell_master_stats()
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
char mmapflag
Definition: iozone.c:1512
#define MAXNAMESIZE
Definition: iozone.c:833
int fd
Definition: iozone.c:1291
int restf
Definition: iozone.c:1514
float actual
Definition: iozone.c:463
char * barray[MAXSTREAMS]
Definition: iozone.c:1287
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)
Definition: appio.c:275
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
void get_date()
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
long long multi_buffer
Definition: iozone.c:1290
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
#define THREAD_FREAD_TEST
Definition: iozone.c:1441
int thread_exit()
Definition: iozone.c:18526
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long w_traj_ops_completed
Definition: iozone.c:1327
long long reclen
Definition: iozone.c:1535
int num_processors
Definition: iozone.c:1293
long long w_traj_fsize
Definition: iozone.c:1325
int op_rate
Definition: iozone.c:1301
char distributed
Definition: iozone.c:1296
char use_thread
Definition: iozone.c:1372
float compute_time
Definition: iozone.c:1538
float throughput
Definition: iozone.c:462
char Uflag
Definition: iozone.c:1329
char * mbuffer
Definition: iozone.c:1366
char client_iozone
Definition: iozone.c:1296
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
long long debug1
Definition: iozone.c:1373
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
void wait_for_master_go()
long long delay
Definition: iozone.c:1533
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
float cputime
Definition: iozone.c:461
int cdebug
Definition: iozone.c:1478
char * mainbuffer
Definition: iozone.c:1366
long long w_traj_ops
Definition: iozone.c:1325
int begin_proc
Definition: iozone.c:1293
int op_rate_flag
Definition: iozone.c:1302
long long chid
Definition: iozone.c:1529
purge_buffer_cache()
Definition: iozone.c:12274
char L_flag
Definition: iozone.c:1518
void tell_master_ready()
char mfflag
Definition: iozone.c:1334
long long x
Definition: iozone.c:1335
VOLATILE char * stop_flag
Definition: iozone.c:1537
#define MAXBUFFERSIZE
Definition: iozone.c:809
char * buffer
Definition: iozone.c:1366
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
off64_t numrecs64
Definition: iozone.c:1534
long long flag
Definition: iozone.c:458
int share_file
Definition: iozone.c:1309
long long verify_buffer(char *buffer, long long length, off64_t recnum, long long recsize, unsigned long long patt, char sverify)
Definition: iozone.c:6940
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
static double cpu_util()
int close()
FILE * w_traj_fd
Definition: iozone.c:1367
void send_stop()
Definition: iozone.c:22607
#define cputime_so_far()
Definition: iozone.c:973
void my_nap()
void Poll()
float walltime
Definition: iozone.c:460
void dump_hist()
char Q_flag
Definition: iozone.c:1517
long long res_prob
Definition: iozone.c:1294
int ioz_processor_bind
Definition: iozone.c:1293
double temp_time
Definition: iozone.c:1268
static double time_so_far()
Definition: iozone.c:6844
void my_unap()
char include_close
Definition: iozone.c:1519
void hist_insert()
char OPS_flag
Definition: iozone.c:1517
int client_error
Definition: iozone.c:1398
void exit()
setvbuf(file, file_buf, _IOFBF, sizeof(file_buf))
int fsync()
double cputime_res
Definition: iozone.c:1271
#define MAXSTREAMS
Definition: iozone.c:813
long long rest_val
Definition: iozone.c:1540
long long off64_t
Definition: iozone.c:357
unsigned long cache_size
Definition: iozone.c:1375
int errno
int i
Definition: fileop.c:140
#define I_FOPEN(x, y)
Definition: iozone.c:1185
int direct_flag
Definition: iozone.c:1527
#define CHILD_STATE_READY
Definition: iozone.c:944
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ thread_fwrite_test() [1/2]

void*() thread_fwrite_test ( )
Here is the caller graph for this function:

◆ thread_fwrite_test() [2/2]

void* thread_fwrite_test ( x  )

Definition at line 24419 of file iozone.c.

24421 {
24422 
24423  struct child_stats *child_stat;
24424  double starttime1 = 0;
24425  double temp_time;
24426  double hist_time;
24427  double desired_op_rate_time;
24428  double actual_rate;
24429  double walltime, cputime;
24430  double compute_val = (double)0;
24431  float delay = (float)0;
24432  double thread_qtime_stop,thread_qtime_start;
24433  off64_t traj_offset;
24434  long long w_traj_bytes_completed;
24435  long long w_traj_ops_completed;
24436  FILE *w_traj_fd;
24437  int fd;
24438  long long recs_per_buffer;
24439  long long stopped,i;
24440  off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far;
24441  long long xx,xx2;
24442  char *dummyfile [MAXSTREAMS]; /* name of dummy file */
24443  char *nbuff;
24444  char *maddr;
24445  char *wmaddr,*free_addr;
24446  char now_string[30];
24447  int anwser,bind_cpu,wval;
24448 #if defined(VXFS) || defined(solaris)
24449  int test_foo = 0;
24450 #endif
24452  char tmpname[256];
24453  FILE *thread_wqfd;
24454  FILE *thread_Lwqfd;
24455  char *filename;
24456 
24457  char *stdio_buf;
24458  char *how;
24459  long long Index = 0;
24460  FILE *stream = NULL;
24461  static int First_Run = 1;
24462 
24463  if(compute_flag)
24465  nbuff=maddr=wmaddr=free_addr=0;
24466  thread_qtime_stop=thread_qtime_start=0;
24467  thread_wqfd=w_traj_fd=thread_Lwqfd=(FILE *)0;
24468  traj_offset=walltime=cputime=0;
24469  anwser=bind_cpu=0;
24470 
24471  if(w_traj_flag)
24472  {
24475  }
24476  else
24477  {
24479  }
24480  written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
24482  recs_per_buffer = cache_size/reclen ;
24483 #ifdef NO_THREADS
24484  xx=chid;
24485 #else
24486  if(use_thread)
24487  {
24488  xx = (long long)((long)x);
24489  }
24490  else
24491  {
24492  xx=chid;
24493  }
24494 #endif
24495 #ifndef NO_THREADS
24496 #ifdef _HPUX_SOURCE
24497  if(ioz_processor_bind)
24498  {
24499  bind_cpu=(begin_proc+(int)xx)%num_processors;
24500  pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
24501  (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
24502  my_nap(40); /* Switch to new cpu */
24503  }
24504 #endif
24505 #endif
24506  if(use_thread)
24507  nbuff=barray[xx];
24508  else
24509  nbuff=buffer;
24510  if(debug1 )
24511  {
24512  if(use_thread)
24513 #ifdef NO_PRINT_LLD
24514  printf("\nStarting child %ld\n",xx);
24515 #else
24516  printf("\nStarting child %lld\n",xx);
24517 #endif
24518  else
24519 #ifdef NO_PRINT_LLD
24520  printf("\nStarting process %d slot %ld\n",getpid(),xx);
24521 #else
24522  printf("\nStarting process %d slot %lld\n",getpid(),xx);
24523 #endif
24524 
24525  }
24526  dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
24527  xx2=xx;
24528  if(share_file)
24529  xx2=(long long)0;
24530  if(mfflag)
24531  {
24532 #ifdef NO_PRINT_LLD
24533  sprintf(dummyfile[xx],"%s",filearray[xx2]);
24534 #else
24535  sprintf(dummyfile[xx],"%s",filearray[xx2]);
24536 #endif
24537  }
24538  else
24539  {
24540 #ifdef NO_PRINT_LLD
24541  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
24542 #else
24543  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
24544 #endif
24545  }
24546  filename=dummyfile[xx];
24547 
24548  if(mmapflag || async_flag)
24549  return(0);
24550 
24551  stdio_buf=(char *)malloc((size_t)reclen);
24552 
24553  if(Uflag) /* Unmount and re-mount the mountpoint */
24554  {
24556  }
24557 
24558  if(First_Run==1)
24559  {
24560  First_Run=0;
24562  how="r+"; /* file exists, don't create and zero a new one. */
24563  else
24564  how="w+"; /* file doesn't exist. create it. */
24565  }
24566  else
24567  how="r+"; /* re-tests should error out if file does not exist. */
24568 
24569 #ifdef IRIX64
24570  if((stream=(FILE *)fopen(filename,how)) == 0)
24571  {
24572  printf("\nCan not fdopen temp file: %s %lld\n",
24573  filename,errno);
24574  perror("fdopen");
24575  exit(48);
24576  }
24577 #else
24578  if((stream=(FILE *)I_FOPEN(filename,how)) == 0)
24579  {
24580 #ifdef NO_PRINT_LLD
24581  printf("\nCan not fdopen temp file: %s %d\n",
24582  filename,errno);
24583 #else
24584  printf("\nCan not fdopen temp file: %s %d\n",
24585  filename,errno);
24586 #endif
24587  perror("fdopen");
24588  exit(49);
24589  }
24590 #endif
24591  fd=fileno(stream);
24592  fsync(fd);
24593  if(direct_flag)
24594  setvbuf(stream,stdio_buf,_IONBF,reclen);
24595  else
24596  setvbuf(stream,stdio_buf,_IOFBF,reclen);
24597 
24599  if(fetchon)
24601  if(verify || dedup || dedup_interior)
24602  fill_buffer(buffer,reclen,(long long)pattern,sverify,(long long)0);
24603 
24604  compute_val=(double)0;
24605 
24606  /*******************************************************************/
24607 
24608  child_stat = (struct child_stats *)&shmaddr[xx];
24609  child_stat->throughput = 0;
24610  child_stat->actual = 0;
24611  child_stat->flag=CHILD_STATE_READY; /* Tell parent child is ready to go */
24612 
24613  if(distributed && client_iozone)
24615  if(distributed && client_iozone)
24616  {
24617  if(cdebug)
24618  {
24619  printf("Child %d waiting for go from master\n",(int)xx);
24620  fflush(stdout);
24621  }
24623  if(cdebug)
24624  {
24625  printf("Child %d received go from master\n",(int)xx);
24626  fflush(stdout);
24627  }
24628  }
24629  else
24630  {
24631  while(child_stat->flag!=CHILD_STATE_BEGIN) /* Wait for signal from parent */
24632  Poll((long long)1);
24633  }
24634 
24635  written_so_far=0;
24636  child_stat = (struct child_stats *)&shmaddr[xx];
24637  child_stat->actual = 0;
24638  child_stat->throughput = 0;
24639  stopped=0;
24640  if(Q_flag)
24641  {
24642  sprintf(tmpname,"Child_%d_fwol.dat",(int)xx);
24643  thread_wqfd=fopen(tmpname,"a");
24644  if(thread_wqfd==0)
24645  {
24647  if(distributed && client_iozone)
24648  send_stop();
24649  printf("Unable to open %s\n",tmpname);
24650  exit(40);
24651  }
24652  fprintf(thread_wqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
24653  }
24654  if(L_flag)
24655  {
24656  sprintf(tmpname,"Child_%d.log",(int)xx);
24657  thread_Lwqfd=fopen(tmpname,"a");
24658  if(thread_Lwqfd==0)
24659  {
24661  if(distributed && client_iozone)
24662  send_stop();
24663  printf("Unable to open %s\n",tmpname);
24664  exit(40);
24665  }
24666  get_date(now_string);
24667  fprintf(thread_Lwqfd,"%-25s %s","fwrite test start: ",now_string);
24668  }
24669  starttime1 = time_so_far();
24670  if(cpuutilflag)
24671  {
24672  walltime = starttime1;
24673  cputime = cputime_so_far();
24674  }
24675  /*******************************************************************/
24676  for(i=0; i<numrecs64; i++){
24677  if(compute_flag)
24678  compute_val+=do_compute(compute_time);
24679  if(multi_buffer)
24680  {
24681  Index +=reclen;
24682  if(Index > (MAXBUFFERSIZE-reclen))
24683  Index=0;
24684  buffer = mbuffer + Index;
24685  }
24686  if((verify & diag_v) || dedup || dedup_interior)
24687  fill_buffer(buffer,reclen,(long long)pattern,sverify,i);
24688  if(purge)
24690  if(Q_flag || hist_summary || op_rate_flag)
24691  {
24692  thread_qtime_start=time_so_far();
24693  }
24694  if(fwrite(buffer, (size_t) reclen, 1, stream) != 1)
24695  {
24696 #ifdef NO_PRINT_LLD
24697  printf("\nError fwriting block %ld, fd= %d\n", i,
24698  fd);
24699 #else
24700  printf("\nError fwriting block %lld, fd= %d\n", i,
24701  fd);
24702 #endif
24703  perror("fwrite");
24704  signal_handler();
24705  }
24706  if(hist_summary)
24707  {
24708  thread_qtime_stop=time_so_far();
24709  hist_time =(thread_qtime_stop-thread_qtime_start);
24710  hist_insert(hist_time);
24711  }
24712  if(op_rate_flag)
24713  {
24714  thread_qtime_stop=time_so_far();
24715  desired_op_rate_time = ((double)1.0/(double)op_rate);
24716  actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
24717  if( actual_rate < desired_op_rate_time)
24718  my_unap((unsigned long long)((desired_op_rate_time-actual_rate)*1000000.0 ));
24719  }
24720  if(Q_flag)
24721  {
24722  thread_qtime_stop=time_so_far();
24723 #ifdef NO_PRINT_LLD
24724  fprintf(thread_wqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
24725 #else
24726  fprintf(thread_wqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
24727 #endif
24728  }
24731  written_so_far+=reclen/1024;
24732  }
24733  if(include_flush)
24734  {
24735  fflush(stream);
24736  wval=fsync(fd);
24737  if(wval==-1){
24738  perror("fsync");
24739  signal_handler();
24740  }
24741  }
24742  if(include_close)
24743  {
24744  wval=fclose(stream);
24745  if(wval==-1){
24746  perror("fclose");
24747  signal_handler();
24748  }
24749  }
24750  /*******************************************************************/
24751  if(!stopped){
24752  temp_time = time_so_far();
24753  child_stat->throughput = ((temp_time - starttime1)-time_res)
24754  -compute_val;
24755  if(child_stat->throughput < (double).000001)
24756  {
24758  if(rec_prob < reclen)
24759  rec_prob = reclen;
24760  res_prob=1;
24761  }
24762 
24763  if(OPS_flag){
24764  /*written_so_far=(written_so_far*1024)/reclen;*/
24765  written_so_far=w_traj_ops_completed;
24766  }
24768  (double)written_so_far/child_stat->throughput;
24769  child_stat->actual = (double)written_so_far;
24770  }
24771  if(cdebug)
24772  {
24773  printf("Child %d: throughput %f actual %f \n",(int)chid, child_stat->throughput,
24774  child_stat->actual);
24775  fflush(stdout);
24776  }
24777  if(cpuutilflag)
24778  {
24780  if (cputime < cputime_res)
24781  cputime = 0.0;
24785  }
24786  if(distributed && client_iozone)
24788  child_stat->actual,
24790  (char)*stop_flag,
24791  (long long)CHILD_STATE_HOLD);
24792 
24793  if (debug1) {
24794  printf(" child/slot: %lld, wall-cpu: %8.3f %8.3fC" " -> %6.2f%%\n",
24795  xx, walltime, cputime,
24797  }
24798  child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
24799  stopped=0;
24800 
24801  /*******************************************************************/
24802  /* End fwrite performance test. *************************************/
24803  /*******************************************************************/
24804 
24805  if(debug1)
24806 #ifdef NO_PRINT_LLD
24807  printf("\nChild finished %ld\n",xx);
24808 #else
24809  printf("\nChild finished %lld\n",xx);
24810 #endif
24811  if(Q_flag && (thread_wqfd !=0) )
24812  fclose(thread_wqfd);
24813  free(dummyfile[xx]);
24814  if(w_traj_flag)
24815  fclose(w_traj_fd);
24816 
24817  if(L_flag)
24818  {
24819  get_date(now_string);
24820  fprintf(thread_Lwqfd,"%-25s %s","Fwrite test finished: ",now_string);
24821  fclose(thread_Lwqfd);
24822  }
24823  /*******************************************************************/
24824  if(!include_close)
24825  {
24826  wval=fflush(stream);
24827  if(wval==-1){
24828  perror("fflush");
24829  signal_handler();
24830  }
24831  wval=fsync(fd);
24832  if(wval==-1){
24833  perror("fsync");
24834  signal_handler();
24835  }
24836  wval=fclose(stream);
24837  if(wval==-1){
24838  perror("fclose");
24839  signal_handler();
24840  }
24841  }
24842 
24843  if(restf)
24844  sleep((int)(int)rest_val);
24845 
24846  free(stdio_buf);
24847  if(OPS_flag || MS_flag){
24849  }
24850  /*******************************************************************/
24851  if(hist_summary)
24852  dump_hist("Fwrite",(int)xx);
24853  if(distributed && client_iozone)
24854  return(0);
24855 #ifdef NO_THREADS
24856  exit(0);
24857 #else
24858  if(use_thread)
24859  thread_exit();
24860  else
24861  exit(0);
24862 #endif
24863 
24864 return(0);
24865 }
int check_filename()
void fetchit()
void purgeit()
long long rec_prob
Definition: iozone.c:1294
int w_traj_flag
Definition: iozone.c:1523
char compute_flag
Definition: iozone.c:1520
char diag_v
Definition: iozone.c:1304
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)
Definition: appio.c:387
#define CHILD_STATE_HOLD
Definition: iozone.c:942
char verify
Definition: iozone.c:1513
struct child_stats * child_stat
long long w_traj_bytes_completed
Definition: iozone.c:1327
void tell_master_stats()
void fill_buffer()
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
char mmapflag
Definition: iozone.c:1512
#define MAXNAMESIZE
Definition: iozone.c:833
int fd
Definition: iozone.c:1291
int restf
Definition: iozone.c:1514
float actual
Definition: iozone.c:463
void signal_handler()
Definition: iozone.c:3336
char * barray[MAXSTREAMS]
Definition: iozone.c:1287
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
void get_date()
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
long long multi_buffer
Definition: iozone.c:1290
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
int thread_exit()
Definition: iozone.c:18526
long long w_traj_ops_completed
Definition: iozone.c:1327
long long reclen
Definition: iozone.c:1535
int num_processors
Definition: iozone.c:1293
long long w_traj_fsize
Definition: iozone.c:1325
int op_rate
Definition: iozone.c:1301
char distributed
Definition: iozone.c:1296
char use_thread
Definition: iozone.c:1372
float compute_time
Definition: iozone.c:1538
float throughput
Definition: iozone.c:462
char Uflag
Definition: iozone.c:1329
char * mbuffer
Definition: iozone.c:1366
char client_iozone
Definition: iozone.c:1296
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
long long debug1
Definition: iozone.c:1373
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
void wait_for_master_go()
long long delay
Definition: iozone.c:1533
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
float cputime
Definition: iozone.c:461
int cdebug
Definition: iozone.c:1478
char * mainbuffer
Definition: iozone.c:1366
long long w_traj_ops
Definition: iozone.c:1325
int begin_proc
Definition: iozone.c:1293
int op_rate_flag
Definition: iozone.c:1302
char dedup
Definition: iozone.c:1304
long long chid
Definition: iozone.c:1529
purge_buffer_cache()
Definition: iozone.c:12274
char L_flag
Definition: iozone.c:1518
void tell_master_ready()
char mfflag
Definition: iozone.c:1334
#define THREAD_FWRITE_TEST
Definition: iozone.c:1440
long long x
Definition: iozone.c:1335
VOLATILE char * stop_flag
Definition: iozone.c:1537
#define MAXBUFFERSIZE
Definition: iozone.c:809
char * buffer
Definition: iozone.c:1366
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
off64_t numrecs64
Definition: iozone.c:1534
long long flag
Definition: iozone.c:458
int share_file
Definition: iozone.c:1309
char dedup_interior
Definition: iozone.c:1304
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
static double cpu_util()
FILE * w_traj_fd
Definition: iozone.c:1367
void send_stop()
Definition: iozone.c:22607
#define cputime_so_far()
Definition: iozone.c:973
void my_nap()
void Poll()
float walltime
Definition: iozone.c:460
void dump_hist()
char Q_flag
Definition: iozone.c:1517
long long res_prob
Definition: iozone.c:1294
int ioz_processor_bind
Definition: iozone.c:1293
double temp_time
Definition: iozone.c:1268
static double time_so_far()
Definition: iozone.c:6844
void my_unap()
char include_close
Definition: iozone.c:1519
void hist_insert()
char OPS_flag
Definition: iozone.c:1517
int client_error
Definition: iozone.c:1398
void exit()
setvbuf(file, file_buf, _IOFBF, sizeof(file_buf))
int fsync()
double cputime_res
Definition: iozone.c:1271
#define MAXSTREAMS
Definition: iozone.c:813
long long rest_val
Definition: iozone.c:1540
long long off64_t
Definition: iozone.c:357
unsigned long cache_size
Definition: iozone.c:1375
int errno
int i
Definition: fileop.c:140
#define I_FOPEN(x, y)
Definition: iozone.c:1185
int direct_flag
Definition: iozone.c:1527
#define CHILD_STATE_READY
Definition: iozone.c:944
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ thread_join() [1/2]

void*() thread_join ( )
Here is the caller graph for this function:

◆ thread_join() [2/2]

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

Definition at line 18585 of file iozone.c.

18589 {
18590  int xx;
18591  pthread_t eek;
18592  pthread_attr_t foo;
18593 
18594  bcopy(&p_childids[tid],&eek,sizeof(pthread_t));
18595  xx=pthread_join(eek,(void **)&foo);
18596  if(xx<0)
18597  printf("Thread join returned error %d\n",errno);
18598  return(0);
18599 }
unsigned long int pthread_t
pthread_t p_childids[MAXSTREAMS+1]
Definition: iozone.c:1338
int errno

◆ thread_mix_test() [1/2]

void*() thread_mix_test ( )
Here is the caller graph for this function:

◆ thread_mix_test() [2/2]

void* thread_mix_test ( x  )

Definition at line 16993 of file iozone.c.

16995 {
16996  int selector;
16997  int num_readers;
16998  long xx;
16999 
17000 #ifdef NO_THREADS
17001  xx=chid;
17002 #else
17003  if(use_thread)
17004  {
17005  xx = (long)x;
17006  }
17007  else
17008  {
17009  xx=(long)chid;
17010  }
17011 #endif
17012  if(pct_read!=0)
17013  {
17014  num_readers = (pct_read * num_child)/100;
17015  if(xx < num_readers)
17016  selector=0;
17017  else
17018  selector=1;
17019  }
17020  else
17021  {
17022  if(Kplus_flag)
17023  {
17024  if(xx+1 <= Kplus_readers)
17025  selector=0;
17026  else
17027  selector=1;
17028  }
17029  else
17030  {
17031  /* Simple round robin */
17032  selector= ((int)xx) % 2;
17033  }
17034  }
17035  if(selector==0)
17036  {
17037  if(seq_mix)
17039  else
17041  }
17042  else
17043  {
17044  if(seq_mix)
17046  else
17048  }
17049  return(0);
17050 }
char Kplus_flag
Definition: iozone.c:1509
char use_thread
Definition: iozone.c:1372
void *() thread_ranread_test()
void *() thread_ranwrite_test()
int pct_read
Definition: iozone.c:1336
long long num_child
Definition: iozone.c:1335
long long chid
Definition: iozone.c:1529
long long x
Definition: iozone.c:1335
void *() thread_read_test()
void *() thread_write_test()
char seq_mix
Definition: iozone.c:1322
int Kplus_readers
Definition: iozone.c:1506
Here is the call graph for this function:

◆ thread_ranread_test() [1/2]

void*() thread_ranread_test ( )
Here is the caller graph for this function:

◆ thread_ranread_test() [2/2]

void* thread_ranread_test ( x  )

Definition at line 17059 of file iozone.c.

17061 {
17062  long long xx,xx2;
17063  struct child_stats *child_stat;
17064  double walltime, cputime;
17065  int fd;
17066  long long flags = 0;
17067  double thread_qtime_stop,thread_qtime_start;
17068  double hist_time;
17069  double desired_op_rate_time;
17070  double actual_rate;
17071  double starttime1 = 0;
17072  float delay = 0;
17073  double temp_time;
17074  double compute_val = (double)0;
17075  off64_t written_so_far, ranread_so_far, re_written_so_far,re_read_so_far;
17076  long long recs_per_buffer;
17077  off64_t current_offset=0;
17078  off64_t i;
17079  char *dummyfile[MAXSTREAMS]; /* name of dummy file */
17080  char *nbuff=0;
17081  char *maddr=0;
17082  char *wmaddr=0;
17083  volatile char *buffer1;
17084  int anwser,bind_cpu;
17085  off64_t traj_offset;
17086  off64_t lock_offset=0;
17087  char tmpname[256];
17088  char now_string[30];
17089  FILE *thread_randrfd=0;
17090  FILE *thread_Lwqfd=0;
17091  long long *recnum=0;
17092 #if defined(VXFS) || defined(solaris)
17093  int test_foo = 0;
17094 #endif
17095  long long save_pos;
17096 #if defined (bsd4_2) || defined(Windows)
17097  long long rand1,rand2,rand3;
17098 #endif
17099  unsigned long long big_rand;
17100 #ifdef ASYNC_IO
17101  struct cache *gc=0;
17102 #else
17103  long long *gc=0;
17104 #endif
17105 #ifdef MERSENNE
17106  unsigned long long init[4]={0x12345ULL, 0x23456ULL, 0x34567ULL, 0x45678ULL}, length=4;
17107 #endif
17108 
17109 #ifdef MERSENNE
17110  init_by_array64(init, length);
17111 #else
17112 #ifdef bsd4_2
17113  srand(0);
17114 #else
17115 #ifdef Windows
17116  srand(0);
17117 #else
17118  srand48(0);
17119 #endif
17120 #endif
17121 #endif
17122  recnum = (long long *)malloc(sizeof(*recnum)*numrecs64);
17123  if (recnum){
17124  /* pre-compute random sequence based on
17125  Fischer-Yates (Knuth) card shuffle */
17126  for(i = 0; i < numrecs64; i++){
17127  recnum[i] = i;
17128  }
17129  for(i = 0; i < numrecs64; i++) {
17130  long long tmp = recnum[i];
17131 #ifdef MERSENNE
17132  big_rand = genrand64_int64();
17133 #else
17134 #ifdef bsd4_2
17135  rand1=(long long)rand();
17136  rand2=(long long)rand();
17137  rand3=(long long)rand();
17138  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
17139 #else
17140 #ifdef Windows
17141  rand1=(long long)rand();
17142  rand2=(long long)rand();
17143  rand3=(long long)rand();
17144  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
17145 #else
17146  big_rand = lrand48();
17147 #endif
17148 #endif
17149 #endif
17150  big_rand = big_rand%numrecs64;
17151  tmp = recnum[i];
17152  recnum[i] = recnum[big_rand];
17153  recnum[big_rand] = tmp;
17154  }
17155  }
17156  else
17157  {
17158  fprintf(stderr,"Random uniqueness fallback.\n");
17159  }
17160  if(compute_flag)
17162  hist_time=thread_qtime_stop=thread_qtime_start=0;
17163  traj_offset=walltime=cputime=0;
17164  anwser=bind_cpu=0;
17165  written_so_far=ranread_so_far=re_written_so_far=re_read_so_far=0;
17166  recs_per_buffer = cache_size/reclen ;
17167 #ifdef NO_THREADS
17168  xx=chid;
17169 #else
17170  if(use_thread)
17171  xx = (long long)((long)x);
17172  else
17173  {
17174  xx=chid;
17175  }
17176 #endif
17177 #ifndef NO_THREADS
17178 #if defined( _HPUX_SOURCE ) || defined ( linux )
17179  if(ioz_processor_bind)
17180  {
17181  bind_cpu=(begin_proc+(int)xx)%num_processors;
17182 #if defined(_HPUX_SOURCE)
17183  pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
17184  (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
17185 #else
17186  cpu_set_t cpuset;
17187 
17188  CPU_ZERO(&cpuset);
17189  CPU_SET(bind_cpu, &cpuset);
17190 
17191  pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
17192 #endif
17193  my_nap(40); /* Switch to new cpu */
17194  }
17195 #endif
17196 #endif
17197  if(use_thread)
17198  nbuff=barray[xx];
17199  else
17200  nbuff=buffer;
17201  dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
17202  xx2=xx;
17203  if(share_file)
17204  xx2=(long long)0;
17205  if(mfflag)
17206  {
17207 #ifdef NO_PRINT_LLD
17208  sprintf(dummyfile[xx],"%s",filearray[xx2]);
17209 #else
17210  sprintf(dummyfile[xx],"%s",filearray[xx2]);
17211 #endif
17212  }
17213  else
17214  {
17215 #ifdef NO_PRINT_LLD
17216  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
17217 #else
17218  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
17219 #endif
17220  }
17221  if(oflag)
17222  {
17223  flags=O_RDONLY|O_SYNC;
17224  }
17225  else
17226  flags=O_RDONLY;
17227 #if defined(_HPUX_SOURCE) || defined(linux)
17228  if(read_sync)
17229  flags |=O_RSYNC|O_SYNC;
17230 #endif
17231 
17232 #if ! defined(DONT_HAVE_O_DIRECT)
17233 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
17234  if(direct_flag)
17235  flags |=O_DIRECT;
17236 #endif
17237 #if defined(TRU64)
17238  if(direct_flag)
17239  flags |=O_DIRECTIO;
17240 #endif
17241 #endif
17242 
17243 #if defined(Windows)
17244  if(unbuffered)
17245  {
17246  hand=CreateFile(dummyfile[xx],
17247  GENERIC_READ|GENERIC_WRITE,
17248  FILE_SHARE_WRITE|FILE_SHARE_READ,
17249  NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
17250  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
17251  NULL);
17252  }
17253 #endif
17254  if((fd = I_OPEN(dummyfile[xx], ((int)flags),0))<0)
17255  {
17257  if(distributed && client_iozone)
17258  send_stop();
17259  perror(dummyfile[xx]);
17260  exit(156);
17261  }
17262 #ifdef ASYNC_IO
17263  if(async_flag)
17264  async_init(&gc,fd,direct_flag);
17265 #endif
17266 
17267 #ifdef VXFS
17268  if(direct_flag)
17269  {
17270  ioctl(fd,VX_SETCACHE,VX_DIRECT);
17271  ioctl(fd,VX_GETCACHE,&test_foo);
17272  if(test_foo == 0)
17273  {
17274  if(!client_iozone)
17275  printf("\nVxFS advanced setcache feature not available.\n");
17276  exit(3);
17277  }
17278  }
17279 #endif
17280 #if defined(solaris)
17281  if(direct_flag)
17282  {
17283  test_foo = directio(fd, DIRECTIO_ON);
17284  if(test_foo != 0)
17285  {
17286  if(!client_iozone)
17287  printf("\ndirectio not available.\n");
17288  exit(3);
17289  }
17290  }
17291 #endif
17292 
17293  if(mmapflag)
17294  {
17295  maddr=(char *)initfile(fd,(numrecs64*reclen),0,PROT_READ);
17296  }
17297  child_stat = (struct child_stats *)&shmaddr[xx];
17298  child_stat->throughput = 0;
17299  child_stat->actual = 0;
17300  if(debug1)
17301  {
17302  if(use_thread)
17303 #ifdef NO_PRINT_LLD
17304  printf("\nStarting child %ld\n",xx);
17305 #else
17306  printf("\nStarting child %lld\n",xx);
17307 #endif
17308  else
17309 #ifdef NO_PRINT_LLD
17310  printf("\nStarting process %d slot %ld\n",getpid(),xx);
17311 #else
17312  printf("\nStarting process %d slot %lld\n",getpid(),xx);
17313 #endif
17314 
17315  }
17316  /*****************/
17317  /* Children only */
17318  /*****************/
17319  if(fetchon)
17320  fetchit(nbuff,reclen);
17321  if(Q_flag)
17322  {
17323  sprintf(tmpname,"Child_%d_randrol.dat",(int)xx);
17324  thread_randrfd=fopen(tmpname,"a");
17325  if(thread_randrfd==0)
17326  {
17328  if(distributed && client_iozone)
17329  send_stop();
17330  printf("Unable to open %s\n",tmpname);
17331  exit(40);
17332  }
17333  fprintf(thread_randrfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
17334  }
17335  if(L_flag)
17336  {
17337  sprintf(tmpname,"Child_%d.log",(int)xx);
17338  thread_Lwqfd=fopen(tmpname,"a");
17339  if(thread_Lwqfd==0)
17340  {
17342  if(distributed && client_iozone)
17343  send_stop();
17344  printf("Unable to open %s\n",tmpname);
17345  exit(40);
17346  }
17347  get_date(now_string);
17348  fprintf(thread_Lwqfd,"%-25s %s","Random read start: ",
17349  now_string);
17350  }
17351  child_stat=(struct child_stats *)&shmaddr[xx];
17353  if(distributed && client_iozone)
17354  {
17357  }
17358  else
17359  {
17360  while(child_stat->flag!=CHILD_STATE_BEGIN) /* Wait for signal from parent */
17361  Poll((long long)1);
17362  }
17363  starttime1 = time_so_far();
17364  if(cpuutilflag)
17365  {
17366  walltime = starttime1;
17367  cputime = cputime_so_far();
17368  }
17369 
17370 #ifdef MERSENNE
17371  init_by_array64(init, length);
17372 #else
17373 #ifdef bsd4_2
17374  srand(0);
17375 #else
17376 #ifdef Windows
17377  srand(0);
17378 #else
17379  srand48(0);
17380 #endif
17381 #endif
17382 #endif
17383  if(file_lock)
17384  if(mylockf((int) fd, (int) 1, (int)1)!=0)
17385  printf("File lock for read failed. %d\n",errno);
17386  for(i=0; i<numrecs64; i++) {
17387  if(compute_flag)
17388  compute_val+=do_compute(delay);
17389  if(*stop_flag)
17390  {
17391  if(debug1)
17392  printf("\n(%ld) Stopped by another 2\n", (long)xx);
17393  break;
17394  }
17395  if(purge)
17396  purgeit(nbuff,reclen);
17397  if (recnum) {
17398  current_offset = reclen * (long long)recnum[i];
17399  } else {
17400 #ifdef MERSENNE
17401  big_rand = genrand64_int64();
17402  current_offset = (off64_t)reclen * (big_rand%numrecs64);
17403 #else
17404 #ifdef bsd4_2
17405  rand1=(long long)rand();
17406  rand2=(long long)rand();
17407  rand3=(long long)rand();
17408  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
17409  current_offset = (off64_t)reclen * (big_rand%numrecs64);
17410 #else
17411 #ifdef Windows
17412  rand1=(long long)rand();
17413  rand2=(long long)rand();
17414  rand3=(long long)rand();
17415  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
17416  current_offset = (off64_t)reclen * (big_rand%numrecs64);
17417 #else
17418  current_offset = reclen * (lrand48()%numrecs64);
17419 #endif
17420 #endif
17421 #endif
17422  }
17423 
17424  if (!(h_flag || k_flag || mmapflag))
17425  {
17426  if(I_LSEEK( fd, current_offset, SEEK_SET )<0)
17427  {
17429  if(distributed && client_iozone)
17430  send_stop();
17431  perror("lseek");
17432  exit(158);
17433  };
17434  }
17435  if(rlocking)
17436  {
17437  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
17438  mylockr((int) fd, (int) 1, (int)1,
17439  lock_offset, reclen);
17440  }
17441  if(Q_flag || hist_summary || op_rate_flag)
17442  {
17443  traj_offset=I_LSEEK(fd,0,SEEK_CUR);
17444  thread_qtime_start=time_so_far();
17445  }
17446  if(mmapflag)
17447  {
17448  wmaddr = &maddr[current_offset];
17449  fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
17450  }
17451  else
17452  {
17453  if(async_flag)
17454  {
17455  if(no_copy_flag)
17456  async_read_no_copy(gc, (long long)fd, &buffer1, (current_offset),
17457  reclen, 0LL,(numrecs64*reclen),depth);
17458  else
17459  async_read(gc, (long long)fd, nbuff, (current_offset), reclen,
17460  0LL,(numrecs64*reclen),depth);
17461  }
17462  else
17463  {
17464  if(read((int)fd, (void*)nbuff, (size_t)reclen) != reclen)
17465  {
17466  if(*stop_flag)
17467  {
17468  if(debug1)
17469  printf("\n(%ld) Stopped by another 2\n", (long)xx);
17470  break;
17471  }
17472 #ifdef NO_PRINT_LLD
17473  printf("\nError reading block at %ld\n",
17474  offset);
17475 #else
17476  printf("\nError reading block at %lld\n",
17477  offset);
17478 #endif
17479  perror("ranread");
17480  if (!no_unlink)
17481  {
17482  if(check_filename(dummyfile[xx]))
17483  unlink(dummyfile[xx]);
17484  }
17486  exit(160);
17487  }
17488  }
17489  }
17490  if(rlocking)
17491  {
17492  mylockr((int) fd, (int) 0, (int)1,
17493  lock_offset, reclen);
17494  }
17495  save_pos=current_offset/reclen;
17496  current_offset+=reclen;
17497  if(verify){
17498  if(async_flag && no_copy_flag)
17499  {
17500  if(verify_buffer(buffer1,reclen,(off64_t)save_pos,reclen,(long long)pattern,sverify)){
17501  if (!no_unlink)
17502  {
17503  if(check_filename(dummyfile[xx]))
17504  unlink(dummyfile[xx]);
17505  }
17507  exit(161);
17508  }
17509  }
17510  else
17511  {
17512  if(verify_buffer(nbuff,reclen,(off64_t)save_pos,reclen,(long long)pattern,sverify)){
17513  if (!no_unlink)
17514  {
17515  if(check_filename(dummyfile[xx]))
17516  unlink(dummyfile[xx]);
17517  }
17519  exit(162);
17520  }
17521  }
17522  }
17523  if(async_flag && no_copy_flag)
17524  async_release(gc);
17525  ranread_so_far+=reclen/1024;
17526  if(*stop_flag)
17527  {
17528  ranread_so_far-=reclen/1024;
17529  }
17530  if(hist_summary)
17531  {
17532  thread_qtime_stop=time_so_far();
17533  hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
17534  hist_insert(hist_time);
17535  }
17536  if(op_rate_flag)
17537  {
17538  thread_qtime_stop=time_so_far();
17539  desired_op_rate_time = ((double)1.0/(double)op_rate);
17540  actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
17541 /*
17542 printf("Desired rate %g Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
17543  actual_rate, (desired_op_rate_time-actual_rate));
17544 */
17545  if( actual_rate < desired_op_rate_time)
17546  my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
17547  }
17548  if(Q_flag)
17549  {
17550  thread_qtime_stop=time_so_far();
17551 #ifdef NO_PRINT_LLD
17552  fprintf(thread_randrfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
17553 #else
17554  fprintf(thread_randrfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
17555 #endif
17556  }
17557  }
17558  if(file_lock)
17559  if(mylockf((int) fd,(int)0,(int)1))
17560  printf("Read unlock failed %d\n",errno);
17561 #ifdef ASYNC_IO
17562  if(async_flag)
17563  {
17564  end_async(gc);
17565  gc=0;
17566  }
17567 #endif
17568  if(include_flush)
17569  {
17570  if(mmapflag)
17571  {
17572  msync(maddr,(size_t)(numrecs64*reclen),MS_SYNC);
17573  }else
17574  fsync(fd);
17575  }
17576  if(include_close)
17577  {
17578  if(mmapflag)
17579  {
17580  mmap_end(maddr,(unsigned long long)numrecs64*reclen);
17581  }
17582  close(fd);
17583  }
17584  temp_time = time_so_far();
17585  child_stat=(struct child_stats *)&shmaddr[xx];
17586  child_stat->throughput = ((temp_time - starttime1)-time_res)
17587  -compute_val;
17588  if(child_stat->throughput < (double).000001)
17589  {
17591  if(rec_prob < reclen)
17592  rec_prob = reclen;
17593  res_prob=1;
17594  }
17595  if(OPS_flag){
17596  ranread_so_far=(ranread_so_far*1024)/reclen;
17597  }
17598  child_stat->throughput = ranread_so_far/child_stat->throughput;
17599  child_stat->actual = ranread_so_far;
17600  if(!xflag)
17601  {
17602  *stop_flag=1;
17603  if(distributed && client_iozone)
17604  send_stop();
17605  }
17606  if(cdebug)
17607  {
17608  fprintf(newstdout,"Child %d: throughput %f actual %f \n",(int)chid,child_stat->throughput,
17609  child_stat->actual);
17610  fflush(newstdout);
17611  }
17612  if(cpuutilflag)
17613  {
17615  if (cputime < cputime_res)
17616  cputime = 0.0;
17620  }
17621  if(distributed && client_iozone)
17623  child_stat->actual,
17625  (char)*stop_flag,
17626  (long long)CHILD_STATE_HOLD);
17627  child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
17628  if(!include_close)
17629  {
17630  if(mmapflag)
17631  {
17632  msync(maddr,(size_t)(numrecs64*reclen),MS_SYNC);
17633  mmap_end(maddr,(unsigned long long)numrecs64*reclen);
17634  }else
17635  fsync(fd);
17636  close(fd);
17637  }
17638  if(Q_flag && (thread_randrfd !=0) )
17639  fclose(thread_randrfd);
17640  free(dummyfile[xx]);
17641  if(debug1)
17642 #ifdef NO_PRINT_LLD
17643  printf("\nChild finished %ld\n",xx);
17644 #else
17645  printf("\nChild finished %lld\n",xx);
17646 #endif
17647 
17648  if(L_flag)
17649  {
17650  get_date(now_string);
17651  fprintf(thread_Lwqfd,"%-25s %s","Random read finished: ",now_string);
17652  fclose(thread_Lwqfd);
17653  }
17654  if(recnum)
17655  free(recnum);
17656  if(hist_summary)
17657  dump_hist("Random Read",(int)xx);
17658  if(distributed && client_iozone)
17659  return(0);
17660 #ifdef NO_THREADS
17661  exit(0);
17662 #else
17663  if(use_thread)
17664  thread_exit();
17665  else
17666  exit(0);
17667 #endif
17668 return(0);
17669 }
int check_filename()
void end_async()
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
void mmap_end()
#define CHILD_STATE_HOLD
Definition: iozone.c:942
char verify
Definition: iozone.c:1513
struct child_stats * child_stat
int no_unlink
Definition: iozone.c:1521
off64_t offset
Definition: iozone.c:1279
void tell_master_stats()
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
char mmapflag
Definition: iozone.c:1512
char k_flag
Definition: iozone.c:1509
#define MAXNAMESIZE
Definition: iozone.c:833
int fd
Definition: iozone.c:1291
long lrand48()
float actual
Definition: iozone.c:463
char * barray[MAXSTREAMS]
Definition: iozone.c:1287
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
void get_date()
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
int thread_exit()
Definition: iozone.c:18526
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long reclen
Definition: iozone.c:1535
int num_processors
Definition: iozone.c:1293
double tmp
char read_sync
Definition: iozone.c:1295
int op_rate
Definition: iozone.c:1301
char distributed
Definition: iozone.c:1296
int mylockf()
char use_thread
Definition: iozone.c:1372
unsigned long long genrand64_int64(void)
Definition: iozone.c:23922
float compute_time
Definition: iozone.c:1538
float throughput
Definition: iozone.c:462
void async_init()
Definition: iozone.c:19044
int async_read_no_copy()
Definition: iozone.c:19050
#define THREAD_RANDOM_READ_TEST
Definition: iozone.c:1434
char client_iozone
Definition: iozone.c:1296
void srand48()
char cpuutilflag
Definition: iozone.c:1321
long long debug1
Definition: iozone.c:1373
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
void srand()
char unbuffered
Definition: iozone.c:1509
void wait_for_master_go()
char * initfile()
long long delay
Definition: iozone.c:1533
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
float cputime
Definition: iozone.c:461
void init_by_array64(unsigned long long *, unsigned long long)
int cdebug
Definition: iozone.c:1478
int begin_proc
Definition: iozone.c:1293
int async_read()
Definition: iozone.c:19026
unsigned int length
char * buffer1
Definition: iozone.c:1366
int op_rate_flag
Definition: iozone.c:1302
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
long long chid
Definition: iozone.c:1529
char L_flag
Definition: iozone.c:1518
void tell_master_ready()
char mfflag
Definition: iozone.c:1334
long long x
Definition: iozone.c:1335
VOLATILE char * stop_flag
Definition: iozone.c:1537
char * buffer
Definition: iozone.c:1366
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
off64_t numrecs64
Definition: iozone.c:1534
long long flag
Definition: iozone.c:458
int share_file
Definition: iozone.c:1309
long long verify_buffer(char *buffer, long long length, off64_t recnum, long long recsize, unsigned long long patt, char sverify)
Definition: iozone.c:6940
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
char xflag
Definition: iozone.c:1520
int close()
void send_stop()
Definition: iozone.c:22607
FILE * newstdout
Definition: iozone.c:1475
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
char oflag
Definition: iozone.c:1509
void async_release()
Definition: iozone.c:19056
void my_nap()
int rand()
void Poll()
char h_flag
Definition: iozone.c:1509
float walltime
Definition: iozone.c:460
void dump_hist()
char Q_flag
Definition: iozone.c:1517
long long res_prob
Definition: iozone.c:1294
int ioz_processor_bind
Definition: iozone.c:1293
char no_copy_flag
Definition: iozone.c:1519
double temp_time
Definition: iozone.c:1268
static double time_so_far()
Definition: iozone.c:6844
void my_unap()
char include_close
Definition: iozone.c:1519
void hist_insert()
char OPS_flag
Definition: iozone.c:1517
int unlink()
int client_error
Definition: iozone.c:1398
void exit()
int rlocking
Definition: iozone.c:1308
int fsync()
double cputime_res
Definition: iozone.c:1271
#define MAXSTREAMS
Definition: iozone.c:813
long long off64_t
Definition: iozone.c:357
unsigned long cache_size
Definition: iozone.c:1375
int errno
int i
Definition: fileop.c:140
int direct_flag
Definition: iozone.c:1527
#define CHILD_STATE_READY
Definition: iozone.c:944
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ thread_ranwrite_test() [1/2]

void*() thread_ranwrite_test ( )
Here is the caller graph for this function:

◆ thread_ranwrite_test() [2/2]

void* thread_ranwrite_test ( x  )

Definition at line 17679 of file iozone.c.

17681 {
17682 
17683  struct child_stats *child_stat;
17684  double starttime1 = 0;
17685  double temp_time;
17686  double walltime, cputime;
17687  double compute_val = (double)0;
17688  float delay = (double)0;
17689  double thread_qtime_stop,thread_qtime_start;
17690  double hist_time;
17691  double desired_op_rate_time;
17692  double actual_rate;
17693  off64_t traj_offset;
17694  off64_t current_offset=0;
17695  long long flags;
17696  long long w_traj_bytes_completed;
17697  long long w_traj_ops_completed;
17698  int fd;
17699  long long recs_per_buffer;
17700  long long stopped,i;
17701  off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far;
17702  long long xx,xx2;
17703  char *dummyfile [MAXSTREAMS]; /* name of dummy file */
17704  char *nbuff=0;
17705  char *maddr=0;
17706  char *wmaddr=0;
17707  char *free_addr=0;
17708  int anwser,bind_cpu,wval;
17710  off64_t lock_offset=0;
17711  char tmpname[256];
17712  char now_string[30];
17713  FILE *thread_randwqfd=0;
17714  FILE *thread_Lwqfd=0;
17715  long long *recnum = 0;
17716 #if defined(VXFS) || defined(solaris)
17717  int test_foo = 0;
17718 #endif
17719 #if defined (bsd4_2) || defined(Windows)
17720  long long rand1,rand2,rand3;
17721 #endif
17722  unsigned long long big_rand;
17723 
17724 #ifdef ASYNC_IO
17725  struct cache *gc=0;
17726 
17727 #else
17728  long long *gc=0;
17729 #endif
17730 #ifdef MERSENNE
17731  unsigned long long init[4]={0x12345ULL, 0x23456ULL, 0x34567ULL, 0x45678ULL}, length=4;
17732 #endif
17733 
17734  if(compute_flag)
17736  hist_time=thread_qtime_stop=thread_qtime_start=0;
17737  traj_offset=walltime=cputime=0;
17738  anwser=bind_cpu=0;
17740  written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
17742  recs_per_buffer = cache_size/reclen ;
17743 #ifdef MERSENNE
17744  init_by_array64(init, length);
17745 #else
17746 #ifdef bsd4_2
17747  srand(0);
17748 #else
17749 #ifdef Windows
17750  srand(0);
17751 #else
17752  srand48(0);
17753 #endif
17754 #endif
17755 #endif
17756  recnum = (long long *) malloc(sizeof(*recnum)*numrecs64);
17757  if (recnum){
17758  /* pre-compute random sequence based on
17759  Fischer-Yates (Knuth) card shuffle */
17760  for(i = 0; i < numrecs64; i++){
17761  recnum[i] = i;
17762  }
17763  for(i = 0; i < numrecs64; i++) {
17764  long long tmp = recnum[i];
17765 #ifdef MERSENNE
17766  big_rand = genrand64_int64();
17767 #else
17768 #ifdef bsd4_2
17769  rand1=(long long)rand();
17770  rand2=(long long)rand();
17771  rand3=(long long)rand();
17772  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
17773 #else
17774 #ifdef Windows
17775  rand1=(long long)rand();
17776  rand2=(long long)rand();
17777  rand3=(long long)rand();
17778  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
17779 #else
17780  big_rand = lrand48();
17781 #endif
17782 #endif
17783 #endif
17784  big_rand = big_rand%numrecs64;
17785  tmp = recnum[i];
17786  recnum[i] = recnum[big_rand];
17787  recnum[big_rand] = tmp;
17788  }
17789  }
17790  else
17791  {
17792  fprintf(stderr,"Random uniqueness fallback.\n");
17793  }
17794 #ifdef NO_THREADS
17795  xx=chid;
17796 #else
17797  if(use_thread)
17798  {
17799  xx = (long long)((long)x);
17800  }
17801  else
17802  {
17803  xx=chid;
17804  }
17805 #endif
17806 #ifndef NO_THREADS
17807 #if defined( _HPUX_SOURCE ) || defined ( linux )
17808  if(ioz_processor_bind)
17809  {
17810  bind_cpu=(begin_proc+(int)xx)%num_processors;
17811 #if defined(_HPUX_SOURCE)
17812  pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
17813  (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
17814 #else
17815  cpu_set_t cpuset;
17816 
17817  CPU_ZERO(&cpuset);
17818  CPU_SET(bind_cpu, &cpuset);
17819 
17820  pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
17821 #endif
17822  my_nap(40); /* Switch to new cpu */
17823  }
17824 #endif
17825 #endif
17826  if(use_thread)
17827  nbuff=barray[xx];
17828  else
17829  nbuff=buffer;
17830  if(debug1 )
17831  {
17832  if(use_thread)
17833 #ifdef NO_PRINT_LLD
17834  printf("\nStarting child %ld\n",xx);
17835 #else
17836  printf("\nStarting child %lld\n",xx);
17837 #endif
17838  else
17839 #ifdef NO_PRINT_LLD
17840  printf("\nStarting process %d slot %ld\n",getpid(),xx);
17841 #else
17842  printf("\nStarting process %d slot %lld\n",getpid(),xx);
17843 #endif
17844 
17845  }
17846  dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
17847  xx2=xx;
17848  if(share_file)
17849  xx2=(long long)0;
17850  if(mfflag)
17851  {
17852 #ifdef NO_PRINT_LLD
17853  sprintf(dummyfile[xx],"%s",filearray[xx2]);
17854 #else
17855  sprintf(dummyfile[xx],"%s",filearray[xx2]);
17856 #endif
17857  }
17858  else
17859  {
17860 #ifdef NO_PRINT_LLD
17861  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
17862 #else
17863  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
17864 #endif
17865  }
17866  /*****************/
17867  /* Children only */
17868  /*******************************************************************/
17869  /* Random write throughput performance test. **********************/
17870  /*******************************************************************/
17871  if(oflag)
17872  flags=O_RDWR|O_SYNC|O_CREAT;
17873  else
17874  flags=O_RDWR|O_CREAT;
17875 #if defined(O_DSYNC)
17876  if(odsync)
17877  flags |= O_DSYNC;
17878 #endif
17879 #if defined(_HPUX_SOURCE) || defined(linux)
17880  if(read_sync)
17881  flags |=O_RSYNC|O_SYNC;
17882 #endif
17883 
17884 #if ! defined(DONT_HAVE_O_DIRECT)
17885 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
17886  if(direct_flag)
17887  flags |=O_DIRECT;
17888 #endif
17889 #if defined(TRU64)
17890  if(direct_flag)
17891  flags |=O_DIRECTIO;
17892 #endif
17893 #endif
17894 #if defined(Windows)
17895  if(unbuffered)
17896  {
17897  hand=CreateFile(dummyfile[xx],
17898  GENERIC_READ|GENERIC_WRITE,
17899  FILE_SHARE_WRITE|FILE_SHARE_READ,
17900  NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
17901  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
17902  NULL);
17903  }
17904 #endif
17905  if((fd = I_OPEN(dummyfile[xx], ((int)flags),0640))<0)
17906  {
17908  if(distributed && client_iozone)
17909  send_stop();
17910  printf("\nCan not open temp file: %s\n",
17911  filename);
17912  perror("open");
17913  exit(125);
17914  }
17915 #ifdef VXFS
17916  if(direct_flag)
17917  {
17918  ioctl(fd,VX_SETCACHE,VX_DIRECT);
17919  ioctl(fd,VX_GETCACHE,&test_foo);
17920  if(test_foo == 0)
17921  {
17922  if(!client_iozone)
17923  printf("\nVxFS advanced setcache feature not available.\n");
17924  exit(3);
17925  }
17926  }
17927 #endif
17928 #if defined(solaris)
17929  if(direct_flag)
17930  {
17931  test_foo = directio(fd, DIRECTIO_ON);
17932  if(test_foo != 0)
17933  {
17934  if(!client_iozone)
17935  printf("\ndirectio not available.\n");
17936  exit(3);
17937  }
17938  }
17939 #endif
17940 #ifdef ASYNC_IO
17941  if(async_flag)
17942  async_init(&gc,fd,direct_flag);
17943 #endif
17944  if(mmapflag)
17945  {
17946  maddr=(char *)initfile(fd,(filebytes64),1,PROT_READ|PROT_WRITE);
17947  }
17948  if(reclen < cache_size )
17949  {
17950  recs_per_buffer = cache_size/reclen ;
17951  nbuff=&nbuff[(xx%recs_per_buffer)*reclen];
17952  }
17953  if(fetchon) /* Prefetch into processor cache */
17954  fetchit(nbuff,reclen);
17955 
17956  child_stat = (struct child_stats *)&shmaddr[xx];
17957  child_stat->throughput = 0;
17958  child_stat->actual = 0;
17959  child_stat->flag=CHILD_STATE_READY; /* Tell parent child is ready to go */
17960  if(distributed && client_iozone)
17961  {
17964  }
17965  else
17966  {
17967  while(child_stat->flag!=CHILD_STATE_BEGIN) /* Wait for signal from parent */
17968  Poll((long long)1);
17969  }
17970  written_so_far=0;
17971  child_stat = (struct child_stats *)&shmaddr[xx];
17972  child_stat->actual = 0;
17973  child_stat->throughput = 0;
17974  stopped=0;
17975  if(file_lock)
17976  if(mylockf((int) fd, (int) 1, (int)0) != 0)
17977  printf("File lock for write failed. %d\n",errno);
17978  if(Q_flag)
17979  {
17980  sprintf(tmpname,"Child_%d_randwol.dat",(int)xx);
17981  thread_randwqfd=fopen(tmpname,"a");
17982  if(thread_randwqfd==0)
17983  {
17985  if(distributed && client_iozone)
17986  send_stop();
17987  printf("Unable to open %s\n",tmpname);
17988  exit(40);
17989  }
17990  fprintf(thread_randwqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
17991  }
17992  if(L_flag)
17993  {
17994  sprintf(tmpname,"Child_%d.log",(int)xx);
17995  thread_Lwqfd=fopen(tmpname,"a");
17996  if(thread_Lwqfd==0)
17997  {
17999  if(distributed && client_iozone)
18000  send_stop();
18001  printf("Unable to open %s\n",tmpname);
18002  exit(40);
18003  }
18004  get_date(now_string);
18005  fprintf(thread_Lwqfd,"%-25s %s","Random write start: ",
18006  now_string);
18007  }
18008  if((verify && !no_copy_flag) || dedup || dedup_interior)
18009  fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
18010  starttime1 = time_so_far();
18011  if(cpuutilflag)
18012  {
18013  walltime = starttime1;
18014  cputime = cputime_so_far();
18015  }
18016  for(i=0; i<numrecs64; i++){
18017  if(compute_flag)
18018  compute_val+=do_compute(delay);
18019  if (recnum) {
18020  current_offset = reclen * (long long)recnum[i];
18021  } else {
18022 #ifdef bsd4_2
18023  rand1=rand();
18024  rand2=rand();
18025  rand3=rand();
18026  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
18027  current_offset = (off64_t)reclen * (big_rand%numrecs64);
18028 #else
18029 #ifdef Windows
18030  rand1=rand();
18031  rand2=rand();
18032  rand3=rand();
18033  big_rand=(rand1<<32)|(rand2<<16)|(rand3);
18034  current_offset = (off64_t)reclen * (big_rand%numrecs64);
18035 #else
18036  current_offset = reclen * (lrand48()%numrecs64);
18037 #endif
18038 #endif
18039  }
18040 
18041  if (!(h_flag || k_flag || mmapflag))
18042  {
18043  if(I_LSEEK( fd, current_offset, SEEK_SET )<0)
18044  {
18046  if(distributed && client_iozone)
18047  send_stop();
18048  perror("lseek");
18049  exit(158);
18050  };
18051  }
18052  if(Q_flag || hist_summary || op_rate_flag)
18053  {
18054  traj_offset=I_LSEEK(fd,0,SEEK_CUR);
18055  thread_qtime_start=time_so_far();
18056  }
18057  if(rlocking)
18058  {
18059  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
18060  mylockr((int) fd, (int) 1, (int)0,
18061  lock_offset, reclen);
18062  }
18063  if((verify && !no_copy_flag) || dedup || dedup_interior)
18064  fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)(current_offset/reclen));
18065  if(*stop_flag && !stopped){
18066  if(include_flush)
18067  {
18068  if(mmapflag)
18069  msync(maddr,(size_t)filebytes64,MS_SYNC);
18070  else
18071  fsync(fd);
18072  }
18074  (time_so_far() - starttime1)-time_res;
18075  if(child_stat->throughput < (double).000001)
18076  {
18078  if(rec_prob < reclen)
18079  rec_prob = reclen;
18080  res_prob=1;
18081  }
18082 
18083  if(OPS_flag){
18084  /*written_so_far=(written_so_far*1024)/reclen;*/
18085  written_so_far=w_traj_ops_completed;
18086  }
18088  (double)written_so_far/child_stat->throughput;
18089  child_stat->actual = (double)written_so_far;
18090  if(debug1)
18091  {
18092  printf("\n(%ld) Stopped by another\n", (long)xx);
18093  }
18094  stopped=1;
18095  }
18096  if(purge)
18097  purgeit(nbuff,reclen);
18098  if(Q_flag || hist_summary)
18099  {
18100  thread_qtime_start=time_so_far();
18101  }
18102 again:
18103  if(mmapflag)
18104  {
18105  wmaddr = &maddr[current_offset];
18106  fill_area((long long*)nbuff,(long long*)wmaddr,(long long)reclen);
18107  if(!mmapnsflag)
18108  {
18109  if(mmapasflag)
18110  msync(wmaddr,(size_t)reclen,MS_ASYNC);
18111  if(mmapssflag)
18112  msync(wmaddr,(size_t)reclen,MS_SYNC);
18113  }
18114  }
18115  else
18116  {
18117  if(async_flag)
18118  {
18119  if(no_copy_flag)
18120  {
18121  free_addr=nbuff=(char *)malloc((size_t)reclen+page_size);
18122  nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
18123  if(verify || dedup || dedup_interior)
18124  fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)(current_offset/reclen));
18125  async_write_no_copy(gc, (long long)fd, nbuff, reclen, (current_offset), depth,free_addr);
18126  }
18127  else
18128  async_write(gc, (long long)fd, nbuff, reclen, current_offset, depth);
18129  }
18130  else
18131  {
18132  wval = write(fd, nbuff, (size_t) reclen);
18133  if(wval != reclen)
18134  {
18135  if(*stop_flag && !stopped){
18136  if(include_flush)
18137  {
18138  if(mmapflag)
18139  msync(maddr,(size_t)filebytes64,MS_SYNC);
18140  else
18141  fsync(fd);
18142  }
18143  temp_time = time_so_far();
18145  (temp_time - starttime1)-time_res;
18146  if(child_stat->throughput < (double).000001)
18147  {
18149  if(rec_prob < reclen)
18150  rec_prob = reclen;
18151  res_prob=1;
18152  }
18153 
18154  if(OPS_flag){
18155  /*written_so_far=(written_so_far*1024)/reclen;*/
18156  written_so_far=w_traj_ops_completed;
18157  }
18159  (double)written_so_far/child_stat->throughput;
18160  child_stat->actual = (double)written_so_far;
18161  if(debug1)
18162  {
18163  printf("\n(%ld) Stopped by another\n", (long)xx);
18164  }
18165  stopped=1;
18166  goto again;
18167  }
18168  /* Note: Writer must finish even though told
18169  to stop. Otherwise the readers will fail.
18170  The code will capture bytes transfered
18171  before told to stop but let the writer
18172  complete.
18173  */
18174 #ifdef NO_PRINT_LLD
18175  printf("\nError writing block %ld, fd= %d\n", i,
18176  fd);
18177 #else
18178  printf("\nError writing block %lld, fd= %d\n", i,
18179  fd);
18180 #endif
18181  if(wval==-1)
18182  perror("write");
18183  if (!no_unlink)
18184  {
18185  if(check_filename(dummyfile[xx]))
18186  unlink(dummyfile[xx]);
18187  }
18189  exit(127);
18190  }
18191  }
18192  }
18193  if(rlocking)
18194  {
18195  mylockr((int) fd, (int) 0, (int)0,
18196  lock_offset, reclen);
18197  }
18198  if(hist_summary)
18199  {
18200  thread_qtime_stop=time_so_far();
18201  hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
18202  hist_insert(hist_time);
18203  }
18204  if(op_rate_flag)
18205  {
18206  thread_qtime_stop=time_so_far();
18207  desired_op_rate_time = ((double)1.0/(double)op_rate);
18208  actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
18209 /*
18210 printf("Desired rate %g Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
18211  actual_rate, (desired_op_rate_time-actual_rate));
18212 */
18213  if( actual_rate < desired_op_rate_time)
18214  my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
18215  }
18216  if(Q_flag)
18217  {
18218  thread_qtime_stop=time_so_far();
18219 #ifdef NO_PRINT_LLD
18220  fprintf(thread_randwqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
18221 #else
18222  fprintf(thread_randwqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
18223 #endif
18224  }
18227  written_so_far+=reclen/1024;
18228  if(*stop_flag)
18229  {
18230  written_so_far-=reclen/1024;
18232  }
18233  }
18234 
18235 
18236  if(file_lock)
18237  if(mylockf((int) fd, (int) 0, (int)0))
18238  printf("Write unlock failed. %d\n",errno);
18239 
18240 #ifdef ASYNC_IO
18241  if(async_flag)
18242  {
18243  end_async(gc);
18244  gc=0;
18245  }
18246 #endif
18247  if(!xflag)
18248  {
18249  *stop_flag=1;
18250  if(distributed && client_iozone)
18251  send_stop();
18252  }
18253 
18254  if(include_flush)
18255  {
18256  if(mmapflag)
18257  msync(maddr,(size_t)filebytes64,MS_SYNC);
18258  else
18259  fsync(fd);
18260  }
18261  if(include_close)
18262  {
18263  if(mmapflag)
18264  mmap_end(maddr,(unsigned long long)filebytes64);
18265  close(fd);
18266  }
18267  if(!stopped){
18268  temp_time = time_so_far();
18269  child_stat->throughput = ((temp_time - starttime1)-time_res)
18270  -compute_val;
18271  if(child_stat->throughput < (double).000001)
18272  {
18274  if(rec_prob < reclen)
18275  rec_prob = reclen;
18276  res_prob=1;
18277  }
18278 
18279  if(OPS_flag){
18280  /*written_so_far=(written_so_far*1024)/reclen;*/
18281  written_so_far=w_traj_ops_completed;
18282  }
18284  (double)written_so_far/child_stat->throughput;
18285  child_stat->actual = (double)written_so_far;
18286  }
18287  child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
18288  if(cdebug)
18289  {
18290  fprintf(newstdout,"Child %d: throughput %f actual %f \n",(int)chid,child_stat->throughput,
18291  child_stat->actual);
18292  fflush(newstdout);
18293  }
18294  if(cpuutilflag)
18295  {
18297  if (cputime < cputime_res)
18298  cputime = 0.0;
18302  }
18303  if(distributed && client_iozone)
18305  child_stat->actual,
18307  (char)*stop_flag,
18308  (long long)CHILD_STATE_HOLD);
18309  stopped=0;
18310  /*******************************************************************/
18311  /* End random write performance test. ******************************/
18312  /*******************************************************************/
18313  if(debug1)
18314 #ifdef NO_PRINT_LLD
18315  printf("\nChild finished %ld\n",xx);
18316 #else
18317  printf("\nChild finished %lld\n",xx);
18318 #endif
18319  if(!include_close)
18320  {
18321  if(mmapflag)
18322  {
18323  msync(maddr,(size_t)numrecs64*reclen,MS_SYNC); /*Clean up before read starts running*/
18324  mmap_end(maddr,(unsigned long long)numrecs64*reclen);
18325  }else
18326  fsync(fd);
18327 
18328  close(fd);
18329  }
18330  if(Q_flag && (thread_randwqfd !=0) )
18331  fclose(thread_randwqfd);
18332  free(dummyfile[xx]);
18333 
18334  if(L_flag)
18335  {
18336  get_date(now_string);
18337  fprintf(thread_Lwqfd,"%-25s %s","Random write finished: ",
18338  now_string);
18339  fclose(thread_Lwqfd);
18340  }
18341  if(recnum)
18342  free(recnum);
18343  if(hist_summary)
18344  dump_hist("Random Write",(int)xx);
18345  if(distributed && client_iozone)
18346  return(0);
18347 #ifdef NO_THREADS
18348  exit(0);
18349 #else
18350  if(use_thread)
18351  thread_exit();
18352  else
18353  exit(0);
18354 #endif
18355 return(0);
18356 }
int check_filename()
void end_async()
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
void mmap_end()
#define CHILD_STATE_HOLD
Definition: iozone.c:942
char verify
Definition: iozone.c:1513
struct child_stats * child_stat
size_t async_write()
Definition: iozone.c:19038
long long w_traj_bytes_completed
Definition: iozone.c:1327
int no_unlink
Definition: iozone.c:1521
void tell_master_stats()
void fill_buffer()
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
char mmapflag
Definition: iozone.c:1512
char k_flag
Definition: iozone.c:1509
#define MAXNAMESIZE
Definition: iozone.c:833
int fd
Definition: iozone.c:1291
long lrand48()
#define THREAD_RANDOM_WRITE_TEST
Definition: iozone.c:1435
float actual
Definition: iozone.c:463
char * barray[MAXSTREAMS]
Definition: iozone.c:1287
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
void get_date()
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
int thread_exit()
Definition: iozone.c:18526
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long w_traj_ops_completed
Definition: iozone.c:1327
long long reclen
Definition: iozone.c:1535
int num_processors
Definition: iozone.c:1293
double tmp
char read_sync
Definition: iozone.c:1295
int op_rate
Definition: iozone.c:1301
char distributed
Definition: iozone.c:1296
int mylockf()
char use_thread
Definition: iozone.c:1372
unsigned long long genrand64_int64(void)
Definition: iozone.c:23922
float compute_time
Definition: iozone.c:1538
float throughput
Definition: iozone.c:462
void async_init()
Definition: iozone.c:19044
char client_iozone
Definition: iozone.c:1296
void srand48()
char cpuutilflag
Definition: iozone.c:1321
long long debug1
Definition: iozone.c:1373
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
void srand()
char unbuffered
Definition: iozone.c:1509
void wait_for_master_go()
char * initfile()
long long page_size
Definition: iozone.c:428
long long delay
Definition: iozone.c:1533
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char mmapasflag
Definition: iozone.c:1512
size_t async_write_no_copy()
Definition: iozone.c:19032
float cputime
Definition: iozone.c:461
void init_by_array64(unsigned long long *, unsigned long long)
int cdebug
Definition: iozone.c:1478
int begin_proc
Definition: iozone.c:1293
char odsync
Definition: iozone.c:1516
unsigned int length
int op_rate_flag
Definition: iozone.c:1302
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
char dedup
Definition: iozone.c:1304
long long chid
Definition: iozone.c:1529
char L_flag
Definition: iozone.c:1518
void tell_master_ready()
char mfflag
Definition: iozone.c:1334
long long x
Definition: iozone.c:1335
VOLATILE char * stop_flag
Definition: iozone.c:1537
char * buffer
Definition: iozone.c:1366
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
off64_t numrecs64
Definition: iozone.c:1534
long long flag
Definition: iozone.c:458
char mmapssflag
Definition: iozone.c:1512
int share_file
Definition: iozone.c:1309
char dedup_interior
Definition: iozone.c:1304
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
char xflag
Definition: iozone.c:1520
int close()
void send_stop()
Definition: iozone.c:22607
FILE * newstdout
Definition: iozone.c:1475
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
char oflag
Definition: iozone.c:1509
void my_nap()
int rand()
void Poll()
char h_flag
Definition: iozone.c:1509
float walltime
Definition: iozone.c:460
void dump_hist()
char Q_flag
Definition: iozone.c:1517
long long res_prob
Definition: iozone.c:1294
int ioz_processor_bind
Definition: iozone.c:1293
char no_copy_flag
Definition: iozone.c:1519
double temp_time
Definition: iozone.c:1268
static double time_so_far()
Definition: iozone.c:6844
void my_unap()
char include_close
Definition: iozone.c:1519
void hist_insert()
char OPS_flag
Definition: iozone.c:1517
int unlink()
int client_error
Definition: iozone.c:1398
void exit()
int rlocking
Definition: iozone.c:1308
char mmapnsflag
Definition: iozone.c:1512
int fsync()
double cputime_res
Definition: iozone.c:1271
#define MAXSTREAMS
Definition: iozone.c:813
long long off64_t
Definition: iozone.c:357
unsigned long cache_size
Definition: iozone.c:1375
int errno
int i
Definition: fileop.c:140
int direct_flag
Definition: iozone.c:1527
#define CHILD_STATE_READY
Definition: iozone.c:944
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ thread_read_test() [1/2]

void*() thread_read_test ( )
Here is the caller graph for this function:

◆ thread_read_test() [2/2]

void* thread_read_test ( x  )

Definition at line 14230 of file iozone.c.

14232 {
14233  long long xx,xx2;
14234  struct child_stats *child_stat;
14235  double walltime, cputime;
14236  long long r_traj_bytes_completed;
14237  long long r_traj_ops_completed;
14238  int fd;
14239  FILE *r_traj_fd,*thread_rqfd;
14240  FILE *thread_Lwqfd;
14241  long long flags = 0;
14242  off64_t traj_offset;
14243  off64_t lock_offset=0;
14244  double starttime1 = 0;
14245  float delay = 0;
14246  double temp_time;
14247  double thread_qtime_start,thread_qtime_stop;
14248  double hist_time;
14249  double desired_op_rate_time;
14250  double actual_rate;
14251  double compute_val = (double)0;
14252  off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far;
14253  long long recs_per_buffer,traj_size;
14254  off64_t i;
14255  char *dummyfile[MAXSTREAMS]; /* name of dummy file */
14256  char *nbuff=0;
14257  char *maddr=0;
14258  char *wmaddr=0;
14259  char tmpname[256];
14260  volatile char *buffer1;
14261  char now_string[30];
14262  int anwser,bind_cpu;
14263  long wval;
14264 #if defined(VXFS) || defined(solaris)
14265  int test_foo = 0;
14266 #endif
14267 #ifdef ASYNC_IO
14268  struct cache *gc=0;
14269 #else
14270  long long *gc=0;
14271 #endif
14272 
14273  if(compute_flag)
14275  thread_rqfd=thread_Lwqfd=r_traj_fd=(FILE *)0;
14276  hist_time=traj_offset=thread_qtime_stop=thread_qtime_start=0;
14277  walltime=cputime=0;
14278  anwser=bind_cpu=0;
14280  written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
14281  recs_per_buffer = cache_size/reclen ;
14282  if(r_traj_flag)
14283  {
14286  }
14287  else
14288  {
14290  }
14291 
14292 #ifdef NO_THREADS
14293  xx=chid;
14294 #else
14295  if(use_thread)
14296  xx = (long long)((long)x);
14297  else
14298  {
14299  xx=chid;
14300  }
14301 #endif
14302 #ifndef NO_THREADS
14303 #if defined( _HPUX_SOURCE ) || defined ( linux )
14304  if(ioz_processor_bind)
14305  {
14306  bind_cpu=(begin_proc+(int)xx)%num_processors;
14307 #if defined(_HPUX_SOURCE)
14308  pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
14309  (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
14310 #else
14311  cpu_set_t cpuset;
14312 
14313  CPU_ZERO(&cpuset);
14314  CPU_SET(bind_cpu, &cpuset);
14315 
14316  pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
14317 #endif
14318  my_nap(40); /* Switch to new cpu */
14319  }
14320 #endif
14321 #endif
14322  if(use_thread)
14323  nbuff=barray[xx];
14324  else
14325  nbuff=buffer;
14326  dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
14327  xx2=xx;
14328  if(share_file)
14329  xx2=(long long)0;
14330  if(mfflag)
14331  {
14332 #ifdef NO_PRINT_LLD
14333  sprintf(dummyfile[xx],"%s",filearray[xx2]);
14334 #else
14335  sprintf(dummyfile[xx],"%s",filearray[xx2]);
14336 #endif
14337  }
14338  else
14339  {
14340 #ifdef NO_PRINT_LLD
14341  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
14342 #else
14343  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
14344 #endif
14345  }
14346  if(oflag)
14347  flags=O_RDONLY|O_SYNC;
14348  else
14349  flags=O_RDONLY;
14350 #if defined(_HPUX_SOURCE) || defined(linux)
14351  if(read_sync)
14352  flags |=O_RSYNC|O_SYNC;
14353 #endif
14354 
14355 #if ! defined(DONT_HAVE_O_DIRECT)
14356 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
14357  if(direct_flag)
14358  flags |=O_DIRECT;
14359 #endif
14360 #if defined(TRU64)
14361  if(direct_flag)
14362  flags |=O_DIRECTIO;
14363 #endif
14364 #endif
14365 #if defined(Windows)
14366  if(unbuffered)
14367  {
14368  hand=CreateFile(dummyfile[xx],
14369  GENERIC_READ|GENERIC_WRITE,
14370  FILE_SHARE_WRITE|FILE_SHARE_READ,
14371  NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
14372  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
14373  NULL);
14374  SetFilePointer(hand,(LONG)0,0,FILE_BEGIN);
14375  }
14376  else
14377  {
14378 #endif
14379  if((fd = I_OPEN(dummyfile[xx], (int)flags,0))<0)
14380  {
14382  if(distributed && client_iozone)
14383  send_stop();
14384  perror(dummyfile[xx]);
14385  exit(130);
14386  }
14387 #if defined(Windows)
14388  }
14389 #endif
14390 #ifdef ASYNC_IO
14391  if(async_flag)
14392  async_init(&gc,fd,direct_flag);
14393 #endif
14394 #ifdef VXFS
14395  if(direct_flag)
14396  {
14397  ioctl(fd,VX_SETCACHE,VX_DIRECT);
14398  ioctl(fd,VX_GETCACHE,&test_foo);
14399  if(test_foo == 0)
14400  {
14401  if(!client_iozone)
14402  printf("\nVxFS advanced setcache feature not available.\n");
14403  exit(3);
14404  }
14405  }
14406 #endif
14407 #if defined(solaris)
14408  if(direct_flag)
14409  {
14410  test_foo = directio(fd, DIRECTIO_ON);
14411  if(test_foo != 0)
14412  {
14413  if(!client_iozone)
14414  printf("\ndirectio not available.\n");
14415  exit(3);
14416  }
14417  }
14418 #endif
14419  if(mmapflag)
14420  {
14421  maddr=(char *)initfile(fd,(numrecs64*reclen),0,PROT_READ);
14422  }
14423  child_stat = (struct child_stats *)&shmaddr[xx];
14424  child_stat->throughput = 0;
14425  child_stat->actual = 0;
14426  if(debug1)
14427  {
14428  if(use_thread)
14429 #ifdef NO_PRINT_LLD
14430  printf("\nStarting child %ld\n",xx);
14431 #else
14432  printf("\nStarting child %lld\n",xx);
14433 #endif
14434  else
14435 #ifdef NO_PRINT_LLD
14436  printf("\nStarting process %d slot %ld\n",getpid(),xx);
14437 #else
14438  printf("\nStarting process %d slot %lld\n",getpid(),xx);
14439 #endif
14440 
14441  }
14442  /*****************/
14443  /* Children only */
14444  /*****************/
14445  if(Q_flag)
14446  {
14447  sprintf(tmpname,"Child_%d_rol.dat",(int)xx);
14448  thread_rqfd=fopen(tmpname,"a");
14449  if(thread_rqfd==0)
14450  {
14452  if(distributed && client_iozone)
14453  send_stop();
14454  printf("Unable to open %s\n",tmpname);
14455  exit(40);
14456  }
14457  fprintf(thread_rqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
14458  }
14459  if(L_flag)
14460  {
14461  sprintf(tmpname,"Child_%d.log",(int)xx);
14462  thread_Lwqfd=fopen(tmpname,"a");
14463  if(thread_Lwqfd==0)
14464  {
14466  if(distributed && client_iozone)
14467  send_stop();
14468  printf("Unable to open %s\n",tmpname);
14469  exit(40);
14470  }
14471  get_date(now_string);
14472  fprintf(thread_Lwqfd,"%-25s %s","Read test start: ",now_string);
14473  }
14474 
14475  if(r_traj_flag)
14477  if(fetchon)
14478  fetchit(nbuff,reclen);
14479  child_stat=(struct child_stats *)&shmaddr[xx];
14481  if(distributed && client_iozone)
14482  {
14485  }
14486  else
14487  {
14488  /* Wait for signal from parent */
14490  Poll((long long)1);
14491  }
14492  if(file_lock)
14493  if(mylockf((int) fd, (int) 1, (int)1) != 0)
14494  printf("File lock for read failed. %d\n",errno);
14495  starttime1 = time_so_far();
14496  if(cpuutilflag)
14497  {
14498  walltime = starttime1;
14499  cputime = cputime_so_far();
14500  }
14501 
14502  if(r_traj_flag)
14503  rewind(r_traj_fd);
14504  for(i=0; i<numrecs64; i++){
14505  traj_offset= i*reclen;
14506  if(disrupt_flag && ((i%DISRUPT)==0))
14507  {
14508 #if defined(Windows)
14509 
14510  if(unbuffered)
14511  disruptw(hand);
14512  else
14513  disrupt(fd);
14514 #else
14515  disrupt(fd);
14516 #endif
14517  }
14518  if(r_traj_flag)
14519  {
14520  traj_offset=get_traj(r_traj_fd, (long long *)&traj_size,(float *)&delay,(long)0);
14521  reclen=traj_size;
14522 #if defined(Windows)
14523  if(unbuffered)
14524  SetFilePointer(hand,(LONG)traj_offset,0,FILE_BEGIN);
14525  else
14526 #endif
14527  I_LSEEK(fd,traj_offset,SEEK_SET);
14528  }
14529  if(Q_flag)
14530  {
14531 #if defined(Windows)
14532  if(unbuffered)
14533  traj_offset=SetFilePointer(hand,0,0,FILE_CURRENT);
14534  else
14535 #endif
14536  traj_offset=I_LSEEK(fd,0,SEEK_CUR);
14537  }
14538  if(rlocking)
14539  {
14540  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
14541  mylockr((int) fd, (int) 1, (int)1,
14542  lock_offset, reclen);
14543  }
14544  if(compute_flag)
14545  compute_val+=do_compute(delay);
14546  if(*stop_flag)
14547  {
14548  if(debug1)
14549  printf("\n(%ld) Stopped by another 2\n", (long)xx);
14550  break;
14551  }
14552  if(purge)
14553  purgeit(nbuff,reclen);
14554  if(Q_flag || hist_summary || op_rate_flag)
14555  {
14556  thread_qtime_start=time_so_far();
14557  }
14558  if(mmapflag)
14559  {
14560  wmaddr = &maddr[i*reclen];
14561  fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
14562  }
14563  else
14564  {
14565  if(async_flag)
14566  {
14567  if(no_copy_flag)
14568  async_read_no_copy(gc, (long long)fd, &buffer1, (i*reclen), reclen,
14569  1LL,(numrecs64*reclen),depth);
14570  else
14571  async_read(gc, (long long)fd, nbuff, (i*reclen), reclen,
14572  1LL,(numrecs64*reclen),depth);
14573  }
14574  else
14575  {
14576 #if defined(Windows)
14577  if(unbuffered)
14578  {
14579  ReadFile(hand,nbuff,reclen,(LPDWORD)&wval,0);
14580  }
14581  else
14582 #endif
14583  wval=read((int)fd, (void*)nbuff, (size_t) reclen);
14584  if(wval != reclen)
14585  {
14586  if(*stop_flag)
14587  {
14588  if(debug1)
14589  printf("\n(%ld) Stopped by another 2\n", (long)xx);
14590  break;
14591  }
14592 #ifdef NO_PRINT_LLD
14593  printf("\nError reading block %ld, fd= %d\n", i,
14594  fd);
14595 #else
14596  printf("\nError reading block %lld, fd= %d\n", i,
14597  fd);
14598 #endif
14599  perror("read");
14600  if (!no_unlink)
14601  {
14602  if(check_filename(dummyfile[xx]))
14603  unlink(dummyfile[xx]);
14604  }
14606  exit(132);
14607  }
14608  }
14609  }
14610  if(verify){
14611  if(async_flag && no_copy_flag)
14612  {
14614  if (!no_unlink)
14615  {
14616  if(check_filename(dummyfile[xx]))
14617  unlink(dummyfile[xx]);
14618  }
14620  exit(133);
14621  }
14622  }
14623  else
14624  {
14625  if(verify_buffer(nbuff,reclen,(off64_t)i,reclen,(long long)pattern,sverify)){
14626  if (!no_unlink)
14627  {
14628  if(check_filename(dummyfile[xx]))
14629  unlink(dummyfile[xx]);
14630  }
14632  exit(134);
14633  }
14634  }
14635  }
14636  if(async_flag && no_copy_flag)
14637  async_release(gc);
14638  read_so_far+=reclen/1024;
14641  if(*stop_flag)
14642  {
14643  read_so_far-=reclen/1024;
14645  }
14646  if(hist_summary)
14647  {
14648  thread_qtime_stop=time_so_far();
14649  hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
14650  hist_insert(hist_time);
14651  }
14652  if(op_rate_flag)
14653  {
14654  thread_qtime_stop=time_so_far();
14655  desired_op_rate_time = ((double)1.0/(double)op_rate);
14656  actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
14657 /*
14658 printf("Desired rate %g Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
14659  actual_rate, (desired_op_rate_time-actual_rate));
14660 */
14661  if( actual_rate < desired_op_rate_time)
14662  my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
14663  }
14664  if(Q_flag)
14665  {
14666  thread_qtime_stop=time_so_far();
14667 #ifdef NO_PRINT_LLD
14668  fprintf(thread_rqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
14669 #else
14670  fprintf(thread_rqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
14671 #endif
14672  }
14673 
14674  if(rlocking)
14675  {
14676  mylockr((int) fd, (int) 0, (int)1,
14677  lock_offset, reclen);
14678  }
14679  }
14680  if(file_lock)
14681  if(mylockf((int) fd, (int) 0, (int)1))
14682  printf("Read unlock failed. %d\n",errno);
14683 #ifdef ASYNC_IO
14684  if(async_flag)
14685  {
14686  end_async(gc);
14687  gc=0;
14688  }
14689 #endif
14690  if(include_flush)
14691  {
14692  if(mmapflag)
14693  {
14694  msync(maddr,(size_t)(filebytes64),MS_SYNC);
14695  }else
14696  fsync(fd);
14697  }
14698  if(include_close)
14699  {
14700  if(mmapflag)
14701  {
14702  mmap_end(maddr,(unsigned long long)filebytes64);
14703  }
14704 #if defined(Windows)
14705  if(unbuffered)
14706  CloseHandle(hand);
14707  else
14708 #endif
14709  close(fd);
14710  }
14711  temp_time = time_so_far();
14712  child_stat=(struct child_stats *)&shmaddr[xx];
14713  child_stat->throughput = ((temp_time - starttime1)-time_res)
14714  -compute_val;
14715  if(child_stat->throughput < (double).000001)
14716  {
14718  if(rec_prob < reclen)
14719  rec_prob = reclen;
14720  res_prob=1;
14721  }
14722 
14723  if(OPS_flag){
14724  /*read_so_far=(read_so_far*1024)/reclen;*/
14725  read_so_far=r_traj_ops_completed;
14726  }
14727  child_stat->throughput = read_so_far/child_stat->throughput;
14728  child_stat->actual = read_so_far;
14729  if(!xflag)
14730  {
14731  *stop_flag=1;
14732  if(distributed && client_iozone)
14733  send_stop();
14734  }
14735  if(cdebug)
14736  {
14737  fprintf(newstdout,"Child %d: throughput %f actual %f \n",(int)chid,child_stat->throughput,
14738  child_stat->actual);
14739  fflush(newstdout);
14740  }
14741  if(cpuutilflag)
14742  {
14744  if (cputime < cputime_res)
14745  cputime = 0.0;
14749  }
14750  if(distributed && client_iozone)
14752  child_stat->actual,
14754  (char)*stop_flag,
14755  (long long)CHILD_STATE_HOLD);
14756  child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
14757  /*fsync(fd);*/
14758  if(!include_close)
14759  {
14760  if(mmapflag)
14761  {
14762  msync(maddr,(size_t)(filebytes64),MS_SYNC);
14763  mmap_end(maddr,(unsigned long long)filebytes64);
14764  }else
14765  fsync(fd);
14766 #if defined(Windows)
14767  if(unbuffered)
14768  CloseHandle(hand);
14769  else
14770 #endif
14771  close(fd);
14772  }
14773  if(Q_flag && (thread_rqfd !=0) )
14774  fclose(thread_rqfd);
14775  free(dummyfile[xx]);
14776  if(r_traj_flag)
14777  fclose(r_traj_fd);
14778  if(debug1)
14779 #ifdef NO_PRINT_LLD
14780  printf("\nChild finished %ld\n",xx);
14781 #else
14782  printf("\nChild finished %lld\n",xx);
14783 #endif
14784 
14785  if(L_flag)
14786  {
14787  get_date(now_string);
14788  fprintf(thread_Lwqfd,"%-25s %s","Read test finished: ",now_string);
14789  fclose(thread_Lwqfd);
14790  }
14791  if(hist_summary)
14792  dump_hist("Read",(int)xx);
14793  if(distributed && client_iozone)
14794  return(0);
14795 #ifdef NO_THREADS
14796  exit(0);
14797 #else
14798  if(use_thread)
14799  thread_exit();
14800  else
14801  exit(0);
14802 #endif
14803 return(0);
14804 }
int check_filename()
void end_async()
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
FILE * r_traj_fd
Definition: iozone.c:1367
long long r_traj_fsize
Definition: iozone.c:1325
void mmap_end()
#define CHILD_STATE_HOLD
Definition: iozone.c:942
long long get_traj()
char verify
Definition: iozone.c:1513
struct child_stats * child_stat
int no_unlink
Definition: iozone.c:1521
void tell_master_stats()
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
char mmapflag
Definition: iozone.c:1512
#define MAXNAMESIZE
Definition: iozone.c:833
int fd
Definition: iozone.c:1291
#define DISRUPT
Definition: iozone.c:779
float actual
Definition: iozone.c:463
char * barray[MAXSTREAMS]
Definition: iozone.c:1287
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
void get_date()
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
int thread_exit()
Definition: iozone.c:18526
char disrupt_flag
Definition: iozone.c:1520
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
void disrupt()
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long reclen
Definition: iozone.c:1535
int num_processors
Definition: iozone.c:1293
char read_sync
Definition: iozone.c:1295
int op_rate
Definition: iozone.c:1301
char distributed
Definition: iozone.c:1296
int mylockf()
char use_thread
Definition: iozone.c:1372
float compute_time
Definition: iozone.c:1538
float throughput
Definition: iozone.c:462
void async_init()
Definition: iozone.c:19044
int async_read_no_copy()
Definition: iozone.c:19050
char client_iozone
Definition: iozone.c:1296
char cpuutilflag
Definition: iozone.c:1321
long long debug1
Definition: iozone.c:1373
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
char unbuffered
Definition: iozone.c:1509
void wait_for_master_go()
char * initfile()
long long delay
Definition: iozone.c:1533
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
float cputime
Definition: iozone.c:461
int cdebug
Definition: iozone.c:1478
int begin_proc
Definition: iozone.c:1293
int async_read()
Definition: iozone.c:19026
char * buffer1
Definition: iozone.c:1366
int op_rate_flag
Definition: iozone.c:1302
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
long long chid
Definition: iozone.c:1529
char L_flag
Definition: iozone.c:1518
void tell_master_ready()
char mfflag
Definition: iozone.c:1334
long long x
Definition: iozone.c:1335
VOLATILE char * stop_flag
Definition: iozone.c:1537
char * buffer
Definition: iozone.c:1366
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
off64_t numrecs64
Definition: iozone.c:1534
long long flag
Definition: iozone.c:458
int share_file
Definition: iozone.c:1309
long long verify_buffer(char *buffer, long long length, off64_t recnum, long long recsize, unsigned long long patt, char sverify)
Definition: iozone.c:6940
FILE * open_r_traj()
Definition: iozone.c:19685
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
char xflag
Definition: iozone.c:1520
int close()
void send_stop()
Definition: iozone.c:22607
FILE * newstdout
Definition: iozone.c:1475
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
char oflag
Definition: iozone.c:1509
void async_release()
Definition: iozone.c:19056
void my_nap()
#define THREAD_READ_TEST
Definition: iozone.c:1431
int r_traj_flag
Definition: iozone.c:1523
void Poll()
float walltime
Definition: iozone.c:460
void dump_hist()
char Q_flag
Definition: iozone.c:1517
long long res_prob
Definition: iozone.c:1294
int ioz_processor_bind
Definition: iozone.c:1293
char no_copy_flag
Definition: iozone.c:1519
long long r_traj_ops_completed
Definition: iozone.c:1326
double temp_time
Definition: iozone.c:1268
static double time_so_far()
Definition: iozone.c:6844
void my_unap()
char include_close
Definition: iozone.c:1519
void hist_insert()
char OPS_flag
Definition: iozone.c:1517
int unlink()
int client_error
Definition: iozone.c:1398
void exit()
int rlocking
Definition: iozone.c:1308
long long r_traj_ops
Definition: iozone.c:1325
int fsync()
double cputime_res
Definition: iozone.c:1271
#define MAXSTREAMS
Definition: iozone.c:813
long long off64_t
Definition: iozone.c:357
unsigned long cache_size
Definition: iozone.c:1375
int errno
int i
Definition: fileop.c:140
long long r_traj_bytes_completed
Definition: iozone.c:1326
int direct_flag
Definition: iozone.c:1527
#define CHILD_STATE_READY
Definition: iozone.c:944
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ thread_reverse_read_test() [1/2]

void*() thread_reverse_read_test ( )
Here is the caller graph for this function:

◆ thread_reverse_read_test() [2/2]

void* thread_reverse_read_test ( x  )

Definition at line 15917 of file iozone.c.

15919 {
15920  long long xx,xx2;
15921  char *nbuff;
15922  struct child_stats *child_stat;
15923  int fd;
15924  long long flags = 0;
15925  double walltime, cputime;
15926  double thread_qtime_stop,thread_qtime_start;
15927  double hist_time;
15928  double desired_op_rate_time;
15929  double actual_rate;
15930  double starttime2 = 0;
15931  float delay = 0;
15932  double temp_time;
15933  double compute_val = (double)0;
15934  long long recs_per_buffer;
15935  off64_t i,t_offset;
15936  off64_t lock_offset=0;
15937  off64_t current_position=0;
15938  off64_t written_so_far, reverse_read, re_read_so_far,read_so_far;
15939  char *dummyfile[MAXSTREAMS]; /* name of dummy file */
15940  char *maddr=0;
15941  char *wmaddr=0;
15942  char now_string[30];
15943  volatile char *buffer1;
15944  int anwser,bind_cpu;
15945  off64_t traj_offset;
15946  char tmpname[256];
15947  FILE *thread_revqfd=0;
15948  FILE *thread_Lwqfd=0;
15949 #if defined(VXFS) || defined(solaris)
15950  int test_foo = 0;
15951 #endif
15952 #ifdef ASYNC_IO
15953  struct cache *gc=0;
15954 #else
15955  long long *gc=0;
15956 #endif
15957  /*****************/
15958  /* Children only */
15959  /*****************/
15960  if(compute_flag)
15962  hist_time=thread_qtime_stop=thread_qtime_start=0;
15963  traj_offset=walltime=cputime=0;
15964  anwser=bind_cpu=0;
15965  written_so_far=read_so_far=reverse_read=re_read_so_far=0;
15966  recs_per_buffer = cache_size/reclen ;
15967 #ifdef NO_THREADS
15968  xx=chid;
15969 #else
15970  if(use_thread)
15971  xx = (long long)((long)x);
15972  else
15973  {
15974  xx=chid;
15975  }
15976 #endif
15977 #ifndef NO_THREADS
15978 #if defined( _HPUX_SOURCE ) || defined ( linux )
15979  if(ioz_processor_bind)
15980  {
15981  bind_cpu=(begin_proc+(int)xx)%num_processors;
15982 #if defined(_HPUX_SOURCE)
15983  pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
15984  (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
15985 #else
15986  cpu_set_t cpuset;
15987 
15988  CPU_ZERO(&cpuset);
15989  CPU_SET(bind_cpu, &cpuset);
15990 
15991  pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
15992 #endif
15993  my_nap(40); /* Switch to new cpu */
15994  }
15995 #endif
15996 #endif
15997  if(use_thread)
15998  nbuff=barray[xx];
15999  else
16000  nbuff=buffer;
16001  if(debug1)
16002  {
16003  if(use_thread)
16004 #ifdef NO_PRINT_LLD
16005  printf("\nStarting child %ld\n",xx);
16006 #else
16007  printf("\nStarting child %lld\n",xx);
16008 #endif
16009  else
16010 #ifdef NO_PRINT_LLD
16011  printf("\nStarting process %d slot %ld\n",getpid(),xx);
16012 #else
16013  printf("\nStarting process %d slot %lld\n",getpid(),xx);
16014 #endif
16015 
16016  }
16017  dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
16018  xx2=xx;
16019  if(share_file)
16020  xx2=(long long)0;
16021  if(mfflag)
16022  {
16023 #ifdef NO_PRINT_LLD
16024  sprintf(dummyfile[xx],"%s",filearray[xx2]);
16025 #else
16026  sprintf(dummyfile[xx],"%s",filearray[xx2]);
16027 #endif
16028  }
16029  else
16030  {
16031 #ifdef NO_PRINT_LLD
16032  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
16033 #else
16034  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
16035 #endif
16036  }
16037  if(oflag)
16038  flags=O_RDONLY|O_SYNC;
16039  else
16040  flags=O_RDONLY;
16041 #if defined(_HPUX_SOURCE) || defined(linux)
16042  if(read_sync)
16043  flags |=O_RSYNC|O_SYNC;
16044 #endif
16045 
16046 #if ! defined(DONT_HAVE_O_DIRECT)
16047 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
16048  if(direct_flag)
16049  flags |=O_DIRECT;
16050 #endif
16051 #if defined(TRU64)
16052  if(direct_flag)
16053  flags |=O_DIRECTIO;
16054 #endif
16055 #endif
16056 #if defined(Windows)
16057  if(unbuffered)
16058  {
16059  hand=CreateFile(dummyfile[xx],
16060  GENERIC_READ|GENERIC_WRITE,
16061  FILE_SHARE_WRITE|FILE_SHARE_READ,
16062  NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
16063  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
16064  NULL);
16065  }
16066 #endif
16067 
16068  if((fd = I_OPEN(dummyfile[xx], ((int)flags),0))<0)
16069  {
16071  if(distributed && client_iozone)
16072  send_stop();
16073  perror(dummyfile[xx]);
16074  exit(140);
16075  }
16076 #ifdef ASYNC_IO
16077  if(async_flag)
16078  async_init(&gc,fd,direct_flag);
16079 #endif
16080 #ifdef VXFS
16081  if(direct_flag)
16082  {
16083  ioctl(fd,VX_SETCACHE,VX_DIRECT);
16084  ioctl(fd,VX_GETCACHE,&test_foo);
16085  if(test_foo == 0)
16086  {
16087  if(!client_iozone)
16088  printf("\nVxFS advanced setcache feature not available.\n");
16089  exit(3);
16090  }
16091  }
16092 #endif
16093 #if defined(solaris)
16094  if(direct_flag)
16095  {
16096  test_foo = directio(fd, DIRECTIO_ON);
16097  if(test_foo != 0)
16098  {
16099  if(!client_iozone)
16100  printf("\ndirectio not available.\n");
16101  exit(3);
16102  }
16103  }
16104 #endif
16105  if(mmapflag)
16106  {
16107  maddr=(char *)initfile(fd,(numrecs64*reclen),0,PROT_READ);
16108  }
16109  if(fetchon)
16110  fetchit(nbuff,reclen);
16111  if(Q_flag)
16112  {
16113  sprintf(tmpname,"Child_%d_revol.dat",(int)xx);
16114  thread_revqfd=fopen(tmpname,"a");
16115  if(thread_revqfd==0)
16116  {
16118  if(distributed && client_iozone)
16119  send_stop();
16120  printf("Unable to open %s\n",tmpname);
16121  exit(40);
16122  }
16123  fprintf(thread_revqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
16124  }
16125  if(L_flag)
16126  {
16127  sprintf(tmpname,"Child_%d.log",(int)xx);
16128  thread_Lwqfd=fopen(tmpname,"a");
16129  if(thread_Lwqfd==0)
16130  {
16132  if(distributed && client_iozone)
16133  send_stop();
16134  printf("Unable to open %s\n",tmpname);
16135  exit(40);
16136  }
16137  get_date(now_string);
16138  fprintf(thread_Lwqfd,"%-25s %s","Reverse read start: ",now_string);
16139  }
16140  child_stat = (struct child_stats *)&shmaddr[xx];
16141  child_stat->throughput = 0;
16142  child_stat->actual = 0;
16144  if(distributed && client_iozone)
16145  {
16148  }
16149  else
16150  {
16151  while(child_stat->flag!=CHILD_STATE_BEGIN) /* Wait for signal from parent */
16152  Poll((long long)1);
16153  }
16154  starttime2 = time_so_far();
16155  if(cpuutilflag)
16156  {
16157  walltime = starttime2;
16158  cputime = cputime_so_far();
16159  }
16160 
16161  t_offset = (off64_t)reclen;
16162  if (!(h_flag || k_flag || mmapflag))
16163  {
16164  if(check_filename(dummyfile[xx]))
16165  {
16166  if((I_LSEEK( fd, -t_offset, SEEK_END ))<0)
16167  {
16169  if(distributed && client_iozone)
16170  send_stop();
16171  perror("lseek");
16172  exit(142);
16173  }
16174  }
16175  else
16176  {
16177  if(I_LSEEK( fd, (numrecs64*reclen)-t_offset, SEEK_SET )<0)
16178  {
16180  if(distributed && client_iozone)
16181  send_stop();
16182  perror("lseek");
16183  exit(77);
16184  }
16185  }
16186  }
16187  current_position=(reclen*numrecs64)-reclen;
16188  if(file_lock)
16189  if(mylockf((int) fd, (int) 1, (int)1)!=0)
16190  printf("File lock for read failed. %d\n",errno);
16191  for(i=0; i<numrecs64; i++)
16192  {
16193  if(rlocking)
16194  {
16195  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
16196  mylockr((int) fd, (int) 1, (int)1,
16197  lock_offset, reclen);
16198  }
16199  if(disrupt_flag && ((i%DISRUPT)==0))
16200  {
16201  disrupt(fd);
16202  }
16203  if(compute_flag)
16204  compute_val+=do_compute(delay);
16205  if(Q_flag)
16206  {
16207  traj_offset=I_LSEEK(fd,0,SEEK_CUR);
16208  }
16209  if(*stop_flag)
16210  {
16211  if(debug1)
16212  printf("\n(%ld) Stopped by another 3\n", (long)xx);
16213  break;
16214  }
16215  if(purge)
16216  purgeit(nbuff,reclen);
16217  if(Q_flag || hist_summary || op_rate_flag)
16218  {
16219  thread_qtime_start=time_so_far();
16220  }
16221  if(mmapflag)
16222  {
16223  wmaddr = &maddr[current_position];
16224  fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
16225  }
16226  else
16227  {
16228  if(async_flag)
16229  {
16230  if(no_copy_flag)
16231  async_read_no_copy(gc, (long long)fd, &buffer1, (current_position),
16232  reclen, -1LL,(numrecs64*reclen),depth);
16233  else
16234  async_read(gc, (long long)fd, nbuff, (current_position),reclen,
16235  -1LL,(numrecs64*reclen),depth);
16236  }
16237  else
16238  {
16239  if(read((int)fd, (void*)nbuff, (size_t) reclen) != reclen)
16240  {
16241  if(*stop_flag)
16242  {
16243  if(debug1)
16244  printf("\n(%ld) Stopped by another 4\n", (long)xx);
16245  break;
16246  }
16247 #ifdef NO_PRINT_LLD
16248  printf("\nError reading block %ld\n", i);
16249 #else
16250  printf("\nError reading block %lld\n", i);
16251 #endif
16252  perror("read");
16253  if (!no_unlink)
16254  {
16255  if(check_filename(dummyfile[xx]))
16256  unlink(dummyfile[xx]);
16257  }
16259  exit(144);
16260  }
16261  }
16262  }
16263  if(verify){
16264  if(async_flag && no_copy_flag)
16265  {
16266  if(verify_buffer(buffer1,reclen,(off64_t)(current_position/reclen),reclen,(long long)pattern,sverify)){
16267  if (!no_unlink)
16268  {
16269  if(check_filename(dummyfile[xx]))
16270  unlink(dummyfile[xx]);
16271  }
16273  exit(145);
16274  }
16275  }
16276  else
16277  {
16278  if(verify_buffer(nbuff,reclen,(off64_t)(current_position/reclen),reclen,(long long)pattern,sverify)){
16279  if (!no_unlink)
16280  {
16281  if(check_filename(dummyfile[xx]))
16282  unlink(dummyfile[xx]);
16283  }
16285  exit(146);
16286  }
16287  }
16288  }
16289  if(rlocking)
16290  {
16291  mylockr((int) fd, (int) 0, (int)1,
16292  lock_offset, reclen);
16293  }
16294  current_position+=reclen;
16295  if(async_flag && no_copy_flag)
16296  async_release(gc);
16297  t_offset = (off64_t)reclen*2;
16298  if (!(h_flag || k_flag || mmapflag))
16299  {
16300  I_LSEEK( fd, -t_offset, SEEK_CUR );
16301  }
16302  current_position-=(2 *reclen);
16303  reverse_read +=reclen/1024;
16304  if(*stop_flag)
16305  {
16306  reverse_read -=reclen/1024;
16307  }
16308  if(hist_summary)
16309  {
16310  thread_qtime_stop=time_so_far();
16311  hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
16312  hist_insert(hist_time);
16313  }
16314  if(op_rate_flag)
16315  {
16316  thread_qtime_stop=time_so_far();
16317  desired_op_rate_time = ((double)1.0/(double)op_rate);
16318  actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
16319 /*
16320 printf("Desired rate %g Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
16321  actual_rate, (desired_op_rate_time-actual_rate));
16322 */
16323  if( actual_rate < desired_op_rate_time)
16324  my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
16325  }
16326  if(Q_flag)
16327  {
16328  thread_qtime_stop=time_so_far();
16329 #ifdef NO_PRINT_LLD
16330  fprintf(thread_revqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
16331 #else
16332  fprintf(thread_revqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
16333 #endif
16334  }
16335  }
16336  if(file_lock)
16337  if(mylockf((int) fd,(int)0, (int)1))
16338  printf("Read unlock failed %d\n",errno);
16339 #ifdef ASYNC_IO
16340  if(async_flag)
16341  {
16342  end_async(gc);
16343  gc=0;
16344  }
16345 #endif
16346  if(include_flush)
16347  {
16348  if(mmapflag)
16349  {
16350  msync(maddr,(size_t)(numrecs64*reclen),MS_SYNC);
16351  }else
16352  fsync(fd);
16353  }
16354  if(include_close)
16355  {
16356  if(mmapflag)
16357  {
16358  mmap_end(maddr,(unsigned long long)numrecs64*reclen);
16359  }
16360  close(fd);
16361  }
16362  temp_time = time_so_far();
16363  child_stat->throughput = ((temp_time - starttime2)-time_res)
16364  -compute_val;
16365  if(child_stat->throughput < (double).000001)
16366  {
16368  if(rec_prob < reclen)
16369  rec_prob = reclen;
16370  res_prob=1;
16371  }
16372  if(OPS_flag){
16373  reverse_read=(reverse_read*1024)/reclen;
16374  }
16375  child_stat->throughput = reverse_read/child_stat->throughput;
16376  child_stat->actual = reverse_read;
16377  if(!xflag)
16378  {
16379  *stop_flag=1;
16380  if(distributed && client_iozone)
16381  send_stop();
16382  }
16383  if(cpuutilflag)
16384  {
16386  if (cputime < cputime_res)
16387  cputime = 0.0;
16391  }
16392  if(distributed && client_iozone)
16394  child_stat->actual,
16396  (char)*stop_flag,
16397  (long long)CHILD_STATE_HOLD);
16398  child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
16399  if(!include_close)
16400  {
16401  if(mmapflag)
16402  {
16403  msync(maddr,(size_t)(numrecs64*reclen),MS_SYNC);
16404  mmap_end(maddr,(unsigned long long)numrecs64*reclen);
16405  }else
16406  fsync(fd);
16407  close(fd);
16408  }
16409  free(dummyfile[xx]);
16410  if(Q_flag && (thread_revqfd !=0) )
16411  fclose(thread_revqfd);
16412  if(debug1)
16413 #ifdef NO_PRINT_LLD
16414  printf("\nChild finished %ld\n",xx);
16415 #else
16416  printf("\nChild finished %lld\n",xx);
16417 #endif
16418 
16419  if(L_flag)
16420  {
16421  get_date(now_string);
16422  fprintf(thread_Lwqfd,"%-25s %s","Reverse read finished: ",
16423  now_string);
16424  fclose(thread_Lwqfd);
16425  }
16426  if(hist_summary)
16427  dump_hist("Read Backwards",(int)xx);
16428  if(distributed && client_iozone)
16429  return(0);
16430 #ifdef NO_THREADS
16431  exit(0);
16432 #else
16433  if(use_thread)
16434  thread_exit();
16435  else
16436  exit(0);
16437 #endif
16438 return(0);
16439 }
int check_filename()
void end_async()
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
void mmap_end()
#define CHILD_STATE_HOLD
Definition: iozone.c:942
char verify
Definition: iozone.c:1513
struct child_stats * child_stat
int no_unlink
Definition: iozone.c:1521
void tell_master_stats()
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
char mmapflag
Definition: iozone.c:1512
char k_flag
Definition: iozone.c:1509
#define MAXNAMESIZE
Definition: iozone.c:833
int fd
Definition: iozone.c:1291
#define DISRUPT
Definition: iozone.c:779
float actual
Definition: iozone.c:463
char * barray[MAXSTREAMS]
Definition: iozone.c:1287
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
void get_date()
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
int thread_exit()
Definition: iozone.c:18526
char disrupt_flag
Definition: iozone.c:1520
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
void disrupt()
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long reclen
Definition: iozone.c:1535
int num_processors
Definition: iozone.c:1293
char read_sync
Definition: iozone.c:1295
int op_rate
Definition: iozone.c:1301
char distributed
Definition: iozone.c:1296
int mylockf()
char use_thread
Definition: iozone.c:1372
float compute_time
Definition: iozone.c:1538
float throughput
Definition: iozone.c:462
void async_init()
Definition: iozone.c:19044
int async_read_no_copy()
Definition: iozone.c:19050
#define THREAD_REVERSE_READ_TEST
Definition: iozone.c:1436
char client_iozone
Definition: iozone.c:1296
char cpuutilflag
Definition: iozone.c:1321
long long debug1
Definition: iozone.c:1373
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
char unbuffered
Definition: iozone.c:1509
void wait_for_master_go()
char * initfile()
long long delay
Definition: iozone.c:1533
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
float cputime
Definition: iozone.c:461
int begin_proc
Definition: iozone.c:1293
int async_read()
Definition: iozone.c:19026
char * buffer1
Definition: iozone.c:1366
int op_rate_flag
Definition: iozone.c:1302
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
long long chid
Definition: iozone.c:1529
char L_flag
Definition: iozone.c:1518
void tell_master_ready()
char mfflag
Definition: iozone.c:1334
long long x
Definition: iozone.c:1335
VOLATILE char * stop_flag
Definition: iozone.c:1537
char * buffer
Definition: iozone.c:1366
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
off64_t numrecs64
Definition: iozone.c:1534
long long flag
Definition: iozone.c:458
int share_file
Definition: iozone.c:1309
long long verify_buffer(char *buffer, long long length, off64_t recnum, long long recsize, unsigned long long patt, char sverify)
Definition: iozone.c:6940
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
char xflag
Definition: iozone.c:1520
int close()
void send_stop()
Definition: iozone.c:22607
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
char oflag
Definition: iozone.c:1509
void async_release()
Definition: iozone.c:19056
void my_nap()
void Poll()
char h_flag
Definition: iozone.c:1509
float walltime
Definition: iozone.c:460
void dump_hist()
char Q_flag
Definition: iozone.c:1517
long long res_prob
Definition: iozone.c:1294
int ioz_processor_bind
Definition: iozone.c:1293
char no_copy_flag
Definition: iozone.c:1519
double temp_time
Definition: iozone.c:1268
static double time_so_far()
Definition: iozone.c:6844
void my_unap()
char include_close
Definition: iozone.c:1519
void hist_insert()
char OPS_flag
Definition: iozone.c:1517
int unlink()
int client_error
Definition: iozone.c:1398
void exit()
int rlocking
Definition: iozone.c:1308
int fsync()
double cputime_res
Definition: iozone.c:1271
#define MAXSTREAMS
Definition: iozone.c:813
long long off64_t
Definition: iozone.c:357
unsigned long cache_size
Definition: iozone.c:1375
int errno
int i
Definition: fileop.c:140
int direct_flag
Definition: iozone.c:1527
#define CHILD_STATE_READY
Definition: iozone.c:944
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ thread_rread_test() [1/2]

void*() thread_rread_test ( )
Here is the caller graph for this function:

◆ thread_rread_test() [2/2]

void* thread_rread_test ( x  )

Definition at line 15338 of file iozone.c.

15340 {
15341  long long xx,xx2;
15342  char *nbuff;
15343  struct child_stats *child_stat;
15344  int fd;
15345  FILE *r_traj_fd,*thread_rrqfd;
15346  FILE *thread_Lwqfd;
15347  long long r_traj_bytes_completed;
15348  double walltime, cputime;
15349  long long r_traj_ops_completed;
15350  off64_t traj_offset;
15351  off64_t lock_offset=0;
15352  long long flags = 0;
15353  double starttime1 = 0;
15354  float delay = 0;
15355  double temp_time;
15356  double thread_qtime_start,thread_qtime_stop;
15357  double hist_time;
15358  double desired_op_rate_time;
15359  double actual_rate;
15360  double compute_val = (double)0;
15361  long long recs_per_buffer,traj_size;
15362  off64_t i;
15363  off64_t written_so_far, read_so_far, re_written_so_far,
15364  re_read_so_far;
15365  char *dummyfile[MAXSTREAMS]; /* name of dummy file */
15366  char *maddr=0;
15367  char *wmaddr=0;
15368  char now_string[30];
15369  volatile char *buffer1;
15370  int anwser,bind_cpu;
15371  long wval;
15372  char tmpname[256];
15373 #if defined(VXFS) || defined(solaris)
15374  int test_foo = 0;
15375 #endif
15376 #ifdef ASYNC_IO
15377  struct cache *gc=0;
15378 #else
15379  long long *gc=0;
15380 #endif
15381  /*****************/
15382  /* Children only */
15383  /*****************/
15384  if(compute_flag)
15386  hist_time=thread_qtime_stop=thread_qtime_start=0;
15387  thread_rrqfd=r_traj_fd=thread_Lwqfd=(FILE *)0;
15388  traj_offset=walltime=cputime=0;
15389  anwser=bind_cpu=0;
15391  written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
15392  recs_per_buffer = cache_size/reclen ;
15393 #ifdef NO_THREADS
15394  xx=chid;
15395 #else
15396  if(r_traj_flag)
15397  {
15400  }
15401  else
15402  {
15404  }
15405  if(use_thread)
15406  xx = (long long)((long)x);
15407  else
15408  {
15409  xx=chid;
15410  }
15411 #endif
15412 #ifndef NO_THREADS
15413 #if defined( _HPUX_SOURCE ) || defined ( linux )
15414  if(ioz_processor_bind)
15415  {
15416  bind_cpu=(begin_proc+(int)xx)%num_processors;
15417 #if defined(_HPUX_SOURCE)
15418  pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
15419  (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
15420 #else
15421  cpu_set_t cpuset;
15422 
15423  CPU_ZERO(&cpuset);
15424  CPU_SET(bind_cpu, &cpuset);
15425 
15426  pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
15427 #endif
15428  my_nap(40); /* Switch to new cpu */
15429  }
15430 #endif
15431 #endif
15432  if(use_thread)
15433  nbuff=barray[xx];
15434  else
15435  nbuff=buffer;
15436  if(debug1)
15437  {
15438  if(use_thread)
15439 #ifdef NO_PRINT_LLD
15440  printf("\nStarting child %ld\n",xx);
15441 #else
15442  printf("\nStarting child %lld\n",xx);
15443 #endif
15444  else
15445 #ifdef NO_PRINT_LLD
15446  printf("\nStarting process %d slot %ld\n",getpid(),xx);
15447 #else
15448  printf("\nStarting process %d slot %lld\n",getpid(),xx);
15449 #endif
15450 
15451  }
15452  dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
15453  xx2=xx;
15454  if(share_file)
15455  xx2=(long long)0;
15456  if(mfflag)
15457  {
15458 #ifdef NO_PRINT_LLD
15459  sprintf(dummyfile[xx],"%s",filearray[xx2]);
15460 #else
15461  sprintf(dummyfile[xx],"%s",filearray[xx2]);
15462 #endif
15463  }
15464  else
15465  {
15466 #ifdef NO_PRINT_LLD
15467  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
15468 #else
15469  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
15470 #endif
15471  }
15472  if(oflag)
15473  flags=O_RDONLY|O_SYNC;
15474  else
15475  flags=O_RDONLY;
15476 #if defined(_HPUX_SOURCE) || defined(linux)
15477  if(read_sync)
15478  flags |=O_RSYNC|O_SYNC;
15479 #endif
15480 
15481 #if ! defined(DONT_HAVE_O_DIRECT)
15482 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
15483  if(direct_flag)
15484  flags |=O_DIRECT;
15485 #endif
15486 #if defined(TRU64)
15487  if(direct_flag)
15488  flags |=O_DIRECTIO;
15489 #endif
15490 #endif
15491 
15492 #if defined(Windows)
15493  if(unbuffered)
15494  {
15495  hand=CreateFile(dummyfile[xx],
15496  GENERIC_READ|GENERIC_WRITE,
15497  FILE_SHARE_WRITE|FILE_SHARE_READ,
15498  NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
15499  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
15500  NULL);
15501  SetFilePointer(hand,(LONG)0,0,FILE_BEGIN);
15502  }
15503  else
15504  {
15505 #endif
15506  if((fd = I_OPEN(dummyfile[xx], ((int)flags),0))<0)
15507  {
15509  if(distributed && client_iozone)
15510  send_stop();
15511  perror(dummyfile[xx]);
15512  exit(135);
15513  }
15514 #if defined(Windows)
15515  }
15516 #endif
15517 #ifdef ASYNC_IO
15518  if(async_flag)
15519  async_init(&gc,fd,direct_flag);
15520 #endif
15521 #ifdef VXFS
15522  if(direct_flag)
15523  {
15524  ioctl(fd,VX_SETCACHE,VX_DIRECT);
15525  ioctl(fd,VX_GETCACHE,&test_foo);
15526  if(test_foo == 0)
15527  {
15528  if(!client_iozone)
15529  printf("\nVxFS advanced setcache feature not available.\n");
15530  exit(3);
15531  }
15532  }
15533 #endif
15534 #if defined(solaris)
15535  if(direct_flag)
15536  {
15537  test_foo = directio(fd, DIRECTIO_ON);
15538  if(test_foo != 0)
15539  {
15540  if(!client_iozone)
15541  printf("\ndirectio not available.\n");
15542  exit(3);
15543  }
15544  }
15545 #endif
15546  if(mmapflag)
15547  {
15548  maddr=(char *)initfile(fd,(filebytes64),0,PROT_READ);
15549  }
15550  if(r_traj_flag)
15552  if(fetchon)
15553  fetchit(nbuff,reclen);
15554  if(Q_flag)
15555  {
15556  sprintf(tmpname,"Child_%d_rrol.dat",(int)xx);
15557  thread_rrqfd=fopen(tmpname,"a");
15558  if(thread_rrqfd==0)
15559  {
15561  if(distributed && client_iozone)
15562  send_stop();
15563  printf("Unable to open %s\n",tmpname);
15564  exit(40);
15565  }
15566  fprintf(thread_rrqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
15567  }
15568  if(L_flag)
15569  {
15570  sprintf(tmpname,"Child_%d.log",(int)xx);
15571  thread_Lwqfd=fopen(tmpname,"a");
15572  if(thread_Lwqfd==0)
15573  {
15575  if(distributed && client_iozone)
15576  send_stop();
15577  printf("Unable to open %s\n",tmpname);
15578  exit(40);
15579  }
15580  get_date(now_string);
15581  fprintf(thread_Lwqfd,"%-25s %s","Reread test start: ",now_string);
15582  }
15583 
15584  child_stat = (struct child_stats *)&shmaddr[xx];
15585  child_stat->throughput = 0;
15586  child_stat->actual = 0;
15588 
15589  if(distributed && client_iozone)
15590  {
15593  }
15594  else
15595 
15596  /* Wait for signal from parent */
15598  Poll((long long)1);
15599  if(file_lock)
15600  if(mylockf((int) fd, (int) 1, (int)1) != 0)
15601  printf("File lock for read failed. %d\n",errno);
15602  starttime1 = time_so_far();
15603  if(cpuutilflag)
15604  {
15605  walltime = starttime1;
15606  cputime = cputime_so_far();
15607  }
15608 
15609  if(r_traj_flag)
15610  rewind(r_traj_fd);
15611  for(i=0; i<numrecs64; i++){
15612  traj_offset=i*reclen;
15613  if(disrupt_flag && ((i%DISRUPT)==0))
15614  {
15615 #if defined(Windows)
15616 
15617  if(unbuffered)
15618  disruptw(hand);
15619  else
15620  disrupt(fd);
15621 #else
15622  disrupt(fd);
15623 #endif
15624  }
15625  if(r_traj_flag)
15626  {
15627  traj_offset=get_traj(r_traj_fd, (long long *)&traj_size,(float *)&delay,(long)0);
15628  reclen=traj_size;
15629 #if defined(Windows)
15630  if(unbuffered)
15631  SetFilePointer(hand,(LONG)traj_offset,0,FILE_BEGIN);
15632  else
15633 #endif
15634  I_LSEEK(fd,traj_offset,SEEK_SET);
15635  }
15636  if(Q_flag)
15637  {
15638 #if defined(Windows)
15639  if(unbuffered)
15640  traj_offset=SetFilePointer(hand,(LONG)0,0,FILE_CURRENT);
15641  else
15642 #endif
15643  traj_offset=I_LSEEK(fd,0,SEEK_CUR);
15644  }
15645  if(rlocking)
15646  {
15647  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
15648  mylockr((int) fd, (int) 1, (int)1,
15649  lock_offset, reclen);
15650  }
15651  if(compute_flag)
15652  compute_val+=do_compute(delay);
15653  if(*stop_flag)
15654  {
15655  if(debug1)
15656  printf("\n(%ld) Stopped by another 3\n", (long)xx);
15657  break;
15658  }
15659  if(purge)
15660  purgeit(nbuff,reclen);
15661  if(Q_flag || hist_summary || op_rate_flag)
15662  {
15663  thread_qtime_start=time_so_far();
15664  }
15665  if(mmapflag)
15666  {
15667  wmaddr = &maddr[i*reclen];
15668  fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
15669  }
15670  else
15671  {
15672  if(async_flag)
15673  {
15674  if(no_copy_flag)
15675  async_read_no_copy(gc, (long long)fd, &buffer1, (i*reclen),reclen,
15676  1LL,(filebytes64),depth);
15677  else
15678  async_read(gc, (long long)fd, nbuff, (i*reclen),reclen,
15679  1LL,(filebytes64),depth);
15680  }
15681  else
15682  {
15683 #if defined(Windows)
15684  if(unbuffered)
15685  {
15686  ReadFile(hand,nbuff,reclen,(LPDWORD)&wval,0);
15687  }
15688  else
15689 #endif
15690  wval=read((int)fd, (void*)nbuff, (size_t) reclen);
15691  if(wval != reclen)
15692  {
15693  if(*stop_flag)
15694  {
15695  if(debug1)
15696  printf("\n(%ld) Stopped by another 4\n", (long)xx);
15697  break;
15698  }
15699 #ifdef NO_PRINT_LLD
15700  printf("\nError writing block %ld, fd= %d\n", i,
15701  fd);
15702 #else
15703  printf("\nError writing block %lld, fd= %d\n", i,
15704  fd);
15705 #endif
15706  perror("read");
15707  if (!no_unlink)
15708  {
15709  if(check_filename(dummyfile[xx]))
15710  unlink(dummyfile[xx]);
15711  }
15713  exit(137);
15714  }
15715  }
15716  }
15717  if(verify){
15718  if(async_flag && no_copy_flag)
15719  {
15721  if (!no_unlink)
15722  {
15723  if(check_filename(dummyfile[xx]))
15724  unlink(dummyfile[xx]);
15725  }
15727  exit(138);
15728  }
15729  }
15730  else
15731  {
15732  if(verify_buffer(nbuff,reclen,(off64_t)i,reclen,(long long)pattern,sverify)){
15733  if (!no_unlink)
15734  {
15735  if(check_filename(dummyfile[xx]))
15736  unlink(dummyfile[xx]);
15737  }
15739  exit(139);
15740  }
15741  }
15742  }
15743  if(async_flag && no_copy_flag)
15744  async_release(gc);
15745  re_read_so_far+=reclen/1024;
15748  if(*stop_flag)
15749  {
15750  re_read_so_far-=reclen/1024;
15752  }
15753  if(hist_summary)
15754  {
15755  thread_qtime_stop=time_so_far();
15756  hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
15757  hist_insert(hist_time);
15758  }
15759  if(op_rate_flag)
15760  {
15761  thread_qtime_stop=time_so_far();
15762  desired_op_rate_time = ((double)1.0/(double)op_rate);
15763  actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
15764 /*
15765 printf("Desired rate %g Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
15766  actual_rate, (desired_op_rate_time-actual_rate));
15767 */
15768  if( actual_rate < desired_op_rate_time)
15769  my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
15770  }
15771  if(Q_flag)
15772  {
15773  thread_qtime_stop=time_so_far();
15774 #ifdef NO_PRINT_LLD
15775  fprintf(thread_rrqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
15776 #else
15777  fprintf(thread_rrqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
15778 #endif
15779  }
15780 
15781  if(rlocking)
15782  {
15783  mylockr((int) fd, (int) 0, (int)1,
15784  lock_offset, reclen);
15785  }
15786  }
15787  if(file_lock)
15788  if(mylockf((int) fd, (int) 0, (int)1))
15789  printf("Read unlock failed. %d\n",errno);
15790  /*fsync(fd);*/
15791 #ifdef ASYNC_IO
15792  if(async_flag)
15793  {
15794  end_async(gc);
15795  gc=0;
15796  }
15797 #endif
15798  if(include_flush)
15799  {
15800  if(mmapflag)
15801  {
15802  msync(maddr,(size_t)(filebytes64),MS_SYNC);
15803  }else
15804  fsync(fd);
15805  }
15806  if(include_close)
15807  {
15808  if(mmapflag)
15809  {
15810  mmap_end(maddr,(unsigned long long)filebytes64);
15811  }
15812 #if defined(Windows)
15813  if(unbuffered)
15814  CloseHandle(hand);
15815  else
15816 #endif
15817  close(fd);
15818  }
15819  temp_time = time_so_far();
15820  child_stat->throughput = ((temp_time - starttime1)-time_res)
15821  -compute_val;
15822  if(child_stat->throughput < (double).000001)
15823  {
15825  if(rec_prob < reclen)
15826  rec_prob = reclen;
15827  res_prob=1;
15828  }
15829 
15830  if(OPS_flag){
15831  /*re_read_so_far=(re_read_so_far*1024)/reclen;*/
15832  re_read_so_far=r_traj_ops_completed;
15833  }
15834  child_stat->throughput = re_read_so_far/child_stat->throughput;
15835  child_stat->actual = re_read_so_far;
15836  if(!xflag)
15837  {
15838  *stop_flag=1;
15839  if(distributed && client_iozone)
15840  send_stop();
15841  }
15842  if(cpuutilflag)
15843  {
15845  if (cputime < cputime_res)
15846  cputime = 0.0;
15850  }
15851  if(distributed && client_iozone)
15852  {
15854  child_stat->actual,
15856  (char)*stop_flag,
15857  (long long)CHILD_STATE_HOLD);
15858  }
15859  child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
15860  if(!include_close)
15861  {
15862  if(mmapflag)
15863  {
15864  msync(maddr,(size_t)(filebytes64),MS_SYNC);
15865  mmap_end(maddr,(unsigned long long)filebytes64);
15866  }else
15867  fsync(fd);
15868 #if defined(Windows)
15869  if(unbuffered)
15870  CloseHandle(hand);
15871  else
15872 #endif
15873  close(fd);
15874  }
15875  if(Q_flag && (thread_rrqfd !=0) )
15876  fclose(thread_rrqfd);
15877  free(dummyfile[xx]);
15878  if(r_traj_flag)
15879  fclose(r_traj_fd);
15880  if(debug1)
15881 #ifdef NO_PRINT_LLD
15882  printf("\nChild finished %ld\n",xx);
15883 #else
15884  printf("\nChild finished %lld\n",xx);
15885 #endif
15886 
15887  if(L_flag)
15888  {
15889  get_date(now_string);
15890  fprintf(thread_Lwqfd,"%-25s %s","Reread test finished: ",now_string);
15891  fclose(thread_Lwqfd);
15892  }
15893  if(hist_summary)
15894  dump_hist("Reread",(int)xx);
15895  if(distributed && client_iozone)
15896  return(0);
15897 #ifdef NO_THREADS
15898  exit(0);
15899 #else
15900  if(use_thread)
15901  thread_exit();
15902  else
15903  exit(0);
15904 #endif
15905 return(0);
15906 }
int check_filename()
void end_async()
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
FILE * r_traj_fd
Definition: iozone.c:1367
long long r_traj_fsize
Definition: iozone.c:1325
void mmap_end()
#define CHILD_STATE_HOLD
Definition: iozone.c:942
long long get_traj()
char verify
Definition: iozone.c:1513
struct child_stats * child_stat
int no_unlink
Definition: iozone.c:1521
void tell_master_stats()
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
char mmapflag
Definition: iozone.c:1512
#define MAXNAMESIZE
Definition: iozone.c:833
int fd
Definition: iozone.c:1291
#define DISRUPT
Definition: iozone.c:779
float actual
Definition: iozone.c:463
char * barray[MAXSTREAMS]
Definition: iozone.c:1287
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
void get_date()
#define THREAD_REREAD_TEST
Definition: iozone.c:1432
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
int thread_exit()
Definition: iozone.c:18526
char disrupt_flag
Definition: iozone.c:1520
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
void disrupt()
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long reclen
Definition: iozone.c:1535
int num_processors
Definition: iozone.c:1293
char read_sync
Definition: iozone.c:1295
int op_rate
Definition: iozone.c:1301
char distributed
Definition: iozone.c:1296
int mylockf()
char use_thread
Definition: iozone.c:1372
float compute_time
Definition: iozone.c:1538
float throughput
Definition: iozone.c:462
void async_init()
Definition: iozone.c:19044
int async_read_no_copy()
Definition: iozone.c:19050
char client_iozone
Definition: iozone.c:1296
char cpuutilflag
Definition: iozone.c:1321
long long debug1
Definition: iozone.c:1373
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
char unbuffered
Definition: iozone.c:1509
void wait_for_master_go()
char * initfile()
long long delay
Definition: iozone.c:1533
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
float cputime
Definition: iozone.c:461
int begin_proc
Definition: iozone.c:1293
int async_read()
Definition: iozone.c:19026
char * buffer1
Definition: iozone.c:1366
int op_rate_flag
Definition: iozone.c:1302
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
long long chid
Definition: iozone.c:1529
char L_flag
Definition: iozone.c:1518
void tell_master_ready()
char mfflag
Definition: iozone.c:1334
long long x
Definition: iozone.c:1335
VOLATILE char * stop_flag
Definition: iozone.c:1537
char * buffer
Definition: iozone.c:1366
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
off64_t numrecs64
Definition: iozone.c:1534
long long flag
Definition: iozone.c:458
int share_file
Definition: iozone.c:1309
long long verify_buffer(char *buffer, long long length, off64_t recnum, long long recsize, unsigned long long patt, char sverify)
Definition: iozone.c:6940
FILE * open_r_traj()
Definition: iozone.c:19685
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
char xflag
Definition: iozone.c:1520
int close()
void send_stop()
Definition: iozone.c:22607
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
char oflag
Definition: iozone.c:1509
void async_release()
Definition: iozone.c:19056
void my_nap()
int r_traj_flag
Definition: iozone.c:1523
void Poll()
float walltime
Definition: iozone.c:460
void dump_hist()
char Q_flag
Definition: iozone.c:1517
long long res_prob
Definition: iozone.c:1294
int ioz_processor_bind
Definition: iozone.c:1293
char no_copy_flag
Definition: iozone.c:1519
long long r_traj_ops_completed
Definition: iozone.c:1326
double temp_time
Definition: iozone.c:1268
static double time_so_far()
Definition: iozone.c:6844
void my_unap()
char include_close
Definition: iozone.c:1519
void hist_insert()
char OPS_flag
Definition: iozone.c:1517
int unlink()
int client_error
Definition: iozone.c:1398
void exit()
int rlocking
Definition: iozone.c:1308
long long r_traj_ops
Definition: iozone.c:1325
int fsync()
double cputime_res
Definition: iozone.c:1271
#define MAXSTREAMS
Definition: iozone.c:813
long long off64_t
Definition: iozone.c:357
unsigned long cache_size
Definition: iozone.c:1375
int errno
int i
Definition: fileop.c:140
long long r_traj_bytes_completed
Definition: iozone.c:1326
int direct_flag
Definition: iozone.c:1527
#define CHILD_STATE_READY
Definition: iozone.c:944
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ thread_rwrite_test() [1/2]

void*() thread_rwrite_test ( )
Here is the caller graph for this function:

◆ thread_rwrite_test() [2/2]

void* thread_rwrite_test ( x  )

Definition at line 13642 of file iozone.c.

13644 {
13645  /************************/
13646  /* Children only here */
13647  /************************/
13648  struct child_stats *child_stat;
13649  long long xx,xx2;
13650  double compute_val = (double)0;
13651  double walltime, cputime;
13652  float delay = (float)0;
13653  double thread_qtime_stop,thread_qtime_start;
13654  double hist_time;
13655  double desired_op_rate_time;
13656  double actual_rate;
13657  off64_t traj_offset;
13658  off64_t lock_offset=0;
13659  long long w_traj_bytes_completed;
13660  long long w_traj_ops_completed;
13661  int fd;
13662  FILE *w_traj_fd;
13663  long long flags = 0;
13664  double starttime1 = 0;
13665  double temp_time;
13666  long long recs_per_buffer,traj_size;
13667  long long i;
13668  off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far=0;
13669  char *dummyfile [MAXSTREAMS]; /* name of dummy file */
13670  char *nbuff;
13671  char *maddr,*free_addr;
13672  char *wmaddr;
13673  char now_string[30];
13674  int anwser,bind_cpu,wval;
13675  FILE *thread_rwqfd,*thread_Lwqfd;
13676  char tmpname[256];
13677 #if defined(VXFS) || defined(solaris)
13678  int test_foo = 0;
13679 #endif
13680 #ifdef ASYNC_IO
13681  struct cache *gc=0;
13682 
13683 #else
13684  long long *gc=0;
13685 #endif
13686 
13687  if(compute_flag)
13689  wmaddr=nbuff=maddr=free_addr=0;
13690  thread_rwqfd=w_traj_fd=thread_Lwqfd=(FILE *)0;
13691  hist_time=traj_offset=thread_qtime_stop=thread_qtime_start=0;
13692  walltime=cputime=0;
13693  anwser=bind_cpu=0;
13695  written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
13696  recs_per_buffer = cache_size/reclen ;
13697  if(w_traj_flag)
13698  {
13701  }
13702  else
13703  {
13705  }
13706 #ifdef NO_THREADS
13707  xx=chid;
13708 #else
13709  if(use_thread)
13710  xx=(long long)((long)x);
13711  else
13712  {
13713  xx=chid;
13714  }
13715 #endif
13716 #ifndef NO_THREADS
13717 #if defined( _HPUX_SOURCE ) || defined ( linux )
13718  if(ioz_processor_bind)
13719  {
13720  bind_cpu=(begin_proc+(int)xx)%num_processors;
13721 #if defined( _HPUX_SOURCE )
13722  pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
13723  (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
13724 #else
13725  cpu_set_t cpuset;
13726  CPU_ZERO(&cpuset);
13727  CPU_SET(bind_cpu, &cpuset);
13728 
13729  pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
13730 #endif
13731  my_nap(40); /* Switch to new cpu */
13732  }
13733 #endif
13734 #endif
13735  if(use_thread)
13736  nbuff=barray[xx];
13737  else
13738  nbuff=buffer;
13739  child_stat = (struct child_stats *)&shmaddr[xx];
13740  child_stat->throughput = 0;
13741  child_stat->actual = 0;
13742  if(debug1)
13743  {
13744  if(use_thread)
13745 #ifdef NO_PRINT_LLD
13746  printf("\nStarting child %ld\n",xx);
13747 #else
13748  printf("\nStarting child %lld\n",xx);
13749 #endif
13750  else
13751 #ifdef NO_PRINT_LLD
13752  printf("\nStarting process %d slot %ld\n",getpid(),xx);
13753 #else
13754  printf("\nStarting process %d slot %lld\n",getpid(),xx);
13755 #endif
13756 
13757  }
13758  dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
13759  xx2=xx;
13760  if(share_file)
13761  xx2=(long long)0;
13762  if(mfflag)
13763  {
13764 #ifdef NO_PRINT_LLD
13765  sprintf(dummyfile[xx],"%s",filearray[xx2]);
13766 #else
13767  sprintf(dummyfile[xx],"%s",filearray[xx2]);
13768 #endif
13769  }
13770  else
13771  {
13772 #ifdef NO_PRINT_LLD
13773  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
13774 #else
13775  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
13776 #endif
13777  }
13778  flags = O_RDWR;
13779  if(oflag)
13780  flags|= O_SYNC;
13781 #if defined(O_DSYNC)
13782  if(odsync)
13783  flags|= O_DSYNC;
13784 #endif
13785 #if defined(_HPUX_SOURCE) || defined(linux)
13786  if(read_sync)
13787  flags |=O_RSYNC|O_SYNC;
13788 #endif
13789 
13790 #if ! defined(DONT_HAVE_O_DIRECT)
13791 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
13792  if(direct_flag)
13793  flags |=O_DIRECT;
13794 #endif
13795 #if defined(TRU64)
13796  if(direct_flag)
13797  flags |=O_DIRECTIO;
13798 #endif
13799 #endif
13800 
13801 #if defined(Windows)
13802  if(unbuffered)
13803  {
13804  hand=CreateFile(dummyfile[xx],
13805  GENERIC_READ|GENERIC_WRITE,
13806  FILE_SHARE_WRITE|FILE_SHARE_READ,
13807  NULL,OPEN_ALWAYS,FILE_FLAG_NO_BUFFERING|
13808  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
13809  NULL);
13810  }
13811  else
13812  {
13813 #endif
13814  if((fd = I_OPEN(dummyfile[xx], (int)flags,0))<0)
13815  {
13817  if(distributed && client_iozone)
13818  send_stop();
13819 #ifdef NO_PRINT_LLD
13820  printf("\nChild %ld\n",xx);
13821 #else
13822  printf("\nChild %lld\n",xx);
13823 #endif
13825  perror(dummyfile[xx]);
13826  exit(128);
13827  }
13828 #if defined(Windows)
13829  }
13830 #endif
13831 #ifdef VXFS
13832  if(direct_flag)
13833  {
13834  ioctl(fd,VX_SETCACHE,VX_DIRECT);
13835  ioctl(fd,VX_GETCACHE,&test_foo);
13836  if(test_foo == 0)
13837  {
13838  if(!client_iozone)
13839  printf("\nVxFS advanced setcache feature not available.\n");
13840  exit(3);
13841  }
13842  }
13843 #endif
13844 #if defined(solaris)
13845  if(direct_flag)
13846  {
13847  test_foo = directio(fd, DIRECTIO_ON);
13848  if(test_foo != 0)
13849  {
13850  if(!client_iozone)
13851  printf("\ndirectio not available.\n");
13852  exit(3);
13853  }
13854  }
13855 #endif
13856 #ifdef ASYNC_IO
13857  if(async_flag)
13858  async_init(&gc,fd,direct_flag);
13859 #endif
13860  if(mmapflag)
13861  {
13862  maddr=(char *)initfile(fd,(numrecs64*reclen),1,PROT_READ|PROT_WRITE);
13863  }
13864  if(fetchon)
13865  fetchit(nbuff,reclen);
13866  if(w_traj_flag)
13868  if(Q_flag)
13869  {
13870  sprintf(tmpname,"Child_%d_rwol.dat",(int)xx);
13871  thread_rwqfd=fopen(tmpname,"a");
13872  if(thread_rwqfd==0)
13873  {
13874  printf("Unable to open %s\n",tmpname);
13876  if(distributed && client_iozone)
13877  send_stop();
13878  exit(40);
13879  }
13880  fprintf(thread_rwqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
13881  }
13882  if(L_flag)
13883  {
13884  sprintf(tmpname,"Child_%d.log",(int)xx);
13885  thread_Lwqfd=fopen(tmpname,"a");
13886  if(thread_Lwqfd==0)
13887  {
13889  if(distributed && client_iozone)
13890  send_stop();
13891  printf("Unable to open %s\n",tmpname);
13892  exit(40);
13893  }
13894  get_date(now_string);
13895  fprintf(thread_Lwqfd,"%-25s %s","Rewrite test start: ",now_string);
13896  }
13898  if(distributed && client_iozone)
13900  if(distributed && client_iozone)
13901  {
13902  if(cdebug)
13903  {
13904  fprintf(newstdout,"Child %d waiting for go from master\n",(int)xx);
13905  fflush(newstdout);
13906  }
13908  if(cdebug)
13909  {
13910  fprintf(newstdout,"Child %d received go from master\n",(int)xx);
13911  fflush(newstdout);
13912  }
13913  }
13914  else
13915  {
13916  while(child_stat->flag!=CHILD_STATE_BEGIN) /* Wait for signal from parent */
13917  Poll((long long)1);
13918  }
13919  starttime1 = time_so_far();
13920  if(cpuutilflag)
13921  {
13922  walltime = starttime1;
13923  cputime = cputime_so_far();
13924  }
13925  if(file_lock)
13926  if(mylockf((int) fd, (int) 1, (int)0) != 0)
13927  printf("File lock for write failed. %d\n",errno);
13928  if(cpuutilflag)
13929  {
13930  walltime = starttime1;
13931  cputime = cputime_so_far();
13932  }
13933  if(w_traj_flag)
13934  rewind(w_traj_fd);
13935  if((verify && !no_copy_flag) || dedup || dedup_interior)
13936  fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
13937  for(i=0; i<numrecs64; i++){
13938  traj_offset= i*reclen ;
13939  if(w_traj_flag)
13940  {
13941  traj_offset=get_traj(w_traj_fd, (long long *)&traj_size,(float *)&delay,(long)1);
13942  reclen=traj_size;
13943 #if defined(Windows)
13944  if(unbuffered)
13945  SetFilePointer(hand,(LONG)traj_offset,0,FILE_BEGIN);
13946  else
13947 #endif
13948  I_LSEEK(fd,traj_offset,SEEK_SET);
13949  }
13950  if(Q_flag)
13951  {
13952 #if defined(Windows)
13953  if(unbuffered)
13954  traj_offset=SetFilePointer(hand,(LONG)0,0,FILE_CURRENT);
13955  else
13956 #endif
13957  traj_offset=I_LSEEK(fd,0,SEEK_CUR);
13958  }
13959  if(rlocking)
13960  {
13961  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
13962  mylockr((int) fd, (int) 1, (int)0,
13963  lock_offset, reclen);
13964  }
13965  if(compute_flag)
13966  compute_val+=do_compute(delay);
13967  if(*stop_flag && !mmapflag)
13968  {
13969  if(debug1)
13970  printf("\nStop_flag 1\n");
13971  break;
13972  }
13973  if((verify && !no_copy_flag) || dedup || dedup_interior)
13974  {
13975  fill_buffer(nbuff,reclen,(long long)pattern,sverify,i);
13976  }
13977  if(purge)
13978  purgeit(nbuff,reclen);
13979  if(Q_flag || hist_summary || op_rate_flag)
13980  {
13981  thread_qtime_start=time_so_far();
13982  }
13983  if(mmapflag)
13984  {
13985  wmaddr = &maddr[i*reclen];
13986  if(cdebug)
13987  {
13988 fprintf(newstdout,"Chid: %lld Rewriting offset %lld for length of %lld\n",chid, i*reclen,reclen);
13989  fflush(newstdout);
13990  }
13991  fill_area((long long*)nbuff,(long long*)wmaddr,(long long)reclen);
13992  if(!mmapnsflag)
13993  {
13994  if(mmapasflag)
13995  msync(wmaddr,(size_t)reclen,MS_ASYNC);
13996  if(mmapssflag)
13997  msync(wmaddr,(size_t)reclen,MS_SYNC);
13998  }
13999  }
14000  else
14001  {
14002  if(async_flag)
14003  {
14004  if(no_copy_flag)
14005  {
14006  free_addr=nbuff=(char *)malloc((size_t)reclen+page_size);
14007  nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
14008  if(verify || dedup || dedup_interior)
14009  fill_buffer(nbuff,reclen,(long long)pattern,sverify,i);
14010  async_write_no_copy(gc, (long long)fd, nbuff, reclen, (i*reclen), depth,free_addr);
14011  }
14012  else
14013  async_write(gc, (long long)fd, nbuff, reclen, (i*reclen), depth);
14014  }
14015  else
14016  {
14017 #if defined(Windows)
14018  if(unbuffered)
14019  {
14020  WriteFile(hand,nbuff,reclen,(LPDWORD)&wval,0);
14021  }
14022  else
14023 #endif
14024  wval=write(fd, nbuff, (size_t) reclen);
14025  if(wval != reclen)
14026  {
14027  if(*stop_flag)
14028  {
14029  if(debug1)
14030  printf("\nStop_flag 2\n");
14031  break;
14032  }
14033 #ifdef NO_PRINT_LLD
14034  printf("\nError writing block %ld, fd= %d\n", i,
14035  fd);
14036 #else
14037  printf("\nError writing block %lld, fd= %d\n", i,
14038  fd);
14039 #endif
14040  if(wval==-1)
14041  perror("write");
14042  if (!no_unlink)
14043  {
14044  if(check_filename(dummyfile[xx]))
14045  unlink(dummyfile[xx]);
14046  }
14048  signal_handler();
14049  }
14050  }
14051  }
14052  re_written_so_far+=reclen/1024;
14055  if(*stop_flag)
14056  {
14057  re_written_so_far-=reclen/1024;
14059  }
14060  if(hist_summary)
14061  {
14062  thread_qtime_stop=time_so_far();
14063  hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
14064  hist_insert(hist_time);
14065  }
14066  if(op_rate_flag)
14067  {
14068  thread_qtime_stop=time_so_far();
14069  desired_op_rate_time = ((double)1.0/(double)op_rate);
14070  actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
14071 /*
14072 printf("Desired rate %g Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
14073  actual_rate, (desired_op_rate_time-actual_rate));
14074 */
14075  if( actual_rate < desired_op_rate_time)
14076  my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
14077  }
14078  if(Q_flag)
14079  {
14080  thread_qtime_stop=time_so_far();
14081 #ifdef NO_PRINT_LLD
14082  fprintf(thread_rwqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
14083 #else
14084  fprintf(thread_rwqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
14085 #endif
14086  }
14087  if(rlocking)
14088  {
14089  mylockr((int) fd, (int) 0, (int)0,
14090  lock_offset, reclen);
14091  }
14092  }
14093  if(file_lock)
14094  if(mylockf((int) fd, (int) 0, (int)0))
14095  printf("Write unlock failed. %d\n",errno);
14096 #ifdef ASYNC_IO
14097  if(async_flag)
14098  {
14099  end_async(gc);
14100  gc=0;
14101  }
14102 #endif
14103  if(include_flush)
14104  {
14105  if(mmapflag)
14106  {
14107  msync(maddr,(size_t)(filebytes64),MS_SYNC);
14108  }else
14109  fsync(fd);
14110  }
14111  if(include_close)
14112  {
14113  if(mmapflag)
14114  {
14115  mmap_end(maddr,(unsigned long long)filebytes64);
14116  }
14117 #if defined(Windows)
14118  if(unbuffered)
14119  CloseHandle(hand);
14120  else
14121 #endif
14122  close(fd);
14123  }
14125  child_stat=(struct child_stats *)&shmaddr[xx];
14126  child_stat->throughput = ((temp_time - starttime1)-time_res)
14127  -compute_val;
14128  if(child_stat->throughput < (double).000001)
14129  {
14131  if(rec_prob < reclen)
14132  rec_prob = reclen;
14133  res_prob=1;
14134  }
14135 
14136  if(OPS_flag){
14137  /*re_written_so_far=(re_written_so_far*1024)/reclen;*/
14138  re_written_so_far=w_traj_ops_completed;
14139  }
14141  (double)re_written_so_far/child_stat->throughput;
14142  child_stat->actual = (double)re_written_so_far;
14143  if(!xflag)
14144  {
14145  *stop_flag=1;
14146  if(distributed && client_iozone)
14147  send_stop();
14148  }
14149  if(cdebug)
14150  {
14151  fprintf(newstdout,"Child %d: throughput %f actual %f \n",(int)chid, child_stat->throughput,
14152  child_stat->actual);
14153  fflush(newstdout);
14154  }
14155  if(cpuutilflag)
14156  {
14158  if (cputime < cputime_res)
14159  cputime = 0.0;
14163  }
14164  if(distributed && client_iozone)
14166  child_stat->actual,
14168  (char)*stop_flag,
14169  (long long)CHILD_STATE_HOLD);
14170  child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
14171  if(!include_close)
14172  {
14173  if(mmapflag)
14174  {
14175  msync(maddr,(size_t)(filebytes64),MS_SYNC);
14176  mmap_end(maddr,(unsigned long long)filebytes64);
14177  }
14178  else
14179  fsync(fd);
14180 #if defined(Windows)
14181  if(unbuffered)
14182  CloseHandle(hand);
14183  else
14184 #endif
14185  close(fd);
14186  }
14187  free(dummyfile[xx]);
14188 
14189  if(Q_flag && (thread_rwqfd !=0) )
14190  fclose(thread_rwqfd);
14191 
14192  if(w_traj_flag)
14193  fclose(w_traj_fd);
14194  if(debug1)
14195 #ifdef NO_PRINT_LLD
14196  printf("\nChild Stopping %ld\n",xx);
14197 #else
14198  printf("\nChild Stopping %lld\n",xx);
14199 #endif
14200 
14201  if(L_flag)
14202  {
14203  get_date(now_string);
14204  fprintf(thread_Lwqfd,"%-25s %s","Rewrite test finished: ",now_string);
14205  fclose(thread_Lwqfd);
14206  }
14207  if(hist_summary)
14208  dump_hist("Rewrite",(int)xx);
14209  if(distributed && client_iozone)
14210  return(0);
14211 #ifdef NO_THREADS
14212  exit(0);
14213 #else
14214  if(use_thread)
14215  thread_exit();
14216  else
14217  exit(0);
14218 #endif
14219 return(0);
14220 }
int check_filename()
void end_async()
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
long long rec_prob
Definition: iozone.c:1294
int w_traj_flag
Definition: iozone.c:1523
char compute_flag
Definition: iozone.c:1520
void mmap_end()
#define CHILD_STATE_HOLD
Definition: iozone.c:942
long long get_traj()
char verify
Definition: iozone.c:1513
struct child_stats * child_stat
size_t async_write()
Definition: iozone.c:19038
long long w_traj_bytes_completed
Definition: iozone.c:1327
int no_unlink
Definition: iozone.c:1521
void tell_master_stats()
void fill_buffer()
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
char mmapflag
Definition: iozone.c:1512
#define MAXNAMESIZE
Definition: iozone.c:833
int fd
Definition: iozone.c:1291
float actual
Definition: iozone.c:463
void signal_handler()
Definition: iozone.c:3336
char * barray[MAXSTREAMS]
Definition: iozone.c:1287
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
void get_date()
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
int thread_exit()
Definition: iozone.c:18526
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long w_traj_ops_completed
Definition: iozone.c:1327
long long reclen
Definition: iozone.c:1535
int num_processors
Definition: iozone.c:1293
char read_sync
Definition: iozone.c:1295
long long w_traj_fsize
Definition: iozone.c:1325
int op_rate
Definition: iozone.c:1301
char distributed
Definition: iozone.c:1296
int mylockf()
char use_thread
Definition: iozone.c:1372
float compute_time
Definition: iozone.c:1538
float throughput
Definition: iozone.c:462
void async_init()
Definition: iozone.c:19044
char client_iozone
Definition: iozone.c:1296
char cpuutilflag
Definition: iozone.c:1321
long long debug1
Definition: iozone.c:1373
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
char unbuffered
Definition: iozone.c:1509
void wait_for_master_go()
char * initfile()
long long page_size
Definition: iozone.c:428
long long delay
Definition: iozone.c:1533
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char mmapasflag
Definition: iozone.c:1512
size_t async_write_no_copy()
Definition: iozone.c:19032
float cputime
Definition: iozone.c:461
int cdebug
Definition: iozone.c:1478
long long w_traj_ops
Definition: iozone.c:1325
int begin_proc
Definition: iozone.c:1293
char odsync
Definition: iozone.c:1516
int op_rate_flag
Definition: iozone.c:1302
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
char dedup
Definition: iozone.c:1304
long long chid
Definition: iozone.c:1529
char L_flag
Definition: iozone.c:1518
void tell_master_ready()
char mfflag
Definition: iozone.c:1334
long long x
Definition: iozone.c:1335
VOLATILE char * stop_flag
Definition: iozone.c:1537
char * buffer
Definition: iozone.c:1366
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
off64_t numrecs64
Definition: iozone.c:1534
long long flag
Definition: iozone.c:458
char mmapssflag
Definition: iozone.c:1512
int share_file
Definition: iozone.c:1309
char dedup_interior
Definition: iozone.c:1304
FILE * open_w_traj()
Definition: iozone.c:19707
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
char xflag
Definition: iozone.c:1520
int close()
FILE * w_traj_fd
Definition: iozone.c:1367
void send_stop()
Definition: iozone.c:22607
FILE * newstdout
Definition: iozone.c:1475
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
char oflag
Definition: iozone.c:1509
void my_nap()
#define THREAD_REWRITE_TEST
Definition: iozone.c:1430
void Poll()
float walltime
Definition: iozone.c:460
void dump_hist()
char Q_flag
Definition: iozone.c:1517
long long res_prob
Definition: iozone.c:1294
int ioz_processor_bind
Definition: iozone.c:1293
char no_copy_flag
Definition: iozone.c:1519
double temp_time
Definition: iozone.c:1268
static double time_so_far()
Definition: iozone.c:6844
void my_unap()
char include_close
Definition: iozone.c:1519
void hist_insert()
char OPS_flag
Definition: iozone.c:1517
int unlink()
int client_error
Definition: iozone.c:1398
void exit()
int rlocking
Definition: iozone.c:1308
char mmapnsflag
Definition: iozone.c:1512
int fsync()
double cputime_res
Definition: iozone.c:1271
#define MAXSTREAMS
Definition: iozone.c:813
long long off64_t
Definition: iozone.c:357
unsigned long cache_size
Definition: iozone.c:1375
int errno
int i
Definition: fileop.c:140
int direct_flag
Definition: iozone.c:1527
#define CHILD_STATE_READY
Definition: iozone.c:944
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ thread_set_base()

void*() thread_set_base ( )

◆ thread_stride_read_test() [1/2]

void*() thread_stride_read_test ( )
Here is the caller graph for this function:

◆ thread_stride_read_test() [2/2]

void* thread_stride_read_test ( x  )

Definition at line 16448 of file iozone.c.

16450 {
16451  long long xx,xx2;
16452  char *nbuff=0;
16453  struct child_stats *child_stat;
16454  double walltime, cputime;
16455  int fd;
16456  long long flags = 0;
16457  double thread_qtime_stop,thread_qtime_start;
16458  double hist_time;
16459  double desired_op_rate_time;
16460  double actual_rate;
16461  double starttime2 = 0;
16462  float delay = 0;
16463  double compute_val = (double)0;
16464  double temp_time;
16465  long long recs_per_buffer;
16466  off64_t i;
16467  off64_t lock_offset=0;
16468  off64_t savepos64=0;
16469  off64_t written_so_far, stride_read,re_read_so_far,read_so_far;
16470  off64_t stripewrap = 0;
16471  off64_t current_position = 0;
16472  char *dummyfile[MAXSTREAMS]; /* name of dummy file */
16473  char *maddr=0;
16474  char *wmaddr=0;
16475  volatile char *buffer1;
16476  int anwser,bind_cpu;
16477  off64_t traj_offset;
16478  char tmpname[256];
16479  char now_string[30];
16480  FILE *thread_strqfd=0;
16481  FILE *thread_Lwqfd=0;
16482 #if defined(VXFS) || defined(solaris)
16483  int test_foo = 0;
16484 #endif
16485 #ifdef ASYNC_IO
16486  struct cache *gc=0;
16487 #else
16488  long long *gc=0;
16489 #endif
16490  /*****************/
16491  /* Children only */
16492  /*****************/
16493  if(compute_flag)
16495  hist_time=thread_qtime_stop=thread_qtime_start=0;
16496  traj_offset=walltime=cputime=0;
16497  anwser=bind_cpu=0;
16498  written_so_far=read_so_far=stride_read=re_read_so_far=0;
16499  recs_per_buffer = cache_size/reclen ;
16500 #ifdef NO_THREADS
16501  xx=chid;
16502 #else
16503  if(use_thread)
16504  xx = (long long)((long)x);
16505  else
16506  {
16507  xx=chid;
16508  }
16509 #endif
16510 #ifndef NO_THREADS
16511 #if defined( _HPUX_SOURCE ) || defined ( linux )
16512  if(ioz_processor_bind)
16513  {
16514  bind_cpu=(begin_proc+(int)xx)%num_processors;
16515 #if defined(_HPUX_SOURCE)
16516  pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
16517  (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
16518 #else
16519  cpu_set_t cpuset;
16520 
16521  CPU_ZERO(&cpuset);
16522  CPU_SET(bind_cpu, &cpuset);
16523 
16524  pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
16525 #endif
16526  my_nap(40); /* Switch to new cpu */
16527  }
16528 #endif
16529 #endif
16530  if(use_thread)
16531  nbuff=barray[xx];
16532  else
16533  nbuff=buffer;
16534  if(debug1)
16535  {
16536  if(use_thread)
16537 #ifdef NO_PRINT_LLD
16538  printf("\nStarting child %ld\n",xx);
16539 #else
16540  printf("\nStarting child %lld\n",xx);
16541 #endif
16542  else
16543 #ifdef NO_PRINT_LLD
16544  printf("\nStarting process %d slot %ld\n",getpid(),xx);
16545 #else
16546  printf("\nStarting process %d slot %lld\n",getpid(),xx);
16547 #endif
16548 
16549  }
16550  dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
16551  xx2=xx;
16552  if(share_file)
16553  xx2=(long long)0;
16554  if(mfflag)
16555  {
16556 #ifdef NO_PRINT_LLD
16557  sprintf(dummyfile[xx],"%s",filearray[xx2]);
16558 #else
16559  sprintf(dummyfile[xx],"%s",filearray[xx2]);
16560 #endif
16561  }
16562  else
16563  {
16564 #ifdef NO_PRINT_LLD
16565  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
16566 #else
16567  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
16568 #endif
16569  }
16570  if(oflag)
16571  flags=O_RDONLY|O_SYNC;
16572  else
16573  flags=O_RDONLY;
16574 #if defined(_HPUX_SOURCE) || defined(linux)
16575  if(read_sync)
16576  flags |=O_RSYNC|O_SYNC;
16577 #endif
16578 #if ! defined(DONT_HAVE_O_DIRECT)
16579 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
16580  if(direct_flag)
16581  flags |=O_DIRECT;
16582 #endif
16583 #if defined(TRU64)
16584  if(direct_flag)
16585  flags |=O_DIRECTIO;
16586 #endif
16587 #endif
16588 
16589 #if defined(Windows)
16590  if(unbuffered)
16591  {
16592  hand=CreateFile(dummyfile[xx],
16593  GENERIC_READ|GENERIC_WRITE,
16594  FILE_SHARE_WRITE|FILE_SHARE_READ,
16595  NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
16596  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
16597  NULL);
16598  }
16599 #endif
16600  if((fd = I_OPEN(dummyfile[xx], ((int)flags),0))<0)
16601  {
16603  if(distributed && client_iozone)
16604  send_stop();
16605  perror(dummyfile[xx]);
16606  exit(147);
16607  }
16608 #ifdef ASYNC_IO
16609  if(async_flag)
16610  async_init(&gc,fd,direct_flag);
16611 #endif
16612 #ifdef VXFS
16613  if(direct_flag)
16614  {
16615  ioctl(fd,VX_SETCACHE,VX_DIRECT);
16616  ioctl(fd,VX_GETCACHE,&test_foo);
16617  if(test_foo == 0)
16618  {
16619  if(!client_iozone)
16620  printf("\nVxFS advanced setcache feature not available.\n");
16621  exit(3);
16622  }
16623  }
16624 #endif
16625 #if defined(solaris)
16626  if(direct_flag)
16627  {
16628  test_foo = directio(fd, DIRECTIO_ON);
16629  if(test_foo != 0)
16630  {
16631  if(!client_iozone)
16632  printf("\ndirectio not available.\n");
16633  exit(3);
16634  }
16635  }
16636 #endif
16637 
16638  if(mmapflag)
16639  {
16640  maddr=(char *)initfile(fd,(numrecs64*reclen),0,PROT_READ);
16641  }
16642  if(fetchon)
16643  fetchit(nbuff,reclen);
16644  if(Q_flag)
16645  {
16646  sprintf(tmpname,"Child_%d_strol.dat",(int)xx);
16647  thread_strqfd=fopen(tmpname,"a");
16648  if(thread_strqfd==0)
16649  {
16651  if(distributed && client_iozone)
16652  send_stop();
16653  printf("Unable to open %s\n",tmpname);
16654  exit(40);
16655  }
16656  fprintf(thread_strqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
16657  }
16658  if(L_flag)
16659  {
16660  sprintf(tmpname,"Child_%d.log",(int)xx);
16661  thread_Lwqfd=fopen(tmpname,"a");
16662  if(thread_Lwqfd==0)
16663  {
16665  if(distributed && client_iozone)
16666  send_stop();
16667  printf("Unable to open %s\n",tmpname);
16668  exit(40);
16669  }
16670  get_date(now_string);
16671  fprintf(thread_Lwqfd,"%-25s %s","Stride test start: ",
16672  now_string);
16673  }
16674  child_stat = (struct child_stats *)&shmaddr[xx];
16675  child_stat->throughput = 0;
16676  child_stat->actual = 0;
16678  if(distributed && client_iozone)
16679  {
16682  }
16683  else
16684 
16685  /* wait for parent to say go */
16687  Poll((long long)1);
16688  if(file_lock)
16689  if(mylockf((int) fd, (int) 1, (int)1)!=0)
16690  printf("File lock for write failed. %d\n",errno);
16691  starttime2 = time_so_far();
16692  if(cpuutilflag)
16693  {
16694  walltime = starttime2;
16695  cputime = cputime_so_far();
16696  }
16697  for(i=0; i<numrecs64; i++){
16698  if(disrupt_flag && ((i%DISRUPT)==0))
16699  {
16700  disrupt(fd);
16701  }
16702  if(compute_flag)
16703  compute_val+=do_compute(delay);
16704  if(Q_flag)
16705  {
16706  traj_offset=I_LSEEK(fd,0,SEEK_CUR);
16707  }
16708  if(rlocking)
16709  {
16710  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
16711  mylockr((int) fd, (int) 1, (int)1,
16712  lock_offset, reclen);
16713  }
16714  if(*stop_flag)
16715  {
16716  if(debug1)
16717  printf("\n(%ld) Stopped by another 3\n", (long)xx);
16718  break;
16719  }
16720  if(purge)
16721  purgeit(nbuff,reclen);
16722  if(Q_flag || hist_summary || op_rate_flag)
16723  {
16724  thread_qtime_start=time_so_far();
16725  }
16726  if(verify)
16727  savepos64=current_position/(off64_t)reclen;
16728  if(mmapflag)
16729  {
16730  wmaddr = &maddr[current_position];
16731  fill_area((long long*)wmaddr,(long long*)nbuff,(long long)reclen);
16732  }
16733  else
16734  {
16735  if(async_flag)
16736  {
16737  if(no_copy_flag)
16738  async_read_no_copy(gc, (long long)fd, &buffer1, (current_position),
16740  else
16741  async_read(gc, (long long)fd, nbuff, (current_position),reclen,
16743  }
16744  else
16745  {
16746  if(read((int)fd, (void*)nbuff, (size_t) reclen) != reclen)
16747  {
16748  if(*stop_flag)
16749  {
16750  if(debug1)
16751  printf("\n(%ld) Stopped by another 4\n", (long)xx);
16752  break;
16753  }
16754 #ifdef NO_PRINT_LLD
16755  printf("\nError reading block %ld, fd= %d\n", i, fd);
16756 #else
16757  printf("\nError reading block %lld, fd= %d\n", i, fd);
16758 #endif
16759  perror("read");
16760  if (!no_unlink)
16761  {
16762  if(check_filename(dummyfile[xx]))
16763  unlink(dummyfile[xx]);
16764  }
16766  exit(149);
16767  }
16768  }
16769  }
16770  if(rlocking)
16771  {
16772  mylockr((int) fd, (int) 0, (int)1,
16773  lock_offset, reclen);
16774  }
16775  current_position+=reclen;
16776  if(verify){
16777  if(async_flag && no_copy_flag)
16778  {
16779  if(verify_buffer(buffer1,reclen,(off64_t)savepos64,reclen,(long long)pattern,sverify)){
16780  if (!no_unlink)
16781  {
16782  if(check_filename(dummyfile[xx]))
16783  unlink(dummyfile[xx]);
16784  }
16786  exit(150);
16787  }
16788  }
16789  else
16790  {
16791  if(verify_buffer(nbuff,reclen,(off64_t)savepos64,reclen,(long long)pattern,sverify)){
16792  if (!no_unlink)
16793  {
16794  if(check_filename(dummyfile[xx]))
16795  unlink(dummyfile[xx]);
16796  }
16798  exit(151);
16799  }
16800  }
16801  }
16802  if(async_flag && no_copy_flag)
16803  async_release(gc);
16804  if(current_position + (stride * reclen) >= (numrecs64 * reclen)-reclen)
16805  {
16806  current_position=0;
16807 
16808  stripewrap++;
16809 
16810  if(numrecs64 <= stride)
16811  {
16812  current_position=0;
16813  }
16814  else
16815  {
16816  current_position = (off64_t)((stripewrap)%numrecs64)*reclen;
16817  }
16818  if (!(h_flag || k_flag || mmapflag))
16819  {
16820  if(I_LSEEK(fd,current_position,SEEK_SET)<0)
16821  {
16823  if(distributed && client_iozone)
16824  send_stop();
16825  perror("lseek");
16826  exit(152);
16827  }
16828  }
16829  }
16830  else
16831  {
16832  current_position+=(stride*reclen)-reclen;
16833  if (!(h_flag || k_flag || mmapflag))
16834  {
16835  if(I_LSEEK(fd,current_position,SEEK_SET)<0)
16836  {
16838  if(distributed && client_iozone)
16839  send_stop();
16840  perror("lseek");
16841  exit(154);
16842  };
16843  }
16844  }
16845  stride_read +=reclen/1024;
16846  if(*stop_flag)
16847  {
16848  stride_read -=reclen/1024;
16849  }
16850  if(hist_summary)
16851  {
16852  thread_qtime_stop=time_so_far();
16853  hist_time =(thread_qtime_stop-thread_qtime_start-time_res);
16854  hist_insert(hist_time);
16855  }
16856  if(op_rate_flag)
16857  {
16858  thread_qtime_stop=time_so_far();
16859  desired_op_rate_time = ((double)1.0/(double)op_rate);
16860  actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
16861 /*
16862 printf("Desired rate %g Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
16863  actual_rate, (desired_op_rate_time-actual_rate));
16864 */
16865  if( actual_rate < desired_op_rate_time)
16866  my_unap((unsigned long long) ((desired_op_rate_time-actual_rate)*1000000.0 ));
16867  }
16868  if(Q_flag)
16869  {
16870  thread_qtime_stop=time_so_far();
16871 #ifdef NO_PRINT_LLD
16872  fprintf(thread_strqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
16873 #else
16874  fprintf(thread_strqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
16875 #endif
16876  }
16877  }
16878  if(file_lock)
16879  if(mylockf((int) fd,(int)0,(int)1))
16880  printf("Read unlock failed %d\n",errno);
16881 #ifdef ASYNC_IO
16882  if(async_flag)
16883  {
16884  end_async(gc);
16885  gc=0;
16886  }
16887 #endif
16888  if(include_flush)
16889  {
16890  if(mmapflag)
16891  {
16892  msync(maddr,(size_t)(numrecs64*reclen),MS_SYNC);
16893  }else
16894  fsync(fd);
16895  }
16896  if(include_close)
16897  {
16898  if(mmapflag)
16899  {
16900  mmap_end(maddr,(unsigned long long)numrecs64*reclen);
16901  }
16902  close(fd);
16903  }
16904  temp_time = time_so_far();
16905  child_stat->throughput = ((temp_time - starttime2)-time_res)
16906  -compute_val;
16907  if(child_stat->throughput < (double).000001)
16908  {
16910  if(rec_prob < reclen)
16911  rec_prob = reclen;
16912  res_prob=1;
16913  }
16914  if(OPS_flag){
16915  stride_read=(stride_read*1024)/reclen;
16916  }
16917  child_stat->throughput = stride_read/child_stat->throughput;
16918  child_stat->actual = stride_read;
16919  if(!xflag)
16920  {
16921  *stop_flag=1;
16922  if(distributed && client_iozone)
16923  send_stop();
16924  }
16925  if(cpuutilflag)
16926  {
16928  if (cputime < cputime_res)
16929  cputime = 0.0;
16933  }
16934  if(distributed && client_iozone)
16935  {
16937  child_stat->actual,
16939  (char)*stop_flag,
16940  (long long)CHILD_STATE_HOLD);
16941  }
16942  child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
16943  if(!include_close)
16944  {
16945  if(mmapflag)
16946  {
16947  msync(maddr,(size_t)(numrecs64*reclen),MS_SYNC);
16948  mmap_end(maddr,(unsigned long long)numrecs64*reclen);
16949  }else
16950  fsync(fd);
16951  close(fd);
16952  }
16953  if(Q_flag && (thread_strqfd !=0) )
16954  fclose(thread_strqfd);
16955  free(dummyfile[xx]);
16956  if(debug1)
16957 #ifdef NO_PRINT_LLD
16958  printf("\nChild finished %ld\n",xx);
16959 #else
16960  printf("\nChild finished %lld\n",xx);
16961 #endif
16962 
16963  if(L_flag)
16964  {
16965  get_date(now_string);
16966  fprintf(thread_Lwqfd,"%-25s %s","Stride test finished: ",
16967  now_string);
16968  fclose(thread_Lwqfd);
16969  }
16970  if(hist_summary)
16971  dump_hist("Stride Read",(int)xx);
16972  if(distributed && client_iozone)
16973  return(0);
16974 #ifdef NO_THREADS
16975  exit(0);
16976 #else
16977  if(use_thread)
16978  thread_exit();
16979  else
16980  exit(0);
16981 #endif
16982 return(0);
16983 }
int check_filename()
void end_async()
ssize_t read(int fd, void *buf, size_t count)
Definition: appio.c:225
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
long long rec_prob
Definition: iozone.c:1294
char compute_flag
Definition: iozone.c:1520
void mmap_end()
#define CHILD_STATE_HOLD
Definition: iozone.c:942
char verify
Definition: iozone.c:1513
struct child_stats * child_stat
long long stride
Definition: iozone.c:1532
int no_unlink
Definition: iozone.c:1521
void tell_master_stats()
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
char mmapflag
Definition: iozone.c:1512
char k_flag
Definition: iozone.c:1509
#define MAXNAMESIZE
Definition: iozone.c:833
int fd
Definition: iozone.c:1291
#define DISRUPT
Definition: iozone.c:779
float actual
Definition: iozone.c:463
char * barray[MAXSTREAMS]
Definition: iozone.c:1287
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
void get_date()
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
int thread_exit()
Definition: iozone.c:18526
char disrupt_flag
Definition: iozone.c:1520
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
void disrupt()
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long reclen
Definition: iozone.c:1535
int num_processors
Definition: iozone.c:1293
char read_sync
Definition: iozone.c:1295
int op_rate
Definition: iozone.c:1301
char distributed
Definition: iozone.c:1296
int mylockf()
char use_thread
Definition: iozone.c:1372
float compute_time
Definition: iozone.c:1538
float throughput
Definition: iozone.c:462
void async_init()
Definition: iozone.c:19044
int async_read_no_copy()
Definition: iozone.c:19050
char client_iozone
Definition: iozone.c:1296
char cpuutilflag
Definition: iozone.c:1321
long long debug1
Definition: iozone.c:1373
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
char unbuffered
Definition: iozone.c:1509
void wait_for_master_go()
char * initfile()
long long delay
Definition: iozone.c:1533
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
float cputime
Definition: iozone.c:461
int begin_proc
Definition: iozone.c:1293
int async_read()
Definition: iozone.c:19026
char * buffer1
Definition: iozone.c:1366
int op_rate_flag
Definition: iozone.c:1302
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
long long chid
Definition: iozone.c:1529
char L_flag
Definition: iozone.c:1518
void tell_master_ready()
char mfflag
Definition: iozone.c:1334
long long x
Definition: iozone.c:1335
VOLATILE char * stop_flag
Definition: iozone.c:1537
char * buffer
Definition: iozone.c:1366
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
off64_t numrecs64
Definition: iozone.c:1534
long long flag
Definition: iozone.c:458
int share_file
Definition: iozone.c:1309
long long verify_buffer(char *buffer, long long length, off64_t recnum, long long recsize, unsigned long long patt, char sverify)
Definition: iozone.c:6940
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
char xflag
Definition: iozone.c:1520
int close()
void send_stop()
Definition: iozone.c:22607
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
char oflag
Definition: iozone.c:1509
void async_release()
Definition: iozone.c:19056
void my_nap()
void Poll()
char h_flag
Definition: iozone.c:1509
float walltime
Definition: iozone.c:460
void dump_hist()
char Q_flag
Definition: iozone.c:1517
long long res_prob
Definition: iozone.c:1294
int ioz_processor_bind
Definition: iozone.c:1293
char no_copy_flag
Definition: iozone.c:1519
double temp_time
Definition: iozone.c:1268
static double time_so_far()
Definition: iozone.c:6844
void my_unap()
char include_close
Definition: iozone.c:1519
void hist_insert()
char OPS_flag
Definition: iozone.c:1517
#define THREAD_STRIDE_TEST
Definition: iozone.c:1433
int unlink()
int client_error
Definition: iozone.c:1398
void exit()
int rlocking
Definition: iozone.c:1308
int fsync()
double cputime_res
Definition: iozone.c:1271
#define MAXSTREAMS
Definition: iozone.c:813
long long off64_t
Definition: iozone.c:357
unsigned long cache_size
Definition: iozone.c:1375
int errno
int i
Definition: fileop.c:140
int direct_flag
Definition: iozone.c:1527
#define CHILD_STATE_READY
Definition: iozone.c:944
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ thread_write_test() [1/2]

void*() thread_write_test ( )
Here is the caller graph for this function:

◆ thread_write_test() [2/2]

void* thread_write_test ( x  )

Definition at line 12313 of file iozone.c.

12315 {
12316 
12317  struct child_stats *child_stat;
12318  double starttime1 = 0;
12319  double temp_time;
12320  double walltime, cputime;
12321  double compute_val = (double)0;
12322  float delay = (float)0;
12323  double thread_qtime_stop,thread_qtime_start;
12324  double hist_time;
12325  double desired_op_rate_time;
12326  double actual_rate;
12327  off64_t traj_offset;
12328  off64_t lock_offset=0;
12329  off64_t save_offset=0;
12330  long long flags,traj_size;
12331  long long w_traj_bytes_completed;
12332  long long w_traj_ops_completed;
12333  FILE *w_traj_fd;
12334  int fd;
12335  long long recs_per_buffer;
12336  long long stopped,i;
12337  off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far;
12338  long long xx,xx2;
12339  char *dummyfile [MAXSTREAMS]; /* name of dummy file */
12340  char *nbuff;
12341  char *maddr;
12342  char *wmaddr,*free_addr;
12343  char now_string[30];
12344  int anwser,bind_cpu,wval;
12345 #if defined(VXFS) || defined(solaris)
12346  int test_foo = 0;
12347 #endif
12349  char tmpname[256];
12350  FILE *thread_wqfd;
12351  FILE *thread_Lwqfd;
12352 
12353 #ifdef ASYNC_IO
12354  struct cache *gc=0;
12355 
12356 #else
12357  long long *gc=0;
12358 #endif
12359 
12360  if(compute_flag)
12362  nbuff=maddr=wmaddr=free_addr=0;
12363  hist_time=thread_qtime_stop=thread_qtime_start=0;
12364  thread_wqfd=w_traj_fd=thread_Lwqfd=(FILE *)0;
12365  traj_offset=walltime=cputime=0;
12366  anwser=bind_cpu=0;
12367  if(w_traj_flag)
12368  {
12371  }
12372  else
12373  {
12375  }
12376  written_so_far=read_so_far=re_written_so_far=re_read_so_far=0;
12378  recs_per_buffer = cache_size/reclen ;
12379 #ifdef NO_THREADS
12380  xx=chid;
12381 #else
12382  if(use_thread)
12383  {
12384  xx = (long long)((long)x);
12385  }
12386  else
12387  {
12388  xx=chid;
12389  }
12390 #endif
12391 #ifndef NO_THREADS
12392 #if defined(_HPUX_SOURCE) || defined(linux)
12393  if(ioz_processor_bind)
12394  {
12395  bind_cpu=(begin_proc+(int)xx)%num_processors;
12396 #if defined(_HPUX_SOURCE)
12397  pthread_processor_bind_np(PTHREAD_BIND_FORCED_NP,
12398  (pthread_spu_t *)&anwser, (pthread_spu_t)bind_cpu, pthread_self());
12399 #else
12400  cpu_set_t cpuset;
12401 
12402  CPU_ZERO(&cpuset);
12403  CPU_SET(bind_cpu, &cpuset);
12404 
12405  pthread_setaffinity_np(pthread_self(), sizeof(cpuset),&cpuset);
12406 #endif
12407  my_nap(40); /* Switch to new cpu */
12408  }
12409 #endif
12410 #endif
12411  if(use_thread)
12412  nbuff=barray[xx];
12413  else
12414  nbuff=buffer;
12415  if(debug1 )
12416  {
12417  if(use_thread)
12418 #ifdef NO_PRINT_LLD
12419  printf("\nStarting child %ld\n",xx);
12420 #else
12421  printf("\nStarting child %lld\n",xx);
12422 #endif
12423  else
12424 #ifdef NO_PRINT_LLD
12425  printf("\nStarting process %d slot %ld\n",getpid(),xx);
12426 #else
12427  printf("\nStarting process %d slot %lld\n",getpid(),xx);
12428 #endif
12429 
12430  }
12431  dummyfile[xx]=(char *)malloc((size_t)MAXNAMESIZE);
12432  xx2=xx;
12433  if(share_file)
12434  xx2=(long long)0;
12435  if(mfflag)
12436  {
12437 #ifdef NO_PRINT_LLD
12438  sprintf(dummyfile[xx],"%s",filearray[xx2]);
12439 #else
12440  sprintf(dummyfile[xx],"%s",filearray[xx2]);
12441 #endif
12442  }
12443  else
12444  {
12445 #ifdef NO_PRINT_LLD
12446  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx2],xx2);
12447 #else
12448  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx2],xx2);
12449 #endif
12450  }
12451  /*****************/
12452  /* Children only */
12453  /*******************************************************************/
12454  /* Initial write throughput performance test. **********************/
12455  /*******************************************************************/
12456 #if defined(Windows)
12457  if(unbuffered)
12458  {
12459  hand=CreateFile(dummyfile[xx],
12460  GENERIC_READ|GENERIC_WRITE,
12461  FILE_SHARE_WRITE|FILE_SHARE_READ,
12462  NULL,OPEN_ALWAYS,FILE_FLAG_NO_BUFFERING|
12463  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
12464  NULL);
12465  CloseHandle(hand);
12466  }
12467 #endif
12468  if(oflag)
12469  flags=O_RDWR|O_SYNC|O_CREAT;
12470  else
12471  flags=O_RDWR|O_CREAT;
12472 #if defined(O_DSYNC)
12473  if(odsync)
12474  flags |= O_DSYNC;
12475 #endif
12476 #if defined(_HPUX_SOURCE) || defined(linux)
12477  if(read_sync)
12478  flags |=O_RSYNC|O_SYNC;
12479 #endif
12480 
12481 #if ! defined(DONT_HAVE_O_DIRECT)
12482 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
12483  if(direct_flag)
12484  flags |=O_DIRECT;
12485 #endif
12486 #if defined(TRU64)
12487  if(direct_flag)
12488  flags |=O_DIRECTIO;
12489 #endif
12490 #endif
12491 #if defined(Windows)
12492  if(unbuffered)
12493  {
12494  hand=CreateFile(dummyfile[xx],
12495  GENERIC_READ|GENERIC_WRITE,
12496  FILE_SHARE_WRITE|FILE_SHARE_READ,
12497  NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
12498  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
12499  NULL);
12500  }
12501  else
12502  {
12503 #endif
12504  if((fd = I_OPEN(dummyfile[xx], (int)flags,0640))<0)
12505  {
12507  if(distributed && client_iozone)
12508  send_stop();
12509  printf("\nCan not open temp file: %s\n",
12510  filename);
12511  perror("open");
12512  exit(125);
12513  }
12514 #if defined(Windows)
12515  }
12516 #endif
12517 #ifdef VXFS
12518  if(direct_flag)
12519  {
12520  ioctl(fd,VX_SETCACHE,VX_DIRECT);
12521  ioctl(fd,VX_GETCACHE,&test_foo);
12522  if(test_foo == 0)
12523  {
12524  if(!client_iozone)
12525  printf("\nVxFS advanced setcache feature not available.\n");
12526  exit(3);
12527  }
12528  }
12529 #endif
12530 #if defined(solaris)
12531  if(direct_flag)
12532  {
12533  test_foo = directio(fd, DIRECTIO_ON);
12534  if(test_foo != 0)
12535  {
12536  if(!client_iozone)
12537  printf("\ndirectio not available.\n");
12538  exit(3);
12539  }
12540  }
12541 #endif
12542 #ifdef ASYNC_IO
12543  if(async_flag)
12544  async_init(&gc,fd,direct_flag);
12545 #endif
12546  if(mmapflag)
12547  {
12548  maddr=(char *)initfile(fd,(filebytes64),1,PROT_READ|PROT_WRITE);
12549  }
12550  if(reclen < cache_size )
12551  {
12552  recs_per_buffer = cache_size/reclen ;
12553  nbuff=&nbuff[(xx%recs_per_buffer)*reclen];
12554  }
12555  if(fetchon) /* Prefetch into processor cache */
12556  fetchit(nbuff,reclen);
12557  if((verify && !no_copy_flag) || dedup || dedup_interior)
12558  fill_buffer(nbuff,reclen,(long long)pattern,sverify,(long long)0);
12559 
12560  if(w_traj_flag)
12562 
12563  child_stat = (struct child_stats *)&shmaddr[xx];
12564  child_stat->throughput = 0;
12565  child_stat->actual = 0;
12566  child_stat->flag=CHILD_STATE_READY; /* Tell parent child is ready to go */
12567  if(distributed && client_iozone)
12569  if(distributed && client_iozone)
12570  {
12571  if(cdebug)
12572  {
12573  fprintf(newstdout,"Child %d waiting for go from master\n",(int)xx);
12574  fflush(newstdout);
12575  }
12577  if(cdebug)
12578  {
12579  fprintf(newstdout,"Child %d received go from master\n",(int)xx);
12580  fflush(newstdout);
12581  }
12582  }
12583  else
12584  {
12585  while(child_stat->flag!=CHILD_STATE_BEGIN) /* Wait for signal from parent */
12586  Poll((long long)1);
12587  }
12588 
12589  written_so_far=0;
12590  child_stat = (struct child_stats *)&shmaddr[xx];
12591  child_stat->actual = 0;
12592  child_stat->throughput = 0;
12593  stopped=0;
12594  if(file_lock)
12595  if(mylockf((int) fd, (int) 1, (int)0) != 0)
12596  printf("File lock for write failed. %d\n",errno);
12597  if(Q_flag)
12598  {
12599  sprintf(tmpname,"Child_%d_wol.dat",(int)xx);
12600  thread_wqfd=fopen(tmpname,"a");
12601  if(thread_wqfd==0)
12602  {
12604  if(distributed && client_iozone)
12605  send_stop();
12606  printf("Unable to open %s\n",tmpname);
12607  exit(40);
12608  }
12609  fprintf(thread_wqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
12610  }
12611  if(L_flag)
12612  {
12613  sprintf(tmpname,"Child_%d.log",(int)xx);
12614  thread_Lwqfd=fopen(tmpname,"a");
12615  if(thread_Lwqfd==0)
12616  {
12618  if(distributed && client_iozone)
12619  send_stop();
12620  printf("Unable to open %s\n",tmpname);
12621  exit(40);
12622  }
12623  get_date(now_string);
12624  fprintf(thread_Lwqfd,"%-25s %s","Write test start: ",now_string);
12625  }
12626  starttime1 = time_so_far();
12627  if(cpuutilflag)
12628  {
12629  walltime = starttime1;
12630  cputime = cputime_so_far();
12631  }
12632  if(w_traj_flag)
12633  rewind(w_traj_fd);
12634  for(i=0; i<numrecs64; i++){
12635  if(w_traj_flag)
12636  {
12637  traj_offset=get_traj(w_traj_fd, (long long *)&traj_size,(float *)&delay, (long)1);
12638  reclen=traj_size;
12639 #if defined(Windows)
12640  if(unbuffered)
12641  SetFilePointer(hand,(LONG)traj_offset,0,FILE_BEGIN);
12642  else
12643 #endif
12644  I_LSEEK(fd,traj_offset,SEEK_SET);
12645  }
12646  if(Q_flag)
12647  {
12648 #if defined(Windows)
12649  if(unbuffered)
12650  traj_offset=SetFilePointer(hand,0,0,FILE_CURRENT);
12651  else
12652 #endif
12653  traj_offset=I_LSEEK(fd,0,SEEK_CUR);
12654  }
12655  if(rlocking)
12656  {
12657  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
12658  mylockr((int) fd, (int) 1, (int)0,
12659  lock_offset, reclen);
12660  }
12661  if((verify && !no_copy_flag) || dedup || dedup_interior)
12662  fill_buffer(nbuff,reclen,(long long)pattern,sverify,i);
12663  if(compute_flag)
12664  compute_val+=do_compute(delay);
12665  if(*stop_flag && !stopped){
12666  if(include_flush)
12667  {
12668  if(mmapflag)
12669  msync(maddr,(size_t)filebytes64,MS_SYNC);
12670  else
12671  fsync(fd);
12672  }
12673  /* Close and re-open to get close in measurment */
12674  if(include_close)
12675  {
12676  save_offset=I_LSEEK(fd,0,SEEK_CUR);
12677  close(fd);
12678  }
12680  (time_so_far() - starttime1)-time_res;
12681  if(include_close)
12682  {
12683  if((fd = I_OPEN(dummyfile[xx], (int)flags,0))<0)
12684  {
12686  if(distributed && client_iozone)
12687  send_stop();
12688  printf("\nCan not open temp file: %s\n",
12689  filename);
12690  perror("open");
12691  exit(125);
12692  }
12693  I_LSEEK(fd,save_offset,SEEK_SET);
12694  }
12695  if(child_stat->throughput < (double).000001)
12696  {
12698  if(rec_prob < reclen)
12699  rec_prob = reclen;
12700  res_prob=1;
12701  }
12702 
12703  if(OPS_flag){
12704  /*written_so_far=(written_so_far*1024)/reclen;*/
12705  written_so_far=w_traj_ops_completed;
12706  }
12708  (double)written_so_far/child_stat->throughput;
12709  child_stat->actual = (double)written_so_far;
12710  if(debug1)
12711  {
12712  printf("\n(%ld) Stopped by another\n", (long)xx);
12713  }
12714  stopped=1;
12715  }
12716  if(purge)
12717  purgeit(nbuff,reclen);
12718  if(Q_flag || hist_summary || op_rate_flag)
12719  {
12720  thread_qtime_start=time_so_far();
12721  }
12722 again:
12723  if(mmapflag)
12724  {
12725  wmaddr = &maddr[i*reclen];
12726  fill_area((long long*)nbuff,(long long*)wmaddr,(long long)reclen);
12727  /*printf("CHid: %lld Writing offset %lld for length of %lld\n",chid,i*reclen,reclen);*/
12728  if(!mmapnsflag)
12729  {
12730  if(mmapasflag)
12731  msync(wmaddr,(size_t)reclen,MS_ASYNC);
12732  if(mmapssflag)
12733  msync(wmaddr,(size_t)reclen,MS_SYNC);
12734  }
12735  }
12736  else
12737  {
12738  if(async_flag)
12739  {
12740  if(no_copy_flag)
12741  {
12742  free_addr=nbuff=(char *)malloc((size_t)reclen+page_size);
12743  nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
12744  if(verify || dedup || dedup_interior)
12745  fill_buffer(nbuff,reclen,(long long)pattern,sverify,i);
12746  async_write_no_copy(gc, (long long)fd, nbuff, reclen, (i*reclen), depth,free_addr);
12747  }
12748  else
12749  async_write(gc, (long long)fd, nbuff, reclen, (i*reclen), depth);
12750  }
12751  else
12752  {
12753 #if defined(Windows)
12754  if(unbuffered)
12755  {
12756  WriteFile(hand,nbuff,reclen, (LPDWORD)&wval,0);
12757  }
12758  else
12759  {
12760 #endif
12761  wval=write(fd, nbuff, (size_t) reclen);
12762 #if defined(Windows)
12763  }
12764 #endif
12765  if(wval != reclen)
12766  {
12767  if(*stop_flag && !stopped){
12768  if(include_flush)
12769  {
12770  if(mmapflag)
12771  msync(maddr,(size_t)filebytes64,MS_SYNC);
12772  else
12773  fsync(fd);
12774  }
12775  temp_time = time_so_far();
12777  (temp_time - starttime1)-time_res;
12778  if(child_stat->throughput < (double).000001)
12779  {
12781  if(rec_prob < reclen)
12782  rec_prob = reclen;
12783  res_prob=1;
12784  }
12785 
12786  if(OPS_flag){
12787  /*written_so_far=(written_so_far*1024)/reclen;*/
12788  written_so_far=w_traj_ops_completed;
12789  }
12791  (double)written_so_far/child_stat->throughput;
12792  child_stat->actual = (double)written_so_far;
12793  if(debug1)
12794  {
12795  printf("\n(%ld) Stopped by another\n", (long)xx);
12796  }
12797  stopped=1;
12798  goto again;
12799  }
12800  /* Note: Writer must finish even though told
12801  to stop. Otherwise the readers will fail.
12802  The code will capture bytes transfered
12803  before told to stop but let the writer
12804  complete.
12805  */
12806 #ifdef NO_PRINT_LLD
12807  printf("\nError writing block %ld, fd= %d\n", i,
12808  fd);
12809 #else
12810  printf("\nError writing block %lld, fd= %d\n", i,
12811  fd);
12812 #endif
12813  if(wval==-1)
12814  perror("write");
12815  if (!no_unlink)
12816  {
12817  if(check_filename(dummyfile[xx]))
12818  unlink(dummyfile[xx]);
12819  }
12821  exit(127);
12822  }
12823  }
12824  }
12825  if(hist_summary)
12826  {
12827  thread_qtime_stop=time_so_far();
12828  hist_time =(thread_qtime_stop-thread_qtime_start);
12829  hist_insert(hist_time);
12830  }
12831  if(op_rate_flag)
12832  {
12833  thread_qtime_stop=time_so_far();
12834  desired_op_rate_time = ((double)1.0/(double)op_rate);
12835  actual_rate = (double)(thread_qtime_stop-thread_qtime_start);
12836 /*
12837 printf("Desired rate %g Actual rate %g Nap %g microseconds\n",desired_op_rate_time,
12838  actual_rate, (desired_op_rate_time-actual_rate));
12839 */
12840  if( actual_rate < desired_op_rate_time)
12841  my_unap((unsigned long long)((desired_op_rate_time-actual_rate)*1000000.0 ));
12842  }
12843  if(Q_flag)
12844  {
12845  thread_qtime_stop=time_so_far();
12846 #ifdef NO_PRINT_LLD
12847  fprintf(thread_wqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
12848 #else
12849  fprintf(thread_wqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((thread_qtime_stop-thread_qtime_start-time_res))*1000000,reclen);
12850 #endif
12851  }
12854  written_so_far+=reclen/1024;
12855  if(*stop_flag)
12856  {
12857  written_so_far-=reclen/1024;
12859  }
12860  if(rlocking)
12861  {
12862  mylockr((int) fd, (int) 0, (int)0,
12863  lock_offset, reclen);
12864  }
12865  }
12866 
12867 
12868  if(file_lock)
12869  if(mylockf((int) fd, (int) 0, (int)0))
12870  printf("Write unlock failed. %d\n",errno);
12871 
12872 #ifdef ASYNC_IO
12873  if(async_flag)
12874  {
12875  end_async(gc);
12876  gc=0;
12877  }
12878 #endif
12879  if(!xflag)
12880  {
12881  *stop_flag=1;
12882  if(distributed && client_iozone)
12883  send_stop();
12884  }
12885 
12886  if(include_flush)
12887  {
12888  if(mmapflag)
12889  msync(maddr,(size_t)filebytes64,MS_SYNC);
12890  else
12891  fsync(fd);
12892  }
12893  if(include_close)
12894  {
12895  if(mmapflag)
12896  mmap_end(maddr,(unsigned long long)filebytes64);
12897 #if defined(Windows)
12898  if(unbuffered)
12899  CloseHandle(hand);
12900  else
12901 #endif
12902  close(fd);
12903  }
12904  if(!stopped){
12905  temp_time = time_so_far();
12906  child_stat->throughput = ((temp_time - starttime1)-time_res)
12907  -compute_val;
12908  if(child_stat->throughput < (double).000001)
12909  {
12911  if(rec_prob < reclen)
12912  rec_prob = reclen;
12913  res_prob=1;
12914  }
12915 
12916  if(OPS_flag){
12917  /*written_so_far=(written_so_far*1024)/reclen;*/
12918  written_so_far=w_traj_ops_completed;
12919  }
12921  (double)written_so_far/child_stat->throughput;
12922  child_stat->actual = (double)written_so_far;
12923  }
12924  if(cdebug)
12925  {
12926  fprintf(newstdout,"Child %d: throughput %f actual %f \n",(int)chid, child_stat->throughput,
12927  child_stat->actual);
12928  fflush(newstdout);
12929  }
12930  if(cpuutilflag)
12931  {
12933  if (cputime < cputime_res)
12934  cputime = 0.0;
12938  }
12939  if(distributed && client_iozone)
12941  child_stat->actual,
12943  (char)*stop_flag,
12944  (long long)CHILD_STATE_HOLD);
12945 
12946  if (debug1) {
12947  printf(" child/slot: %lld, wall-cpu: %8.3f %8.3fC" " -> %6.2f%%\n",
12948  xx, walltime, cputime,
12950  }
12951  child_stat->flag = CHILD_STATE_HOLD; /* Tell parent I'm done */
12952  stopped=0;
12953  /*******************************************************************/
12954  /* End write performance test. *************************************/
12955  /*******************************************************************/
12956  if(debug1)
12957 #ifdef NO_PRINT_LLD
12958  printf("\nChild finished %ld\n",xx);
12959 #else
12960  printf("\nChild finished %lld\n",xx);
12961 #endif
12962  if(!include_close)
12963  {
12964  if(mmapflag)
12965  {
12966  msync(maddr,(size_t)numrecs64*reclen,MS_SYNC); /*Clean up before read starts running*/
12967  mmap_end(maddr,(unsigned long long)numrecs64*reclen);
12968  }else
12969  fsync(fd);
12970 
12971 #if defined(Windows)
12972  if(unbuffered)
12973  CloseHandle(hand);
12974  else
12975 #endif
12976  close(fd);
12977  }
12978  if(Q_flag && (thread_wqfd !=0) )
12979  fclose(thread_wqfd);
12980  free(dummyfile[xx]);
12981  if(w_traj_flag)
12982  fclose(w_traj_fd);
12983 
12984  if(L_flag)
12985  {
12986  get_date(now_string);
12987  fprintf(thread_Lwqfd,"%-25s %s","Write test finished: ",now_string);
12988  fclose(thread_Lwqfd);
12989  }
12990  if(hist_summary)
12991  dump_hist("write",(int)xx);
12992  if(distributed && client_iozone)
12993  return(0);
12994 #ifdef NO_THREADS
12995  exit(0);
12996 #else
12997  if(use_thread)
12998  thread_exit();
12999  else
13000  exit(0);
13001 #endif
13002 return(0);
13003 }
int check_filename()
void end_async()
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
long long rec_prob
Definition: iozone.c:1294
int w_traj_flag
Definition: iozone.c:1523
char compute_flag
Definition: iozone.c:1520
void mmap_end()
#define CHILD_STATE_HOLD
Definition: iozone.c:942
long long get_traj()
char verify
Definition: iozone.c:1513
struct child_stats * child_stat
size_t async_write()
Definition: iozone.c:19038
long long w_traj_bytes_completed
Definition: iozone.c:1327
int no_unlink
Definition: iozone.c:1521
void tell_master_stats()
void fill_buffer()
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
char mmapflag
Definition: iozone.c:1512
#define MAXNAMESIZE
Definition: iozone.c:833
int fd
Definition: iozone.c:1291
float actual
Definition: iozone.c:463
char * barray[MAXSTREAMS]
Definition: iozone.c:1287
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
void get_date()
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
#define THREAD_WRITE_TEST
Definition: iozone.c:1429
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
int thread_exit()
Definition: iozone.c:18526
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long w_traj_ops_completed
Definition: iozone.c:1327
long long reclen
Definition: iozone.c:1535
int num_processors
Definition: iozone.c:1293
char read_sync
Definition: iozone.c:1295
long long w_traj_fsize
Definition: iozone.c:1325
int op_rate
Definition: iozone.c:1301
char distributed
Definition: iozone.c:1296
int mylockf()
char use_thread
Definition: iozone.c:1372
float compute_time
Definition: iozone.c:1538
float throughput
Definition: iozone.c:462
void async_init()
Definition: iozone.c:19044
char client_iozone
Definition: iozone.c:1296
char cpuutilflag
Definition: iozone.c:1321
long long debug1
Definition: iozone.c:1373
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
char unbuffered
Definition: iozone.c:1509
void wait_for_master_go()
char * initfile()
long long page_size
Definition: iozone.c:428
long long delay
Definition: iozone.c:1533
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char mmapasflag
Definition: iozone.c:1512
size_t async_write_no_copy()
Definition: iozone.c:19032
float cputime
Definition: iozone.c:461
int cdebug
Definition: iozone.c:1478
long long w_traj_ops
Definition: iozone.c:1325
int begin_proc
Definition: iozone.c:1293
char odsync
Definition: iozone.c:1516
int op_rate_flag
Definition: iozone.c:1302
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
char dedup
Definition: iozone.c:1304
long long chid
Definition: iozone.c:1529
char L_flag
Definition: iozone.c:1518
void tell_master_ready()
char mfflag
Definition: iozone.c:1334
long long x
Definition: iozone.c:1335
VOLATILE char * stop_flag
Definition: iozone.c:1537
char * buffer
Definition: iozone.c:1366
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
off64_t numrecs64
Definition: iozone.c:1534
long long flag
Definition: iozone.c:458
char mmapssflag
Definition: iozone.c:1512
int share_file
Definition: iozone.c:1309
char dedup_interior
Definition: iozone.c:1304
FILE * open_w_traj()
Definition: iozone.c:19707
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
static double cpu_util()
char xflag
Definition: iozone.c:1520
int close()
FILE * w_traj_fd
Definition: iozone.c:1367
void send_stop()
Definition: iozone.c:22607
FILE * newstdout
Definition: iozone.c:1475
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
char oflag
Definition: iozone.c:1509
void my_nap()
void Poll()
float walltime
Definition: iozone.c:460
void dump_hist()
char Q_flag
Definition: iozone.c:1517
long long res_prob
Definition: iozone.c:1294
int ioz_processor_bind
Definition: iozone.c:1293
char no_copy_flag
Definition: iozone.c:1519
double temp_time
Definition: iozone.c:1268
static double time_so_far()
Definition: iozone.c:6844
void my_unap()
char include_close
Definition: iozone.c:1519
void hist_insert()
char OPS_flag
Definition: iozone.c:1517
int unlink()
int client_error
Definition: iozone.c:1398
void exit()
int rlocking
Definition: iozone.c:1308
char mmapnsflag
Definition: iozone.c:1512
int fsync()
double cputime_res
Definition: iozone.c:1271
#define MAXSTREAMS
Definition: iozone.c:813
long long off64_t
Definition: iozone.c:357
unsigned long cache_size
Definition: iozone.c:1375
int errno
int i
Definition: fileop.c:140
int direct_flag
Definition: iozone.c:1527
#define CHILD_STATE_READY
Definition: iozone.c:944
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

◆ throughput_test()

void throughput_test ( )

Definition at line 3530 of file iozone.c.

3532 {
3533  char *unit;
3534  double starttime1 = 0;
3535  double jstarttime = 0;
3536  double jtime = 0;
3537  double walltime = 0;
3538  double cputime = 0;
3539  char *port;
3540  char getout;
3541  long long throughsize = KILOBYTES;
3542  long long xx,xy,i;
3543  long long xyz;
3544  double ptotal;
3545  off64_t written_so_far, read_so_far, re_written_so_far,re_read_so_far;
3546  VOLATILE char *temp;
3547  double min_throughput = 0;
3548  double max_throughput = 0;
3549  double avg_throughput = 0;
3550  double min_xfer = 0;
3551 
3552 
3553  toutputindex=0;
3554  strcpy(&toutput[0][0],throughput_tests[0]);
3555  ptotal=written_so_far=read_so_far=re_written_so_far=re_read_so_far=0 ;
3556 
3557  if(OPS_flag)
3558  unit="ops";
3559  else
3560  unit="KB";
3561 
3562  if(!haveshm)
3563  {
3564  shmaddr=(struct child_stats *)alloc_mem((long long)SHMSIZE,(int)1);
3565 #ifdef _64BIT_ARCH_
3566  if((long long)shmaddr==(long long)-1)
3567 #else
3568  if((long )shmaddr==(long)-1)
3569 #endif
3570  {
3571  printf("\nShared memory not working\n");
3572  exit(24);
3573  }
3574  haveshm=(char*)shmaddr;
3575  }
3576  else
3577  shmaddr=(struct child_stats *)haveshm;
3578 
3579  if(use_thread)
3580  stop_flag = &stoptime;
3581  else
3582  {
3583  temp = (char *)&shmaddr[0];
3584  stop_flag = (char *)&temp[(long long)SHMSIZE]-4;
3585  }
3586  for(xyz=0;xyz<num_child;xyz++){ /* all children to state 0 (HOLD) */
3587  child_stat = (struct child_stats *)&shmaddr[xyz];
3589  child_stat->actual=0;
3591  child_stat->cputime=0;
3592  child_stat->walltime=0;
3593  }
3594  *stop_flag = 0;
3595  if(!sflag)
3596  kilobytes64=throughsize;
3597  if(!rflag)
3598  reclen=(long long)4096;
3599  if(aggflag)
3601  numrecs64 = (long long)(kilobytes64*1024)/reclen;
3603  if(use_thread)
3604  port="thread";
3605  else
3606  port="process";
3607  if(w_traj_flag)
3608  {
3609 #ifdef NO_PRINT_LLD
3610  if(!silent) printf("\tEach %s writes a %ld Kbyte file in telemetry controlled records\n",
3611  port,kilobytes64);
3612 #else
3613  if(!silent) printf("\tEach %s writes a %lld Kbyte file in telemetry controlled records\n",
3614  port,kilobytes64);
3615 #endif
3616  }
3617  else
3618  {
3619 #ifdef NO_PRINT_LLD
3620  if(!silent) printf("\tEach %s writes a %ld Kbyte file in %ld Kbyte records\n",
3621  port,kilobytes64,reclen/1024);
3622 #else
3623  if(!silent) printf("\tEach %s writes a %lld Kbyte file in %lld Kbyte records\n",
3624  port,kilobytes64,reclen/1024);
3625 #endif
3626  }
3627 
3628  if(fflag) /* Each child has a file name to write */
3629  for(xx=0;xx<num_child;xx++)
3630  filearray[xx] = filename;
3631  myid = (long long)getpid();
3632 
3633  /* rags: skip writer test */
3634  if(include_tflag)
3635  if(!(include_mask & (long long)WRITER_MASK))
3636  {
3637  store_dvalue( (double)0);
3638  store_dvalue( (double)0);
3639  toutputindex++;
3640  goto next0;
3641  }
3642 
3643  if((!distributed) || (distributed && master_iozone))
3644  start_monitor("Write");
3645  /* Hooks to start the distributed Iozone client/server code */
3646  if(distributed)
3647  {
3648  use_thread=0; /* Turn of any Posix threads */
3649  if(master_iozone)
3651  else
3652  become_client();
3653  }
3654  if(!use_thread)
3655  {
3656  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
3657  chid=xx;
3659  if(childids[xx]==-1){
3660  printf("\nFork failed\n");
3661  for(xy = 0; xy< xx ; xy++){
3662  if(!use_thread)
3663  kill((pid_t)childids[xy],SIGTERM);
3664  }
3665  exit(25);
3666  }
3667  if(childids[xx]!=0 && debug1)
3668 #ifdef NO_PRINT_LLD
3669  printf("Parent starting slot %ld\n",xx);
3670 #else
3671  printf("Parent starting slot %lld\n",xx);
3672 #endif
3673  if( childids[xx] == 0 ){
3674 #ifdef _64BIT_ARCH_
3675  thread_write_test((void *)xx);
3676 #else
3677  thread_write_test((void *)(long)xx);
3678 #endif
3679  }else {
3680 #ifdef NO_PRINT_LLD
3681  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx], xx);
3682 #else
3683  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx], xx);
3684 #endif
3685  }
3686  }
3687  }
3688 #ifndef NO_THREADS
3689  else
3690  {
3691  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
3692 
3693 #ifdef NO_PRINT_LLD
3694  sprintf(dummyfile[xx],"%s.DUMMY.%ld",filearray[xx], xx);
3695 #else
3696  sprintf(dummyfile[xx],"%s.DUMMY.%lld",filearray[xx], xx);
3697 #endif
3698  if(!barray[xx])
3699  {
3700  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
3701  if(barray[xx] == 0) {
3702  perror("Memory allocation failed:");
3703  exit(26);
3704  }
3705  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
3706  ~(cache_size-1));
3707  }
3708 
3709 #ifdef _64BIT_ARCH_
3710  childids[xx] = mythread_create(thread_write_test,(void*)xx);
3711 #else
3712  childids[xx] = mythread_create(thread_write_test,(void*)(long)xx);
3713 #endif
3714  if(childids[xx]==-1){
3715  printf("Thread create failed\n");
3716  for(xy = 0; xy< xx ; xy++){
3717  kill((pid_t)myid,SIGTERM);
3718  }
3719  exit(27);
3720  }
3721  }
3722  }
3723 #endif
3724  if((long long)getpid() == myid)
3725  {
3726  prepage(buffer,reclen); /* Force copy on write */
3727  /* wait for children to start */
3728  if(distributed && master_iozone)
3729  {
3731  }
3732  for(i=0;i<num_child; i++){
3733  child_stat = (struct child_stats *)&shmaddr[i];
3735  Poll((long long)1);
3736  }
3737  for(i=0;i<num_child; i++) /* Start all children going */
3738  {
3739  if(delay_start!=0)
3740  Poll((long long)delay_start);
3741  /* State "go" */
3742  child_stat = (struct child_stats *)&shmaddr[i];
3744  if(distributed && master_iozone)
3746  }
3747  starttime1 = time_so_far(); /* Start parents timer */
3748  goto waitout;
3749  }
3750 
3751 waitout:
3752  getout=0;
3753  if((long long)getpid() == myid) { /* Parent only */
3754  starttime1 = time_so_far(); /* Wait for all children */
3755  for( i = 0; i < num_child; i++){
3756  child_stat = (struct child_stats *) &shmaddr[i];
3757  if(distributed && master_iozone)
3758  {
3759  printf("\n\tTest running:");
3760  wait_dist_join();
3761  break;
3762  }
3763  else
3764  {
3765  if(use_thread)
3766  {
3767  thread_join(childids[i],(void *)&pstatus);
3768  }
3769  else
3770  {
3771  wait(0);
3772  }
3773  }
3774  if(!jstarttime)
3775  jstarttime = time_so_far();
3776  }
3777  jtime = (time_so_far()-jstarttime)-time_res;
3778  if(jtime < (double).000001)
3779  {
3780  jtime=time_res;
3781  }
3782  }
3783  total_time = (time_so_far() - starttime1)-time_res; /* get parents total time */
3784  if(total_time < (double).000001)
3785  {
3787  if(rec_prob < reclen)
3788  rec_prob = reclen;
3789  res_prob=1;
3790  }
3791 #ifdef JTIME
3792  total_time=total_time-jtime;/* Remove the join time */
3793  if(!silent) printf("\nJoin time %10.2f\n",jtime);
3794 #endif
3795 
3796  total_kilos=0;
3797  ptotal=0;
3798  walltime = 0.0;
3799  cputime = 0.0;
3800  if(!silent) printf("\n");
3801  for(xyz=0;xyz<num_child;xyz++){
3802  child_stat = (struct child_stats *) &shmaddr[xyz];
3803  total_kilos += child_stat->throughput; /* add up the children */
3804  ptotal += child_stat->actual;
3805  if(!min_xfer)
3806  min_xfer=child_stat->actual;
3807  if(child_stat->actual < min_xfer)
3808  min_xfer=child_stat->actual;
3809  if(!min_throughput)
3810  min_throughput=child_stat->throughput;
3811  if(child_stat->throughput < min_throughput)
3812  min_throughput=child_stat->throughput;
3813  if(child_stat->throughput > max_throughput)
3814  max_throughput=child_stat->throughput;
3815  /* Add up the cpu times of all children */
3817 
3818  /* and find the child with the longest wall time */
3819  /* Get the earliest start time and latest fini time to calc. elapsed time. */
3822  if (child_stat->walltime > walltime)
3824  }
3825  avg_throughput=total_kilos/num_child;
3826  if(cpuutilflag)
3827  {
3828  if (cputime < cputime_res)
3829  cputime = 0.0;
3830  }
3831 
3832  for(xyz=0;xyz<num_child;xyz++){
3833  child_stat = (struct child_stats *) &shmaddr[xyz];
3834  child_stat->flag = CHILD_STATE_HOLD; /* Start children at state 0 (HOLD) */
3835  }
3836  if(cpuutilflag)
3837  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
3839 #ifdef NO_PRINT_LLD
3840  if(!silent) printf("\tChildren see throughput for %2ld initial writers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
3841  if(!silent && !distributed) printf("\tParent sees throughput for %2ld initial writers \t= %10.2f %s/sec\n",num_child,((double)(ptotal)/total_time),unit);
3842 #else
3843  if(!silent) printf("\tChildren see throughput for %2lld initial writers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
3844  if(!silent && !distributed) printf("\tParent sees throughput for %2lld initial writers \t= %10.2f %s/sec\n",num_child,((double)(ptotal)/total_time),unit);
3845 #endif
3846  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
3847  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
3848  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
3849  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
3850  /* CPU% can be > 100.0 for multiple CPUs */
3851  if(cpuutilflag)
3852  {
3853  if(walltime == 0.0)
3854  {
3855  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
3856  walltime, cputime, 0.0);
3857  }
3858  else
3859  {
3860  if(!silent) printf("\tCPU Utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
3861  walltime, cputime, 100.0 * cputime / walltime);
3862  }
3863  }
3864  if(Cflag)
3865  {
3866  for(xyz=0;xyz<num_child;xyz++)
3867  {
3868  child_stat = (struct child_stats *) &shmaddr[xyz];
3869  if(cpuutilflag)
3870  {
3871  if(!silent)
3872  printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
3873  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
3875  }
3876  else
3877  {
3878  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
3879  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
3880  }
3881  }
3882  }
3883  if((!distributed) || (distributed && master_iozone))
3884  stop_monitor("Write");
3885  /**********************************************************/
3886  /*************** End of intitial writer *******************/
3887  /**********************************************************/
3888  sync();
3889  sleep(2);
3890  if(restf)
3891  sleep((int)rest_val);
3892  *stop_flag=0;
3893  if(distributed && master_iozone)
3894  {
3896  cleanup_comm();
3897  }
3898 
3899  /**********************************************************/
3900  /* Re-write throughput performance test. ******************/
3901  /**********************************************************/
3902  walltime = 0.0;
3903  cputime = 0.0;
3904  jstarttime=0;
3905  total_kilos=0;
3906  toutputindex=1;
3907  strcpy(&toutput[1][0],throughput_tests[1]);
3908  if(noretest)
3909  {
3910  store_dvalue( (double)0);
3911  goto next0;
3912  }
3913  if((!distributed) || (distributed && master_iozone))
3914  start_monitor("Rewrite");
3915  /* Hooks to start the distributed Iozone client/server code */
3916  if(distributed)
3917  {
3918  use_thread=0; /* Turn of any Posix threads */
3919  if(master_iozone)
3921  else
3922  become_client();
3923  }
3924  if(!use_thread)
3925  {
3926  for(xx = 0; xx< num_child ; xx++){
3927  chid=xx;
3929  if(childids[xx]==-1){
3930  printf("\nFork failed\n");
3931  for(xy = 0; xy< xx ; xy++){
3932  Kill((long long)childids[xy],(long long)SIGTERM);
3933  }
3934  exit(28);
3935  }
3936  if(childids[xx] == 0){
3937 #ifdef _64BIT_ARCH_
3938  thread_rwrite_test((void *)xx);
3939 #else
3940  thread_rwrite_test((void *)((long)xx));
3941 #endif
3942  }
3943  }
3944  }
3945 #ifndef NO_THREADS
3946  else
3947  {
3948  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
3949  if(!barray[xx])
3950  {
3951  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
3952  if(barray[xx] == 0) {
3953  perror("Memory allocation failed:");
3954  exit(26);
3955  }
3956  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
3957  ~(cache_size-1));
3958  }
3959 #ifdef _64BIT_ARCH_
3961 #else
3962  childids[xx] = mythread_create( thread_rwrite_test,(void *)(long)xx);
3963 #endif
3964  if(childids[xx]==-1){
3965  printf("\nThread create failed\n");
3966  for(xy = 0; xy< xx ; xy++){
3967  Kill((long long)myid,(long long)SIGTERM);
3968  }
3969  exit(29);
3970  }
3971  }
3972  }
3973 #endif
3974  if((long long)myid == getpid())
3975  {
3976  if(distributed && master_iozone)
3977  {
3979  }
3980  for(i=0;i<num_child; i++){
3981  child_stat = (struct child_stats *)&shmaddr[i];
3982  /* wait for children to start */
3983  while(child_stat->flag==CHILD_STATE_HOLD)
3984  Poll((long long)1);
3985  }
3986  for(i=0;i<num_child; i++)
3987  {
3988  child_stat = (struct child_stats *)&shmaddr[i];
3989  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
3990  if(delay_start!=0)
3991  Poll((long long)delay_start);
3992  if(distributed && master_iozone)
3994  }
3995  starttime1 = time_so_far();
3996  goto jump3;
3997  }
3998 
3999 jump3:
4000  getout=0;
4001  if((long long)myid == getpid()){ /* Parent only here */
4002  for( i = 0; i < num_child; i++){
4003  child_stat=(struct child_stats *)&shmaddr[i];
4004  if(distributed && master_iozone)
4005  {
4006  printf("\n\tTest running:");
4007  wait_dist_join();
4008  break;
4009  }
4010  else
4011  {
4012  if(use_thread)
4013  {
4014  thread_join(childids[i],(void *)&pstatus);
4015  }
4016  else
4017  {
4018  wait(0);
4019  }
4020  }
4021  if(!jstarttime)
4022  jstarttime = time_so_far();
4023  }
4024  jtime = (time_so_far()-jstarttime)-time_res;
4025  if(jtime < (double).000001)
4026  {
4027  jtime=time_res;
4028  }
4029  }
4030  total_time = (time_so_far() - starttime1)-time_res; /* Parents total time */
4031  if(total_time < (double).000001)
4032  {
4034  if(rec_prob < reclen)
4035  rec_prob = reclen;
4036  res_prob=1;
4037  }
4038 #ifdef JTIME
4039  total_time=total_time-jtime;/* Remove the join time */
4040  if(!silent) printf("\nJoin time %10.2f\n",jtime);
4041 #endif
4042 
4043 
4044  total_kilos=0;
4045  ptotal=0;
4046 
4047  min_throughput=max_throughput=min_xfer=0;
4048  if(!silent) printf("\n");
4049  for(xyz=0;xyz<num_child;xyz++){
4050  child_stat=(struct child_stats *)&shmaddr[xyz];
4052  ptotal+=child_stat->actual;
4053  if(!min_xfer)
4054  min_xfer=child_stat->actual;
4055  if(child_stat->actual < min_xfer)
4056  min_xfer=child_stat->actual;
4057  if(!min_throughput)
4058  min_throughput=child_stat->throughput;
4059  if(child_stat->throughput < min_throughput)
4060  min_throughput=child_stat->throughput;
4061  if(child_stat->throughput > max_throughput)
4062  max_throughput=child_stat->throughput;
4064  /* Get the earliest start time and latest fini time to calc. elapsed time. */
4067  if (child_stat->walltime > walltime)
4069  }
4070  avg_throughput=total_kilos/num_child;
4071  if(cpuutilflag)
4072  {
4073 /*
4074  if (walltime < cputime_res)
4075  walltime = 0.0;
4076 */
4077  if (cputime < cputime_res)
4078  cputime = 0.0;
4079  }
4080 
4081  for(xyz=0;xyz<num_child;xyz++){ /* Reset state to 0 (HOLD) */
4082  child_stat=(struct child_stats *)&shmaddr[xyz];
4084  }
4085  if(cpuutilflag)
4086  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
4088 #ifdef NO_PRINT_LLD
4089  if(!silent) printf("\tChildren see throughput for %2ld rewriters \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
4090  if(!silent && !distributed) printf("\tParent sees throughput for %2ld rewriters \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
4091 #else
4092  if(!silent) printf("\tChildren see throughput for %2lld rewriters \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
4093  if(!silent && !distributed) printf("\tParent sees throughput for %2lld rewriters \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
4094 #endif
4095  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
4096  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
4097  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
4098  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
4099  /* CPU% can be > 100.0 for multiple CPUs */
4100  if(cpuutilflag)
4101  {
4102  if(walltime == 0.0)
4103  {
4104  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
4105  walltime, cputime, 0.0);
4106  }
4107  else
4108  {
4109  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
4110  walltime, cputime, 100.0 * cputime / walltime);
4111  }
4112  }
4113  if(Cflag)
4114  {
4115  for(xyz=0;xyz<num_child;xyz++)
4116  {
4117  child_stat = (struct child_stats *) &shmaddr[xyz];
4118  if(cpuutilflag)
4119  {
4120  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
4121  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
4123  }
4124  else
4125  {
4126  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
4127  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
4128  }
4129  }
4130  }
4131  *stop_flag=0;
4132  if((!distributed) || (distributed && master_iozone))
4133  stop_monitor("Rewrite");
4134  /**********************************************************/
4135  /*************** End of rewrite throughput ****************/
4136  /**********************************************************/
4137  sync();
4138  sleep(2);
4139  if(restf)
4140  sleep((int)rest_val);
4141  if(distributed && master_iozone)
4142  {
4144  cleanup_comm();
4145  }
4146 next0:
4147  if(include_tflag)
4148  if(!(include_mask & (long long)READER_MASK))
4149  goto next1;
4150  /**************************************************************/
4151  /*** Reader throughput tests **********************************/
4152  /**************************************************************/
4153  if((!distributed) || (distributed && master_iozone))
4154  start_monitor("Read");
4155  toutputindex++;
4156  strcpy(&toutput[toutputindex][0],throughput_tests[2]);
4157  walltime = 0.0;
4158  cputime = 0.0;
4159  jstarttime=0;
4160  total_kilos=0;
4161  if(distributed)
4162  {
4163  use_thread=0;
4164  if(master_iozone)
4166  else
4167  become_client();
4168  }
4169  if(!use_thread)
4170  {
4171  for(xx = 0; xx< num_child ; xx++){
4172  chid=xx;
4174  if(childids[xx]==-1){
4175  printf("\nFork failed\n");
4176  for(xy = 0; xy< xx ; xy++){
4177  Kill((long long)childids[xy],(long long)SIGTERM);
4178  }
4179  exit(30);
4180  }
4181  if(childids[xx]==0){
4182 #ifdef _64BIT_ARCH_
4183  thread_read_test((void *)xx);
4184 #else
4185  thread_read_test((void *)((long)xx));
4186 #endif
4187  }
4188  }
4189  }
4190 #ifndef NO_THREADS
4191  else
4192  {
4193  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
4194  if(!barray[xx])
4195  {
4196  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
4197  if(barray[xx] == 0) {
4198  perror("Memory allocation failed:");
4199  exit(26);
4200  }
4201  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
4202  ~(cache_size-1));
4203  }
4204 #ifdef _64BIT_ARCH_
4206 #else
4207  childids[xx] = mythread_create( thread_read_test,(void *)(long)xx);
4208 #endif
4209  if(childids[xx]==-1){
4210  printf("\nThread create failed\n");
4211  for(xy = 0; xy< xx ; xy++){
4212  kill((pid_t)myid,(int)SIGTERM);
4213  }
4214  exit(31);
4215  }
4216  }
4217  }
4218 #endif
4219  if(myid == (long long)getpid()){
4220  if(distributed && master_iozone)
4221  {
4223  }
4224  for(i=0;i<num_child; i++){ /* wait for children to start */
4225  child_stat=(struct child_stats *)&shmaddr[i];
4227  Poll((long long)1);
4228  }
4229  for(i=0;i<num_child; i++)
4230  {
4231  child_stat=(struct child_stats *)&shmaddr[i];
4232  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
4233  if(delay_start!=0)
4234  Poll((long long)delay_start);
4235  if(distributed && master_iozone)
4237  }
4238  starttime1 = time_so_far();
4239  goto jumpend4;
4240  }
4241 jumpend4:
4242  getout=0;
4243  if(myid == (long long)getpid()){ /* Parent here */
4244  for( i = 0; i < num_child; i++){
4245  child_stat = (struct child_stats *)&shmaddr[i];
4246  if(distributed && master_iozone)
4247  {
4248  printf("\n\tTest running:");
4249  wait_dist_join();
4250  break;
4251  }
4252  else
4253  {
4254  if(use_thread)
4255  {
4256  thread_join(childids[i],(void *)&pstatus);
4257  }
4258  else
4259  {
4260  wait(0);
4261  }
4262  }
4263  if(!jstarttime)
4264  jstarttime = time_so_far();
4265  }
4266  jtime = (time_so_far()-jstarttime)-time_res;
4267  if(jtime < (double).000001)
4268  {
4269  jtime=time_res;
4270  }
4271  }
4272  total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
4273  if(total_time < (double).000001)
4274  {
4276  if(rec_prob < reclen)
4277  rec_prob = reclen;
4278  res_prob=1;
4279  }
4280 #ifdef JTIME
4281  total_time=total_time-jtime;/* Remove the join time */
4282  if(!silent) printf("\nJoin time %10.2f\n",jtime);
4283 #endif
4284 
4285  total_kilos=0;
4286  ptotal=0;
4287  min_throughput=max_throughput=min_xfer=0;
4288  if(!silent) printf("\n");
4289  for(xyz=0;xyz<num_child;xyz++){
4290  child_stat=(struct child_stats *)&shmaddr[xyz];
4292  ptotal+=child_stat->actual;
4293  if(!min_xfer)
4294  min_xfer=child_stat->actual;
4295  if(child_stat->actual < min_xfer)
4296  min_xfer=child_stat->actual;
4297  if(!min_throughput)
4298  min_throughput=child_stat->throughput;
4299  if(child_stat->throughput < min_throughput)
4300  min_throughput=child_stat->throughput;
4301  if(child_stat->throughput > max_throughput)
4302  max_throughput=child_stat->throughput;
4304  /* Get the earliest start time and latest fini time to calc. elapsed time. */
4307  if (child_stat->walltime > walltime)
4309  }
4310  avg_throughput=total_kilos/num_child;
4311  if(cpuutilflag)
4312  {
4313  if (cputime < cputime_res)
4314  cputime = 0.0;
4315  }
4316  if(cpuutilflag)
4317  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
4319 #ifdef NO_PRINT_LLD
4320  if(!silent) printf("\tChildren see throughput for %2ld readers \t\t= %10.2f %s/sec\n", num_child, total_kilos,unit);
4321  if(!silent && !distributed) printf("\tParent sees throughput for %2ld readers \t\t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
4322 #else
4323  if(!silent) printf("\tChildren see throughput for %2lld readers \t\t= %10.2f %s/sec\n", num_child, total_kilos,unit);
4324  if(!silent && !distributed) printf("\tParent sees throughput for %2lld readers \t\t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
4325 #endif
4326  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
4327  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
4328  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
4329  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
4330  /* CPU% can be > 100.0 for multiple CPUs */
4331  if(cpuutilflag)
4332  {
4333  if(walltime == 0.0)
4334  {
4335  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
4336  walltime, cputime, 0.0);
4337  }
4338  else
4339  {
4340  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
4341  walltime, cputime, 100.0 * cputime / walltime);
4342  }
4343  }
4344  if(Cflag)
4345  {
4346  for(xyz=0;xyz<num_child;xyz++)
4347  {
4348  child_stat = (struct child_stats *) &shmaddr[xyz];
4349  if(cpuutilflag)
4350  {
4351  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
4352  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
4354  }
4355  else
4356  {
4357  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
4358  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
4359  }
4360  }
4361  }
4362  if((!distributed) || (distributed && master_iozone))
4363  stop_monitor("Read");
4364  /**********************************************************/
4365  /*************** End of readers throughput ****************/
4366  /**********************************************************/
4367  sync();
4368  sleep(2);
4369  if(restf)
4370  sleep((int)rest_val);
4371  if(distributed && master_iozone)
4372  {
4374  cleanup_comm();
4375  }
4376 
4377  /**************************************************************/
4378  /*** ReReader throughput tests **********************************/
4379  /**************************************************************/
4380  toutputindex++;
4381  strcpy(&toutput[toutputindex][0],throughput_tests[3]);
4382  if(noretest)
4383  {
4384  store_dvalue( (double)0);
4385  goto next1;
4386  }
4387  if((!distributed) || (distributed && master_iozone))
4388  start_monitor("Reread");
4389  walltime = 0.0;
4390  cputime = 0.0;
4391  jstarttime=0;
4392  *stop_flag=0;
4393  total_kilos=0;
4394  /* Hooks to start the distributed Iozone client/server code */
4395  if(distributed)
4396  {
4397  use_thread=0; /* Turn of any Posix threads */
4398  if(master_iozone)
4400  else
4401  become_client();
4402  }
4403  if(!use_thread)
4404  {
4405  for(xx = 0; xx< num_child ; xx++){
4406  chid=xx;
4408  if(childids[xx]==-1){
4409  printf("\nFork failed\n");
4410  for(xy = 0; xy< xx ; xy++){
4411  Kill((long long)childids[xy],(long long)SIGTERM);
4412  }
4413  exit(32);
4414  }
4415  if(childids[xx]==0){
4416 #ifdef _64BIT_ARCH_
4417  thread_rread_test((void *)xx);
4418 #else
4419  thread_rread_test((void *)((long)xx));
4420 #endif
4421  }
4422  }
4423  }
4424 #ifndef NO_THREADS
4425  else
4426  {
4427  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
4428  chid=xx;
4429  if(!barray[xx])
4430  {
4431  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
4432  if(barray[xx] == 0) {
4433  perror("Memory allocation failed:");
4434  exit(26);
4435  }
4436  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
4437  ~(cache_size-1));
4438  }
4439 #ifdef _64BIT_ARCH_
4441 #else
4442  childids[xx] = mythread_create( thread_rread_test,(void *)(long)xx);
4443 #endif
4444  if(childids[xx]==-1){
4445  printf("\nThread create failed\n");
4446  for(xy = 0; xy< xx ; xy++){
4447  kill((pid_t)myid,(int)SIGTERM);
4448  }
4449  exit(33);
4450  }
4451  }
4452  }
4453 #endif
4454  if(myid == (long long)getpid()){
4455  if(distributed && master_iozone)
4456  {
4458  }
4459  for(i=0;i<num_child; i++){ /* wait for children to start */
4460  child_stat = (struct child_stats *)&shmaddr[i];
4462  Poll((long long)1);
4463  }
4464  for(i=0;i<num_child; i++){
4465  child_stat = (struct child_stats *)&shmaddr[i];
4466  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
4467  if(delay_start!=0)
4468  Poll((long long)delay_start);
4469  if(distributed && master_iozone)
4471  }
4472  starttime1 = time_so_far();
4473  goto jumpend2;
4474  }
4475 
4476 jumpend2:
4477  getout=0;
4478  if(myid == (long long)getpid()){ /* Parent here */
4479  for( i = 0; i < num_child; i++){ /* wait for children to stop */
4480  child_stat = (struct child_stats *)&shmaddr[i];
4481  if(distributed && master_iozone)
4482  {
4483  printf("\n\tTest running:");
4484  wait_dist_join();
4485  break;
4486  }
4487  else
4488  {
4489  if(use_thread)
4490  {
4491  thread_join(childids[i],(void *)&pstatus);
4492  }
4493  else
4494  {
4495  wait(0);
4496  }
4497  }
4498  if(!jstarttime)
4499  jstarttime = time_so_far();
4500  }
4501  jtime = (time_so_far()-jstarttime)-time_res;
4502  if(jtime < (double).000001)
4503  {
4504  jtime=time_res;
4505  }
4506  }
4507  total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
4508  if(total_time < (double).000001)
4509  {
4511  if(rec_prob < reclen)
4512  rec_prob = reclen;
4513  res_prob=1;
4514  }
4515 #ifdef JTIME
4516  total_time=total_time-jtime;/* Remove the join time */
4517  if(!silent) printf("\nJoin time %10.2f\n",jtime);
4518 #endif
4519  min_throughput=max_throughput=min_xfer=0;
4520  total_kilos=0;
4521  ptotal=0;
4522  if(!silent) printf("\n");
4523  for(xyz=0;xyz<num_child;xyz++){
4524  child_stat = (struct child_stats *)&shmaddr[xyz];
4526  ptotal+=child_stat->actual;
4527  if(!min_xfer)
4528  min_xfer=child_stat->actual;
4529  if(child_stat->actual < min_xfer)
4530  min_xfer=child_stat->actual;
4531  if(!min_throughput)
4532  min_throughput=child_stat->throughput;
4533  if(child_stat->throughput < min_throughput)
4534  min_throughput=child_stat->throughput;
4535  if(child_stat->throughput > max_throughput)
4536  max_throughput=child_stat->throughput;
4538  /* Get the earliest start time and latest fini time to calc. elapsed time. */
4541  if (child_stat->walltime > walltime)
4543  }
4544  avg_throughput=total_kilos/num_child;
4545  if(cpuutilflag)
4546  {
4547 /*
4548  if (walltime < cputime_res)
4549  walltime = 0.0;
4550 */
4551  if (cputime < cputime_res)
4552  cputime = 0.0;
4553  }
4554  if(cpuutilflag)
4555  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
4557 #ifdef NO_PRINT_LLD
4558  if(!silent) printf("\tChildren see throughput for %ld re-readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
4559  if(!silent && !distributed) printf("\tParent sees throughput for %ld re-readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
4560 #else
4561  if(!silent) printf("\tChildren see throughput for %lld re-readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
4562  if(!silent && !distributed) printf("\tParent sees throughput for %lld re-readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
4563 #endif
4564  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
4565  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
4566  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
4567  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
4568  /* CPU% can be > 100.0 for multiple CPUs */
4569  if(cpuutilflag)
4570  {
4571  if(walltime == 0.0)
4572  {
4573  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
4574  walltime, cputime, 0.0);
4575  }
4576  else
4577  {
4578  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
4579  walltime, cputime, 100.0 * cputime / walltime);
4580  }
4581  }
4582  if(Cflag)
4583  {
4584  for(xyz=0;xyz<num_child;xyz++)
4585  {
4586  child_stat = (struct child_stats *) &shmaddr[xyz];
4587  if(cpuutilflag)
4588  {
4589  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
4590  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
4592  }
4593  else
4594  {
4595  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
4596  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
4597  }
4598  }
4599  }
4600  if((!distributed) || (distributed && master_iozone))
4601  stop_monitor("Reread");
4602  /**********************************************************/
4603  /*************** End of re-readers throughput ****************/
4604  /**********************************************************/
4605  sync();
4606  sleep(2);
4607  if(restf)
4608  sleep((int)rest_val);
4609  if(distributed && master_iozone)
4610  {
4612  cleanup_comm();
4613  }
4614 
4615 next1:
4616  if(include_tflag)
4617  if(!(include_mask & (long long)REVERSE_MASK))
4618  goto next2;
4619  sync();
4620  sleep(2);
4621 
4622  /**************************************************************/
4623  /*** Reverse reader throughput tests **************************/
4624  /**************************************************************/
4625  toutputindex++;
4626  strcpy(&toutput[toutputindex][0],throughput_tests[4]);
4627  if((!distributed) || (distributed && master_iozone))
4628  start_monitor("Revread");
4629  walltime = 0.0;
4630  cputime = 0.0;
4631  jstarttime=0;
4632  *stop_flag=0;
4633  total_kilos=0;
4634  /* Hooks to start the distributed Iozone client/server code */
4635  if(distributed)
4636  {
4637  use_thread=0; /* Turn of any Posix threads */
4638  if(master_iozone)
4640  else
4641  become_client();
4642  }
4643  if(!use_thread)
4644  {
4645  for(xx = 0; xx< num_child ; xx++){
4646  chid=xx;
4648  if(childids[xx]==-1){
4649  printf("\nFork failed\n");
4650  for(xy = 0; xy< xx ; xy++){
4651  Kill((long long)childids[xy],(long long)SIGTERM);
4652  }
4653  exit(34);
4654  }
4655  if(childids[xx]==0){
4656 #ifdef _64BIT_ARCH_
4657  thread_reverse_read_test((void *)xx);
4658 #else
4659  thread_reverse_read_test((void *)((long)xx));
4660 #endif
4661  }
4662  }
4663  }
4664 #ifndef NO_THREADS
4665  else
4666  {
4667  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
4668  chid=xx;
4669  if(!barray[xx])
4670  {
4671  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
4672  if(barray[xx] == 0) {
4673  perror("Memory allocation failed:");
4674  exit(26);
4675  }
4676  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
4677  ~(cache_size-1));
4678  }
4679 #ifdef _64BIT_ARCH_
4681 #else
4682  childids[xx] = mythread_create( thread_reverse_read_test,(void *)(long)xx);
4683 #endif
4684  if(childids[xx]==-1){
4685  printf("\nThread create failed\n");
4686  for(xy = 0; xy< xx ; xy++){
4687  kill((pid_t)myid,(int)SIGTERM);
4688  }
4689  exit(35);
4690  }
4691  }
4692  }
4693 #endif
4694  if(myid == (long long)getpid()){
4695  if(distributed && master_iozone)
4696  {
4698  }
4699  for(i=0;i<num_child; i++){ /* wait for children to start */
4700  child_stat = (struct child_stats *)&shmaddr[i];
4702  Poll((long long)1);
4703  }
4704  for(i=0;i<num_child; i++){
4705  child_stat = (struct child_stats *)&shmaddr[i];
4706  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
4707  if(delay_start!=0)
4708  Poll((long long)delay_start);
4709  if(distributed && master_iozone)
4711  }
4712  starttime1 = time_so_far();
4713  }
4714 
4715  getout=0;
4716  if(myid == (long long)getpid()){ /* Parent here */
4717  for( i = 0; i < num_child; i++){ /* wait for children to stop */
4718  child_stat = (struct child_stats *)&shmaddr[i];
4719  if(distributed && master_iozone)
4720  {
4721  printf("\n\tTest running:");
4722  wait_dist_join();
4723  break;
4724  }
4725  else
4726  {
4727  if(use_thread)
4728  {
4729  thread_join(childids[i],(void *)&pstatus);
4730  }
4731  else
4732  {
4733  wait(0);
4734  }
4735  }
4736  if(!jstarttime)
4737  jstarttime = time_so_far();
4738  }
4739  jtime = (time_so_far()-jstarttime)-time_res;
4740  if(jtime < (double).000001)
4741  {
4742  jtime=time_res;
4743  }
4744  }
4745  total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
4746  if(total_time < (double).000001)
4747  {
4749  if(rec_prob < reclen)
4750  rec_prob = reclen;
4751  res_prob=1;
4752  }
4753 #ifdef JTIME
4754  total_time=total_time-jtime;/* Remove the join time */
4755  if(!silent) printf("\nJoin time %10.2f\n",jtime);
4756 #endif
4757  total_kilos=0;
4758  ptotal=0;
4759  min_throughput=max_throughput=min_xfer=0;
4760  if(!silent) printf("\n");
4761  for(xyz=0;xyz<num_child;xyz++){
4762  child_stat = (struct child_stats *)&shmaddr[xyz];
4764  ptotal+=child_stat->actual;
4765  if(!min_xfer)
4766  min_xfer=child_stat->actual;
4767  if(child_stat->actual < min_xfer)
4768  min_xfer=child_stat->actual;
4769  if(!min_throughput)
4770  min_throughput=child_stat->throughput;
4771  if(child_stat->throughput < min_throughput)
4772  min_throughput=child_stat->throughput;
4773  if(child_stat->throughput > max_throughput)
4774  max_throughput=child_stat->throughput;
4775  /* walltime += child_stat->walltime; */
4777  /* Get the earliest start time and latest fini time to calc. elapsed time. */
4780  if (child_stat->walltime > walltime)
4782  }
4783  avg_throughput=total_kilos/num_child;
4784  if(cpuutilflag)
4785  {
4786 /*
4787  if (walltime < cputime_res)
4788  walltime = 0.0;
4789 */
4790  if (cputime < cputime_res)
4791  cputime = 0.0;
4792  }
4793  if(cpuutilflag)
4794  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
4796 #ifdef NO_PRINT_LLD
4797  if(!silent) printf("\tChildren see throughput for %ld reverse readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
4798  if(!silent && !distributed) printf("\tParent sees throughput for %ld reverse readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
4799 #else
4800  if(!silent) printf("\tChildren see throughput for %lld reverse readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
4801  if(!silent && !distributed) printf("\tParent sees throughput for %lld reverse readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
4802 #endif
4803  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
4804  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
4805  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
4806  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
4807  /* CPU% can be > 100.0 for multiple CPUs */
4808  if(cpuutilflag)
4809  {
4810  if(walltime == 0.0)
4811  {
4812  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
4813  walltime, cputime, 0.0);
4814  }
4815  else
4816  {
4817  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
4818  walltime, cputime, 100.0 * cputime / walltime);
4819  }
4820  }
4821  if(Cflag)
4822  {
4823  for(xyz=0;xyz<num_child;xyz++)
4824  {
4825  child_stat = (struct child_stats *) &shmaddr[xyz];
4826  if(cpuutilflag)
4827  {
4828  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
4829  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
4831  }
4832  else
4833  {
4834  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
4835  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
4836  }
4837  }
4838  }
4839  if((!distributed) || (distributed && master_iozone))
4840  stop_monitor("Revread");
4841  sync();
4842  sleep(2);
4843  if(restf)
4844  sleep((int)rest_val);
4845  if(distributed && master_iozone)
4846  {
4848  cleanup_comm();
4849  }
4850 next2:
4851  if(include_tflag)
4852  if(!(include_mask & (long long)STRIDE_READ_MASK))
4853  goto next3;
4854  /**************************************************************/
4855  /*** stride reader throughput tests **************************/
4856  /**************************************************************/
4857  toutputindex++;
4858  strcpy(&toutput[toutputindex][0],throughput_tests[5]);
4859  if((!distributed) || (distributed && master_iozone))
4860  start_monitor("Strideread");
4861  walltime = 0.0;
4862  cputime = 0.0;
4863  jstarttime=0;
4864  sync();
4865  sleep(2);
4866  *stop_flag=0;
4867  total_kilos=0;
4868  /* Hooks to start the distributed Iozone client/server code */
4869  if(distributed)
4870  {
4871  use_thread=0; /* Turn of any Posix threads */
4872  if(master_iozone)
4874  else
4875  become_client();
4876  }
4877  if(!use_thread)
4878  {
4879  for(xx = 0; xx< num_child ; xx++){
4880  chid=xx;
4882  if(childids[xx]==-1){
4883  printf("\nFork failed\n");
4884  for(xy = 0; xy< xx ; xy++){
4885  Kill((long long)childids[xy],(long long)SIGTERM);
4886  }
4887  exit(36);
4888  }
4889  if(childids[xx]==0){
4890 #ifdef _64BIT_ARCH_
4891  thread_stride_read_test((void *)xx);
4892 #else
4893  thread_stride_read_test((void *)((long)xx));
4894 #endif
4895  }
4896  }
4897  }
4898 #ifndef NO_THREADS
4899  else
4900  {
4901  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
4902  chid=xx;
4903  if(!barray[xx])
4904  {
4905  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
4906  if(barray[xx] == 0) {
4907  perror("Memory allocation failed:");
4908  exit(26);
4909  }
4910  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
4911  ~(cache_size-1));
4912  }
4913 #ifdef _64BIT_ARCH_
4915 #else
4916  childids[xx] = mythread_create( thread_stride_read_test,(void *)(long)xx);
4917 #endif
4918  if(childids[xx]==-1){
4919  printf("\nThread create failed\n");
4920  for(xy = 0; xy< xx ; xy++){
4921  kill((pid_t)myid,(int)SIGTERM);
4922  }
4923  exit(37);
4924  }
4925  }
4926  }
4927 #endif
4928  if(myid == (long long)getpid()){
4929  if(distributed && master_iozone)
4930  {
4932  }
4933  for(i=0;i<num_child; i++){ /* wait for children to start */
4934  child_stat = (struct child_stats *)&shmaddr[i];
4936  Poll((long long)1);
4937  }
4938  for(i=0;i<num_child; i++){
4939  child_stat = (struct child_stats *)&shmaddr[i];
4940  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
4941  if(delay_start!=0)
4942  Poll((long long)delay_start);
4943  if(distributed && master_iozone)
4945  }
4946  starttime1 = time_so_far();
4947  }
4948 
4949  getout=0;
4950  if(myid == (long long)getpid()){ /* Parent here */
4951  for( i = 0; i < num_child; i++){ /* wait for children to stop */
4952  child_stat = (struct child_stats *)&shmaddr[i];
4953  if(distributed && master_iozone)
4954  {
4955  printf("\n\tTest running:");
4956  wait_dist_join();
4957  break;
4958  }
4959  else
4960  {
4961  if(use_thread)
4962  {
4963  thread_join(childids[i],(void *)&pstatus);
4964  }
4965  else
4966  {
4967  wait(0);
4968  }
4969  }
4970  if(!jstarttime)
4971  jstarttime = time_so_far();
4972  }
4973  jtime = (time_so_far()-jstarttime)-time_res;
4974  if(jtime < (double).000001)
4975  {
4976  jtime=time_res;
4977  }
4978  }
4979  total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
4980  if(total_time < (double).000001)
4981  {
4983  if(rec_prob < reclen)
4984  rec_prob = reclen;
4985  res_prob=1;
4986  }
4987 #ifdef JTIME
4988  total_time=total_time-jtime;/* Remove the join time */
4989  if(!silent) printf("\nJoin time %10.2f\n",jtime);
4990 #endif
4991  total_kilos=0;
4992  ptotal=0;
4993  min_throughput=max_throughput=min_xfer=0;
4994  if(!silent) printf("\n");
4995  for(xyz=0;xyz<num_child;xyz++){
4996  child_stat = (struct child_stats *)&shmaddr[xyz];
4998  ptotal+=child_stat->actual;
4999  if(!min_xfer)
5000  min_xfer=child_stat->actual;
5001  if(child_stat->actual < min_xfer)
5002  min_xfer=child_stat->actual;
5003  if(!min_throughput)
5004  min_throughput=child_stat->throughput;
5005  if(child_stat->throughput < min_throughput)
5006  min_throughput=child_stat->throughput;
5007  if(child_stat->throughput > max_throughput)
5008  max_throughput=child_stat->throughput;
5009  /* walltime += child_stat->walltime; */
5011  /* Get the biggest walltime */
5014  if (child_stat->walltime > walltime)
5016  }
5017  avg_throughput=total_kilos/num_child;
5018  if(cpuutilflag)
5019  {
5020 /*
5021  if (walltime < cputime_res)
5022  walltime = 0.0;
5023 */
5024  if (cputime < cputime_res)
5025  cputime = 0.0;
5026  }
5027  if(cpuutilflag)
5028  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
5030 #ifdef NO_PRINT_LLD
5031  if(!silent) printf("\tChildren see throughput for %ld stride readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
5032  if(!silent && !distributed) printf("\tParent sees throughput for %ld stride readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
5033 #else
5034  if(!silent) printf("\tChildren see throughput for %lld stride readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
5035  if(!silent && !distributed) printf("\tParent sees throughput for %lld stride readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
5036 #endif
5037  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
5038  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
5039  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
5040  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
5041  /* CPU% can be > 100.0 for multiple CPUs */
5042  if(cpuutilflag)
5043  {
5044  if(walltime == 0.0)
5045  {
5046  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
5047  walltime, cputime, 0.0);
5048  }
5049  else
5050  {
5051  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
5052  walltime, cputime, 100.0 * cputime / walltime);
5053  }
5054  }
5055  if(Cflag)
5056  {
5057  for(xyz=0;xyz<num_child;xyz++)
5058  {
5059  child_stat = (struct child_stats *) &shmaddr[xyz];
5060  if(cpuutilflag)
5061  {
5062  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
5063  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
5065  }
5066  else
5067  {
5068  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
5069  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
5070  }
5071  }
5072  }
5073  if((!distributed) || (distributed && master_iozone))
5074  stop_monitor("Strideread");
5075  sync();
5076  sleep(2);
5077  if(restf)
5078  sleep((int)rest_val);
5079  if(distributed && master_iozone)
5080  {
5082  cleanup_comm();
5083  }
5084  /**************************************************************/
5085  /*** random reader throughput tests ***************************/
5086  /**************************************************************/
5087 next3:
5088  if(include_tflag)
5089  if(!(include_mask & (long long)RANDOM_RW_MASK))
5090  goto next4;
5091 
5092  toutputindex++;
5093  strcpy(&toutput[toutputindex][0],throughput_tests[6]);
5094  if((!distributed) || (distributed && master_iozone))
5095  start_monitor("Randread");
5096  walltime = 0.0;
5097  cputime = 0.0;
5098  jstarttime=0;
5099  sync();
5100  sleep(2);
5101  *stop_flag=0;
5102  total_kilos=0;
5103  /* Hooks to start the distributed Iozone client/server code */
5104  if(distributed)
5105  {
5106  use_thread=0; /* Turn of any Posix threads */
5107  if(master_iozone)
5109  else
5110  become_client();
5111  }
5112  if(!use_thread)
5113  {
5114  for(xx = 0; xx< num_child ; xx++){
5115  chid=xx;
5117  if(childids[xx]==-1){
5118  printf("\nFork failed\n");
5119  for(xy = 0; xy< xx ; xy++){
5120  Kill((long long)childids[xy],(long long)SIGTERM);
5121  }
5122  exit(38);
5123  }
5124  if(childids[xx]==0){
5125 #ifdef _64BIT_ARCH_
5126  thread_ranread_test((void *)xx);
5127 #else
5128  thread_ranread_test((void *)((long)xx));
5129 #endif
5130  }
5131  }
5132  }
5133 #ifndef NO_THREADS
5134  else
5135  {
5136  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
5137  chid=xx;
5138  if(!barray[xx])
5139  {
5140  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
5141  if(barray[xx] == 0) {
5142  perror("Memory allocation failed:");
5143  exit(26);
5144  }
5145  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
5146  ~(cache_size-1));
5147  }
5148 #ifdef _64BIT_ARCH_
5150 #else
5151  childids[xx] = mythread_create( thread_ranread_test,(void *)(long)xx);
5152 #endif
5153  if(childids[xx]==-1){
5154  printf("\nThread create failed\n");
5155  for(xy = 0; xy< xx ; xy++){
5156  kill((pid_t)myid,(int)SIGTERM);
5157  }
5158  exit(39);
5159  }
5160  }
5161  }
5162 #endif
5163  if(myid == (long long)getpid()){
5164  if(distributed && master_iozone)
5165  {
5167  }
5168  for(i=0;i<num_child; i++){ /* wait for children to start */
5169  child_stat = (struct child_stats *)&shmaddr[i];
5171  Poll((long long)1);
5172  }
5173  for(i=0;i<num_child; i++){
5174  child_stat = (struct child_stats *)&shmaddr[i];
5175  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
5176  if(delay_start!=0)
5177  Poll((long long)delay_start);
5178  if(distributed && master_iozone)
5180  }
5181  starttime1 = time_so_far();
5182  }
5183 
5184  getout=0;
5185  if(myid == (long long)getpid()){ /* Parent here */
5186  for( i = 0; i < num_child; i++){ /* wait for children to stop */
5187  child_stat = (struct child_stats *)&shmaddr[i];
5188  if(distributed && master_iozone)
5189  {
5190  printf("\n\tTest running:");
5191  wait_dist_join();
5192  break;
5193  }
5194  else
5195  {
5196  if(use_thread)
5197  {
5198  thread_join(childids[i],(void *)&pstatus);
5199  }
5200  else
5201  {
5202  wait(0);
5203  }
5204  }
5205  if(!jstarttime)
5206  jstarttime = time_so_far();
5207  }
5208  jtime = (time_so_far()-jstarttime)-time_res;
5209  if(jtime < (double).000001)
5210  {
5211  jtime=time_res;
5212  }
5213  }
5214  total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
5215  if(total_time < (double).000001)
5216  {
5218  if(rec_prob < reclen)
5219  rec_prob = reclen;
5220  res_prob=1;
5221  }
5222 #ifdef JTIME
5223  total_time=total_time-jtime;/* Remove the join time */
5224  if(!silent) printf("\nJoin time %10.2f\n",jtime);
5225 #endif
5226  total_kilos=0;
5227  ptotal=0;
5228  min_throughput=max_throughput=min_xfer=0;
5229  if(!silent) printf("\n");
5230  for(xyz=0;xyz<num_child;xyz++){
5231  child_stat = (struct child_stats *)&shmaddr[xyz];
5233  ptotal+=child_stat->actual;
5234  if(!min_xfer)
5235  min_xfer=child_stat->actual;
5236  if(child_stat->actual < min_xfer)
5237  min_xfer=child_stat->actual;
5238  if(!min_throughput)
5239  min_throughput=child_stat->throughput;
5240  if(child_stat->throughput < min_throughput)
5241  min_throughput=child_stat->throughput;
5242  if(child_stat->throughput > max_throughput)
5243  max_throughput=child_stat->throughput;
5245  /* Get the biggest walltime */
5248  if (child_stat->walltime > walltime)
5250  }
5251  avg_throughput=total_kilos/num_child;
5252  if(cpuutilflag)
5253  {
5254  if (cputime < cputime_res)
5255  cputime = 0.0;
5256  }
5257  if(cpuutilflag)
5258  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
5260 #ifdef NO_PRINT_LLD
5261  if(!silent) printf("\tChildren see throughput for %ld random readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
5262  if(!silent && !distributed) printf("\tParent sees throughput for %ld random readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
5263 #else
5264  if(!silent) printf("\tChildren see throughput for %lld random readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
5265  if(!silent && !distributed) printf("\tParent sees throughput for %lld random readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
5266 #endif
5267  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
5268  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
5269  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
5270  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
5271  /* CPU% can be > 100.0 for multiple CPUs */
5272  if(cpuutilflag)
5273  {
5274  if(walltime == 0.0)
5275  {
5276  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
5277  walltime, cputime, 0.0);
5278  }
5279  else
5280  {
5281  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
5282  walltime, cputime, 100.0 * cputime / walltime);
5283  }
5284  }
5285  if(Cflag)
5286  {
5287  for(xyz=0;xyz<num_child;xyz++)
5288  {
5289  child_stat = (struct child_stats *) &shmaddr[xyz];
5290  if(cpuutilflag)
5291  {
5292  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
5293  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
5295  }
5296  else
5297  {
5298  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
5299  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
5300  }
5301  }
5302  }
5303  if((!distributed) || (distributed && master_iozone))
5304  stop_monitor("Randread");
5305  sync();
5306  sleep(2);
5307  if(restf)
5308  sleep((int)rest_val);
5309  if(distributed && master_iozone)
5310  {
5312  cleanup_comm();
5313  }
5314  /**************************************************************/
5315  /*** mixed workload throughput tests ***************************/
5316  /**************************************************************/
5317 next4:
5318  if(include_tflag)
5319  if(!(include_mask & (long long)RANDOM_MIX_MASK))
5320  goto next5;
5321 
5322  toutputindex++;
5323  strcpy(&toutput[toutputindex][0],throughput_tests[7]);
5324  if((!distributed) || (distributed && master_iozone))
5325  start_monitor("Mixed");
5326  walltime = 0.0;
5327  cputime = 0.0;
5328  jstarttime=0;
5329  sync();
5330  sleep(2);
5331  *stop_flag=0;
5332  total_kilos=0;
5333  /* Hooks to start the distributed Iozone client/server code */
5334  if(distributed)
5335  {
5336  use_thread=0; /* Turn of any Posix threads */
5337  if(master_iozone)
5339  else
5340  become_client();
5341  }
5342  if(!use_thread)
5343  {
5344  for(xx = 0; xx< num_child ; xx++){
5345  chid=xx;
5347  if(childids[xx]==-1){
5348  printf("\nFork failed\n");
5349  for(xy = 0; xy< xx ; xy++){
5350  Kill((long long)childids[xy],(long long)SIGTERM);
5351  }
5352  exit(38);
5353  }
5354  if(childids[xx]==0){
5355 #ifdef _64BIT_ARCH_
5356  thread_mix_test((void *)xx);
5357 #else
5358  thread_mix_test((void *)((long)xx));
5359 #endif
5360  }
5361  }
5362  }
5363 #ifndef NO_THREADS
5364  else
5365  {
5366  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
5367  chid=xx;
5368  if(!barray[xx])
5369  {
5370  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
5371  if(barray[xx] == 0) {
5372  perror("Memory allocation failed:");
5373  exit(26);
5374  }
5375  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
5376  ~(cache_size-1));
5377  }
5378 #ifdef _64BIT_ARCH_
5380 #else
5381  childids[xx] = mythread_create( thread_mix_test,(void *)(long)xx);
5382 #endif
5383  if(childids[xx]==-1){
5384  printf("\nThread create failed\n");
5385  for(xy = 0; xy< xx ; xy++){
5386  kill((pid_t)myid,(int)SIGTERM);
5387  }
5388  exit(39);
5389  }
5390  }
5391  }
5392 #endif
5393  if(myid == (long long)getpid()){
5394  if(distributed && master_iozone)
5395  {
5397  }
5398  for(i=0;i<num_child; i++){ /* wait for children to start */
5399  child_stat = (struct child_stats *)&shmaddr[i];
5401  Poll((long long)1);
5402  }
5403  for(i=0;i<num_child; i++){
5404  child_stat = (struct child_stats *)&shmaddr[i];
5405  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
5406  if(delay_start!=0)
5407  Poll((long long)delay_start);
5408  if(distributed && master_iozone)
5410  }
5411  starttime1 = time_so_far();
5412  }
5413 
5414  getout=0;
5415  if(myid == (long long)getpid()){ /* Parent here */
5416  for( i = 0; i < num_child; i++){ /* wait for children to stop */
5417  child_stat = (struct child_stats *)&shmaddr[i];
5418  if(distributed && master_iozone)
5419  {
5420  printf("\n\tTest running:");
5421  wait_dist_join();
5422  break;
5423  }
5424  else
5425  {
5426  if(use_thread)
5427  {
5428  thread_join(childids[i],(void *)&pstatus);
5429  }
5430  else
5431  {
5432  wait(0);
5433  }
5434  }
5435  if(!jstarttime)
5436  jstarttime = time_so_far();
5437  }
5438  jtime = (time_so_far()-jstarttime)-time_res;
5439  if(jtime < (double).000001)
5440  {
5441  jtime=time_res;
5442  }
5443  }
5444  total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
5445  if(total_time < (double).000001)
5446  {
5448  if(rec_prob < reclen)
5449  rec_prob = reclen;
5450  res_prob=1;
5451  }
5452 #ifdef JTIME
5453  total_time=total_time-jtime;/* Remove the join time */
5454  if(!silent) printf("\nJoin time %10.2f\n",jtime);
5455 #endif
5456  total_kilos=0;
5457  ptotal=0;
5458  min_throughput=max_throughput=min_xfer=0;
5459  if(!silent) printf("\n");
5460  for(xyz=0;xyz<num_child;xyz++){
5461  child_stat = (struct child_stats *)&shmaddr[xyz];
5463  ptotal+=child_stat->actual;
5464  if(!min_xfer)
5465  min_xfer=child_stat->actual;
5466  if(child_stat->actual < min_xfer)
5467  min_xfer=child_stat->actual;
5468  if(!min_throughput)
5469  min_throughput=child_stat->throughput;
5470  if(child_stat->throughput < min_throughput)
5471  min_throughput=child_stat->throughput;
5472  if(child_stat->throughput > max_throughput)
5473  max_throughput=child_stat->throughput;
5475  /* Get the biggest walltime */
5478  if (child_stat->walltime > walltime)
5480  }
5481  avg_throughput=total_kilos/num_child;
5482  if(cpuutilflag)
5483  {
5484  if (cputime < cputime_res)
5485  cputime = 0.0;
5486  }
5487  if(cpuutilflag)
5488  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
5490 #ifdef NO_PRINT_LLD
5491  if(!silent) printf("\tChildren see throughput for %ld mixed workload \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
5492  if(!silent && !distributed) printf("\tParent sees throughput for %ld mixed workload \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
5493 #else
5494  if(!silent) printf("\tChildren see throughput for %lld mixed workload \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
5495  if(!silent && !distributed) printf("\tParent sees throughput for %lld mixed workload \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
5496 #endif
5497  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
5498  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
5499  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
5500  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
5501  /* CPU% can be > 100.0 for multiple CPUs */
5502  if(cpuutilflag)
5503  {
5504  if(walltime == 0.0)
5505  {
5506  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
5507  walltime, cputime, 0.0);
5508  }
5509  else
5510  {
5511  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
5512  walltime, cputime, 100.0 * cputime / walltime);
5513  }
5514  }
5515  if(Cflag)
5516  {
5517  for(xyz=0;xyz<num_child;xyz++)
5518  {
5519  child_stat = (struct child_stats *) &shmaddr[xyz];
5520  if(cpuutilflag)
5521  {
5522  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
5523  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
5525  }
5526  else
5527  {
5528  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
5529  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
5530  }
5531  }
5532  }
5533  if((!distributed) || (distributed && master_iozone))
5534  stop_monitor("Mixed");
5535  sync();
5536  sleep(2);
5537  if(restf)
5538  sleep((int)rest_val);
5539  if(distributed && master_iozone)
5540  {
5542  cleanup_comm();
5543  }
5544 next5:
5545  /**************************************************************/
5546  /*** random writer throughput tests **************************/
5547  /**************************************************************/
5548  if(include_tflag)
5549  if(!(include_mask & (long long)RANDOM_RW_MASK) || no_write)
5550  goto next6;
5551 
5552  toutputindex++;
5553  strcpy(&toutput[toutputindex][0],throughput_tests[8]);
5554  if((!distributed) || (distributed && master_iozone))
5555  start_monitor("Randwrite");
5556  walltime = 0.0;
5557  cputime = 0.0;
5558  jstarttime=0;
5559  sync();
5560  sleep(2);
5561  *stop_flag=0;
5562  total_kilos=0;
5563  /* Hooks to start the distributed Iozone client/server code */
5564  if(distributed)
5565  {
5566  use_thread=0; /* Turn of any Posix threads */
5567  if(master_iozone)
5569  else
5570  become_client();
5571  }
5572  if(!use_thread)
5573  {
5574  for(xx = 0; xx< num_child ; xx++){
5575  chid=xx;
5577  if(childids[xx]==-1){
5578  printf("\nFork failed\n");
5579  for(xy = 0; xy< xx ; xy++){
5580  Kill((long long)childids[xy],(long long)SIGTERM);
5581  }
5582  exit(38);
5583  }
5584  if(childids[xx]==0){
5585 #ifdef _64BIT_ARCH_
5586  thread_ranwrite_test((void *)xx);
5587 #else
5588  thread_ranwrite_test((void *)((long)xx));
5589 #endif
5590  }
5591  }
5592  }
5593 #ifndef NO_THREADS
5594  else
5595  {
5596  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
5597  chid=xx;
5598  if(!barray[xx])
5599  {
5600  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
5601  if(barray[xx] == 0) {
5602  perror("Memory allocation failed:");
5603  exit(26);
5604  }
5605  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
5606  ~(cache_size-1));
5607  }
5608 #ifdef _64BIT_ARCH_
5610 #else
5611  childids[xx] = mythread_create( thread_ranwrite_test,(void *)(long)xx);
5612 #endif
5613  if(childids[xx]==-1){
5614  printf("\nThread create failed\n");
5615  for(xy = 0; xy< xx ; xy++){
5616  kill((pid_t)myid,(int)SIGTERM);
5617  }
5618  exit(39);
5619  }
5620  }
5621  }
5622 #endif
5623  if(myid == (long long)getpid()){
5624  if(distributed && master_iozone)
5625  {
5627  }
5628  for(i=0;i<num_child; i++){ /* wait for children to start */
5629  child_stat = (struct child_stats *)&shmaddr[i];
5631  Poll((long long)1);
5632  }
5633  for(i=0;i<num_child; i++){
5634  child_stat = (struct child_stats *)&shmaddr[i];
5635  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
5636  if(delay_start!=0)
5637  Poll((long long)delay_start);
5638  if(distributed && master_iozone)
5640  }
5641  starttime1 = time_so_far();
5642  }
5643 
5644  getout=0;
5645  if(myid == (long long)getpid()){ /* Parent here */
5646  for( i = 0; i < num_child; i++){ /* wait for children to stop */
5647  child_stat = (struct child_stats *)&shmaddr[i];
5648  if(distributed && master_iozone)
5649  {
5650  printf("\n\tTest running:");
5651  wait_dist_join();
5652  break;
5653  }
5654  else
5655  {
5656  if(use_thread)
5657  {
5658  thread_join(childids[i],(void *)&pstatus);
5659  }
5660  else
5661  {
5662  wait(0);
5663  }
5664  }
5665  if(!jstarttime)
5666  jstarttime = time_so_far();
5667  }
5668  jtime = (time_so_far()-jstarttime)-time_res;
5669  if(jtime < (double).000001)
5670  {
5671  jtime=time_res;
5672  }
5673  }
5674  total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
5675  if(total_time < (double).000001)
5676  {
5678  if(rec_prob < reclen)
5679  rec_prob = reclen;
5680  res_prob=1;
5681  }
5682 #ifdef JTIME
5683  total_time=total_time-jtime;/* Remove the join time */
5684  if(!silent) printf("\nJoin time %10.2f\n",jtime);
5685 #endif
5686  total_kilos=0;
5687  ptotal=0;
5688  min_throughput=max_throughput=min_xfer=0;
5689  if(!silent) printf("\n");
5690  for(xyz=0;xyz<num_child;xyz++){
5691  child_stat = (struct child_stats *)&shmaddr[xyz];
5693  ptotal+=child_stat->actual;
5694  if(!min_xfer)
5695  min_xfer=child_stat->actual;
5696  if(child_stat->actual < min_xfer)
5697  min_xfer=child_stat->actual;
5698  if(!min_throughput)
5699  min_throughput=child_stat->throughput;
5700  if(child_stat->throughput < min_throughput)
5701  min_throughput=child_stat->throughput;
5702  if(child_stat->throughput > max_throughput)
5703  max_throughput=child_stat->throughput;
5705  /* Get the biggest walltime */
5708  if (child_stat->walltime > walltime)
5710  }
5711  avg_throughput=total_kilos/num_child;
5712  if(cpuutilflag)
5713  {
5714  if (cputime < cputime_res)
5715  cputime = 0.0;
5716  }
5717  if(cpuutilflag)
5718  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
5720 #ifdef NO_PRINT_LLD
5721  if(!silent) printf("\tChildren see throughput for %ld random writers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
5722  if(!silent && !distributed) printf("\tParent sees throughput for %ld random writers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
5723 #else
5724  if(!silent) printf("\tChildren see throughput for %lld random writers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
5725  if(!silent && !distributed) printf("\tParent sees throughput for %lld random writers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
5726 #endif
5727  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
5728  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
5729  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
5730  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
5731  /* CPU% can be > 100.0 for multiple CPUs */
5732  if(cpuutilflag)
5733  {
5734  if(walltime == 0.0)
5735  {
5736  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
5737  walltime, cputime, 0.0);
5738  }
5739  else
5740  {
5741  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
5742  walltime, cputime, 100.0 * cputime / walltime);
5743  }
5744  }
5745  if(Cflag)
5746  {
5747  for(xyz=0;xyz<num_child;xyz++)
5748  {
5749  child_stat = (struct child_stats *) &shmaddr[xyz];
5750  if(cpuutilflag)
5751  {
5752  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
5753  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
5755  }
5756  else
5757  {
5758  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
5759  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
5760  }
5761  }
5762  }
5763  if((!distributed) || (distributed && master_iozone))
5764  stop_monitor("Randwrite");
5765  sync();
5766  sleep(2);
5767  if(restf)
5768  sleep((int)rest_val);
5769  if(distributed && master_iozone)
5770  {
5772  cleanup_comm();
5773  }
5774 next6:
5775  /**************************************************************/
5776  /*** Pwrite writer throughput tests **************************/
5777  /**************************************************************/
5778 #ifndef HAVE_PREAD
5779  goto next7;
5780 #else
5781  if(include_tflag)
5782  if(!(include_mask & (long long)PWRITER_MASK))
5783  goto next7;
5784 
5785  toutputindex++;
5786  strcpy(&toutput[toutputindex][0],throughput_tests[9]);
5787  if((!distributed) || (distributed && master_iozone))
5788  start_monitor("Pwrite");
5789  walltime = 0.0;
5790  cputime = 0.0;
5791  jstarttime=0;
5792  sync();
5793  sleep(2);
5794  *stop_flag=0;
5795  total_kilos=0;
5796  /* Hooks to start the distributed Iozone client/server code */
5797  if(distributed)
5798  {
5799  use_thread=0; /* Turn of any Posix threads */
5800  if(master_iozone)
5802  else
5803  become_client();
5804  }
5805  if(!use_thread)
5806  {
5807  for(xx = 0; xx< num_child ; xx++){
5808  chid=xx;
5810  if(childids[xx]==-1){
5811  printf("\nFork failed\n");
5812  for(xy = 0; xy< xx ; xy++){
5813  Kill((long long)childids[xy],(long long)SIGTERM);
5814  }
5815  exit(38);
5816  }
5817  if(childids[xx]==0){
5818 #ifdef _64BIT_ARCH_
5819  thread_pwrite_test((void *)xx);
5820 #else
5821  thread_pwrite_test((void *)((long)xx));
5822 #endif
5823  }
5824  }
5825  }
5826 #ifndef NO_THREADS
5827  else
5828  {
5829  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
5830  chid=xx;
5831  if(!barray[xx])
5832  {
5833  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
5834  if(barray[xx] == 0) {
5835  perror("Memory allocation failed:");
5836  exit(26);
5837  }
5838  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
5839  ~(cache_size-1));
5840  }
5841 #ifdef _64BIT_ARCH_
5842  childids[xx] = mythread_create( thread_pwrite_test,xx);
5843 #else
5844  childids[xx] = mythread_create( thread_pwrite_test,(void *)(long)xx);
5845 #endif
5846  if(childids[xx]==-1){
5847  printf("\nThread create failed\n");
5848  for(xy = 0; xy< xx ; xy++){
5849  kill((pid_t)myid,(int)SIGTERM);
5850  }
5851  exit(39);
5852  }
5853  }
5854  }
5855 #endif
5856  if(myid == (long long)getpid()){
5857  if(distributed && master_iozone)
5858  {
5860  }
5861  for(i=0;i<num_child; i++){ /* wait for children to start */
5862  child_stat = (struct child_stats *)&shmaddr[i];
5864  Poll((long long)1);
5865  }
5866  for(i=0;i<num_child; i++){
5867  child_stat = (struct child_stats *)&shmaddr[i];
5868  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
5869  if(delay_start!=0)
5870  Poll((long long)delay_start);
5871  if(distributed && master_iozone)
5873  }
5874  starttime1 = time_so_far();
5875  }
5876 
5877  getout=0;
5878  if(myid == (long long)getpid()){ /* Parent here */
5879  for( i = 0; i < num_child; i++){ /* wait for children to stop */
5880  child_stat = (struct child_stats *)&shmaddr[i];
5881  if(distributed && master_iozone)
5882  {
5883  printf("\n\tTest running:");
5884  wait_dist_join();
5885  break;
5886  }
5887  else
5888  {
5889  if(use_thread)
5890  {
5891  thread_join(childids[i],(void *)&pstatus);
5892  }
5893  else
5894  {
5895  wait(0);
5896  }
5897  }
5898  if(!jstarttime)
5899  jstarttime = time_so_far();
5900  }
5901  jtime = (time_so_far()-jstarttime)-time_res;
5902  if(jtime < (double).000001)
5903  {
5904  jtime=time_res;
5905  }
5906  }
5907  total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
5908  if(total_time < (double).000001)
5909  {
5911  if(rec_prob < reclen)
5912  rec_prob = reclen;
5913  res_prob=1;
5914  }
5915 #ifdef JTIME
5916  total_time=total_time-jtime;/* Remove the join time */
5917  if(!silent) printf("\nJoin time %10.2f\n",jtime);
5918 #endif
5919  total_kilos=0;
5920  ptotal=0;
5921  min_throughput=max_throughput=min_xfer=0;
5922  if(!silent) printf("\n");
5923  for(xyz=0;xyz<num_child;xyz++){
5924  child_stat = (struct child_stats *)&shmaddr[xyz];
5926  ptotal+=child_stat->actual;
5927  if(!min_xfer)
5928  min_xfer=child_stat->actual;
5929  if(child_stat->actual < min_xfer)
5930  min_xfer=child_stat->actual;
5931  if(!min_throughput)
5932  min_throughput=child_stat->throughput;
5933  if(child_stat->throughput < min_throughput)
5934  min_throughput=child_stat->throughput;
5935  if(child_stat->throughput > max_throughput)
5936  max_throughput=child_stat->throughput;
5938  /* Get the biggest walltime*/
5941  if (child_stat->walltime > walltime)
5943  }
5944  avg_throughput=total_kilos/num_child;
5945  if(cpuutilflag)
5946  {
5947  if (cputime < cputime_res)
5948  cputime = 0.0;
5949  }
5950  if(cpuutilflag)
5951  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
5953 #ifdef NO_PRINT_LLD
5954  if(!silent) printf("\tChildren see throughput for %ld pwrite writers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
5955  if(!silent && !distributed) printf("\tParent sees throughput for %ld pwrite writers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
5956 #else
5957  if(!silent) printf("\tChildren see throughput for %lld pwrite writers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
5958  if(!silent && !distributed) printf("\tParent sees throughput for %lld pwrite writers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
5959 #endif
5960  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
5961  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
5962  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
5963  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
5964  /* CPU% can be > 100.0 for multiple CPUs */
5965  if(cpuutilflag)
5966  {
5967  if(walltime == 0.0)
5968  {
5969  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
5970  walltime, cputime, 0.0);
5971  }
5972  else
5973  {
5974  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
5975  walltime, cputime, 100.0 * cputime / walltime);
5976  }
5977  }
5978  if(Cflag)
5979  {
5980  for(xyz=0;xyz<num_child;xyz++)
5981  {
5982  child_stat = (struct child_stats *) &shmaddr[xyz];
5983  if(cpuutilflag)
5984  {
5985  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
5986  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
5988  }
5989  else
5990  {
5991  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
5992  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
5993  }
5994  }
5995  }
5996  if((!distributed) || (distributed && master_iozone))
5997  stop_monitor("Pwrite");
5998  sync();
5999  sleep(2);
6000  if(restf)
6001  sleep((int)rest_val);
6002  if(distributed && master_iozone)
6003  {
6005  cleanup_comm();
6006  }
6007 #endif
6008  /**************************************************************/
6009  /*** Pread reader throughput tests **************************/
6010  /**************************************************************/
6011 next7:
6012 
6013 #ifndef HAVE_PREAD
6014  goto next8;
6015 #else
6016  if(include_tflag)
6017  if(!(include_mask & (long long)PREADER_MASK))
6018  goto next8;
6019 
6020  toutputindex++;
6021  strcpy(&toutput[toutputindex][0],throughput_tests[10]);
6022  if((!distributed) || (distributed && master_iozone))
6023  start_monitor("Pread");
6024  walltime = 0.0;
6025  cputime = 0.0;
6026  jstarttime=0;
6027  sync();
6028  sleep(2);
6029  *stop_flag=0;
6030  total_kilos=0;
6031  /* Hooks to start the distributed Iozone client/server code */
6032  if(distributed)
6033  {
6034  use_thread=0; /* Turn of any Posix threads */
6035  if(master_iozone)
6037  else
6038  become_client();
6039  }
6040  if(!use_thread)
6041  {
6042  for(xx = 0; xx< num_child ; xx++){
6043  chid=xx;
6045  if(childids[xx]==-1){
6046  printf("\nFork failed\n");
6047  for(xy = 0; xy< xx ; xy++){
6048  Kill((long long)childids[xy],(long long)SIGTERM);
6049  }
6050  exit(38);
6051  }
6052  if(childids[xx]==0){
6053 #ifdef _64BIT_ARCH_
6054  thread_pread_test((void *)xx);
6055 #else
6056  thread_pread_test((void *)((long)xx));
6057 #endif
6058  }
6059  }
6060  }
6061 #ifndef NO_THREADS
6062  else
6063  {
6064  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
6065  chid=xx;
6066  if(!barray[xx])
6067  {
6068  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
6069  if(barray[xx] == 0) {
6070  perror("Memory allocation failed:");
6071  exit(26);
6072  }
6073  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
6074  ~(cache_size-1));
6075  }
6076 #ifdef _64BIT_ARCH_
6077  childids[xx] = mythread_create( thread_pread_test,xx);
6078 #else
6079  childids[xx] = mythread_create( thread_pread_test,(void *)(long)xx);
6080 #endif
6081  if(childids[xx]==-1){
6082  printf("\nThread create failed\n");
6083  for(xy = 0; xy< xx ; xy++){
6084  kill((pid_t)myid,(int)SIGTERM);
6085  }
6086  exit(39);
6087  }
6088  }
6089  }
6090 #endif
6091  if(myid == (long long)getpid()){
6092  if(distributed && master_iozone)
6093  {
6095  }
6096  for(i=0;i<num_child; i++){ /* wait for children to start */
6097  child_stat = (struct child_stats *)&shmaddr[i];
6099  Poll((long long)1);
6100  }
6101  for(i=0;i<num_child; i++){
6102  child_stat = (struct child_stats *)&shmaddr[i];
6103  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
6104  if(delay_start!=0)
6105  Poll((long long)delay_start);
6106  if(distributed && master_iozone)
6108  }
6109  starttime1 = time_so_far();
6110  }
6111 
6112  getout=0;
6113  if(myid == (long long)getpid()){ /* Parent here */
6114  for( i = 0; i < num_child; i++){ /* wait for children to stop */
6115  child_stat = (struct child_stats *)&shmaddr[i];
6116  if(distributed && master_iozone)
6117  {
6118  printf("\n\tTest running:");
6119  wait_dist_join();
6120  break;
6121  }
6122  else
6123  {
6124  if(use_thread)
6125  {
6126  thread_join(childids[i],(void *)&pstatus);
6127  }
6128  else
6129  {
6130  wait(0);
6131  }
6132  }
6133  if(!jstarttime)
6134  jstarttime = time_so_far();
6135  }
6136  jtime = (time_so_far()-jstarttime)-time_res;
6137  if(jtime < (double).000001)
6138  {
6139  jtime=time_res;
6140  }
6141  }
6142  total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
6143  if(total_time < (double).000001)
6144  {
6146  if(rec_prob < reclen)
6147  rec_prob = reclen;
6148  res_prob=1;
6149  }
6150 #ifdef JTIME
6151  total_time=total_time-jtime;/* Remove the join time */
6152  if(!silent) printf("\nJoin time %10.2f\n",jtime);
6153 #endif
6154  total_kilos=0;
6155  ptotal=0;
6156  min_throughput=max_throughput=min_xfer=0;
6157  if(!silent) printf("\n");
6158  for(xyz=0;xyz<num_child;xyz++){
6159  child_stat = (struct child_stats *)&shmaddr[xyz];
6161  ptotal+=child_stat->actual;
6162  if(!min_xfer)
6163  min_xfer=child_stat->actual;
6164  if(child_stat->actual < min_xfer)
6165  min_xfer=child_stat->actual;
6166  if(!min_throughput)
6167  min_throughput=child_stat->throughput;
6168  if(child_stat->throughput < min_throughput)
6169  min_throughput=child_stat->throughput;
6170  if(child_stat->throughput > max_throughput)
6171  max_throughput=child_stat->throughput;
6173  /* Get the biggest walltime*/
6176  if (child_stat->walltime > walltime)
6178  }
6179  avg_throughput=total_kilos/num_child;
6180  if(cpuutilflag)
6181  {
6182  if (cputime < cputime_res)
6183  cputime = 0.0;
6184  }
6185  if(cpuutilflag)
6186  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
6188 #ifdef NO_PRINT_LLD
6189  if(!silent) printf("\tChildren see throughput for %ld pread readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
6190  if(!silent && !distributed) printf("\tParent sees throughput for %ld pread readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
6191 #else
6192  if(!silent) printf("\tChildren see throughput for %lld pread readers \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
6193  if(!silent && !distributed) printf("\tParent sees throughput for %lld pread readers \t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
6194 #endif
6195  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
6196  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
6197  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
6198  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
6199  /* CPU% can be > 100.0 for multiple CPUs */
6200  if(cpuutilflag)
6201  {
6202  if(walltime == 0.0)
6203  {
6204  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
6205  walltime, cputime, 0.0);
6206  }
6207  else
6208  {
6209  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
6210  walltime, cputime, 100.0 * cputime / walltime);
6211  }
6212  }
6213  if(Cflag)
6214  {
6215  for(xyz=0;xyz<num_child;xyz++)
6216  {
6217  child_stat = (struct child_stats *) &shmaddr[xyz];
6218  if(cpuutilflag)
6219  {
6220  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
6221  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
6223  }
6224  else
6225  {
6226  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
6227  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
6228  }
6229  }
6230  }
6231  if((!distributed) || (distributed && master_iozone))
6232  stop_monitor("Pread");
6233  sync();
6234  sleep(2);
6235  if(restf)
6236  sleep((int)rest_val);
6237  if(distributed && master_iozone)
6238  {
6240  cleanup_comm();
6241  }
6242 #endif
6243 next8:
6244  if(include_tflag)
6245  if(!(include_mask & (long long)FWRITER_MASK))
6246  goto next9;
6247  /**************************************************************/
6248  /*** fwriter throughput tests *********************************/
6249  /**************************************************************/
6250  if((!distributed) || (distributed && master_iozone))
6251  start_monitor("Fwrite");
6252  toutputindex++;
6253  strcpy(&toutput[toutputindex][0],throughput_tests[11]);
6254  walltime = 0.0;
6255  cputime = 0.0;
6256  jstarttime=0;
6257  total_kilos=0;
6258  if(distributed)
6259  {
6260  use_thread=0;
6261  if(master_iozone)
6263  else
6264  become_client();
6265  }
6266  if(!use_thread)
6267  {
6268  for(xx = 0; xx< num_child ; xx++){
6269  chid=xx;
6271  if(childids[xx]==-1){
6272  printf("\nFork failed\n");
6273  for(xy = 0; xy< xx ; xy++){
6274  Kill((long long)childids[xy],(long long)SIGTERM);
6275  }
6276  exit(30);
6277  }
6278  if(childids[xx]==0){
6279 #ifdef _64BIT_ARCH_
6280  thread_fwrite_test((void *)xx);
6281 #else
6282  thread_fwrite_test((void *)((long)xx));
6283 #endif
6284  }
6285  }
6286  }
6287 #ifndef NO_THREADS
6288  else
6289  {
6290  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
6291  if(!barray[xx])
6292  {
6293  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
6294  if(barray[xx] == 0) {
6295  perror("Memory allocation failed:");
6296  exit(26);
6297  }
6298  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
6299  ~(cache_size-1));
6300  }
6301 #ifdef _64BIT_ARCH_
6303 #else
6304  childids[xx] = mythread_create( thread_fwrite_test,(void *)(long)xx);
6305 #endif
6306  if(childids[xx]==-1){
6307  printf("\nThread create failed\n");
6308  for(xy = 0; xy< xx ; xy++){
6309  kill((pid_t)myid,(int)SIGTERM);
6310  }
6311  exit(31);
6312  }
6313  }
6314  }
6315 #endif
6316  if(myid == (long long)getpid()){
6317  if(distributed && master_iozone)
6318  {
6320  }
6321  for(i=0;i<num_child; i++){ /* wait for children to start */
6322  child_stat=(struct child_stats *)&shmaddr[i];
6324  Poll((long long)1);
6325  }
6326  for(i=0;i<num_child; i++)
6327  {
6328  child_stat=(struct child_stats *)&shmaddr[i];
6329  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
6330  if(delay_start!=0)
6331  Poll((long long)delay_start);
6332  if(distributed && master_iozone)
6334  }
6335  starttime1 = time_so_far();
6336  goto jumpend1;
6337  }
6338 jumpend1:
6339  getout=0;
6340  if(myid == (long long)getpid()){ /* Parent here */
6341  for( i = 0; i < num_child; i++){
6342  child_stat = (struct child_stats *)&shmaddr[i];
6343  if(distributed && master_iozone)
6344  {
6345  printf("\n\tTest running:");
6346  wait_dist_join();
6347  break;
6348  }
6349  else
6350  {
6351  if(use_thread)
6352  {
6353  thread_join(childids[i],(void *)&pstatus);
6354  }
6355  else
6356  {
6357  wait(0);
6358  }
6359  }
6360  if(!jstarttime)
6361  jstarttime = time_so_far();
6362  }
6363  jtime = (time_so_far()-jstarttime)-time_res;
6364  if(jtime < (double).000001)
6365  {
6366  jtime=time_res;
6367  }
6368  }
6369  total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
6370  if(total_time < (double).000001)
6371  {
6373  if(rec_prob < reclen)
6374  rec_prob = reclen;
6375  res_prob=1;
6376  }
6377 #ifdef JTIME
6378  total_time=total_time-jtime;/* Remove the join time */
6379  if(!silent) printf("\nJoin time %10.2f\n",jtime);
6380 #endif
6381 
6382  total_kilos=0;
6383  ptotal=0;
6384  min_throughput=max_throughput=min_xfer=0;
6385  if(!silent) printf("\n");
6386  for(xyz=0;xyz<num_child;xyz++){
6387  child_stat=(struct child_stats *)&shmaddr[xyz];
6389  ptotal+=child_stat->actual;
6390  if(!min_xfer)
6391  min_xfer=child_stat->actual;
6392  if(child_stat->actual < min_xfer)
6393  min_xfer=child_stat->actual;
6394  if(!min_throughput)
6395  min_throughput=child_stat->throughput;
6396  if(child_stat->throughput < min_throughput)
6397  min_throughput=child_stat->throughput;
6398  if(child_stat->throughput > max_throughput)
6399  max_throughput=child_stat->throughput;
6401  /* Get the earliest start time and latest fini time to calc. elapsed time. */
6404  if (child_stat->walltime > walltime)
6406  }
6407  avg_throughput=total_kilos/num_child;
6408  if(cpuutilflag)
6409  {
6410  if (cputime < cputime_res)
6411  cputime = 0.0;
6412  }
6413  if(cpuutilflag)
6414  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
6416 #ifdef NO_PRINT_LLD
6417  if(!silent) printf("\tChildren see throughput for %2ld fwriters \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
6418  if(!silent && !distributed) printf("\tParent sees throughput for %2ld fwriters \t\t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
6419 #else
6420  if(!silent) printf("\tChildren see throughput for %2lld fwriters \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
6421  if(!silent && !distributed) printf("\tParent sees throughput for %2lld fwriters \t\t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
6422 #endif
6423  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
6424  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
6425  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
6426  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
6427  /* CPU% can be > 100.0 for multiple CPUs */
6428  if(cpuutilflag)
6429  {
6430  if(walltime == 0.0)
6431  {
6432  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
6433  walltime, cputime, 0.0);
6434  }
6435  else
6436  {
6437  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
6438  walltime, cputime, 100.0 * cputime / walltime);
6439  }
6440  }
6441  if(Cflag)
6442  {
6443  for(xyz=0;xyz<num_child;xyz++)
6444  {
6445  child_stat = (struct child_stats *) &shmaddr[xyz];
6446  if(cpuutilflag)
6447  {
6448  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
6449  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
6451  }
6452  else
6453  {
6454  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
6455  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
6456  }
6457  }
6458  }
6459  if((!distributed) || (distributed && master_iozone))
6460  stop_monitor("Fwrite");
6461  /**********************************************************/
6462  /*************** End of fwrite throughput ****************/
6463  /**********************************************************/
6464  sync();
6465  sleep(2);
6466  if(restf)
6467  sleep((int)rest_val);
6468  if(distributed && master_iozone)
6469  {
6471  cleanup_comm();
6472  }
6473 next9:
6474  if(include_tflag)
6475  if(!(include_mask & (long long)FREADER_MASK))
6476  goto next10;
6477  /**************************************************************/
6478  /*** freader throughput tests *********************************/
6479  /**************************************************************/
6480  if((!distributed) || (distributed && master_iozone))
6481  start_monitor("Fread");
6482  toutputindex++;
6483  strcpy(&toutput[toutputindex][0],throughput_tests[12]);
6484  walltime = 0.0;
6485  cputime = 0.0;
6486  jstarttime=0;
6487  total_kilos=0;
6488  if(distributed)
6489  {
6490  use_thread=0;
6491  if(master_iozone)
6493  else
6494  become_client();
6495  }
6496  if(!use_thread)
6497  {
6498  for(xx = 0; xx< num_child ; xx++){
6499  chid=xx;
6501  if(childids[xx]==-1){
6502  printf("\nFork failed\n");
6503  for(xy = 0; xy< xx ; xy++){
6504  Kill((long long)childids[xy],(long long)SIGTERM);
6505  }
6506  exit(30);
6507  }
6508  if(childids[xx]==0){
6509 #ifdef _64BIT_ARCH_
6510  thread_fread_test((void *)xx);
6511 #else
6512  thread_fread_test((void *)((long)xx));
6513 #endif
6514  }
6515  }
6516  }
6517 #ifndef NO_THREADS
6518  else
6519  {
6520  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
6521  if(!barray[xx])
6522  {
6523  barray[xx]=(char *) alloc_mem((long long)(MAXBUFFERSIZE+cache_size),(int)0);
6524  if(barray[xx] == 0) {
6525  perror("Memory allocation failed:");
6526  exit(26);
6527  }
6528  barray[xx] =(char *)(((long)barray[xx] + cache_size ) &
6529  ~(cache_size-1));
6530  }
6531 #ifdef _64BIT_ARCH_
6533 #else
6534  childids[xx] = mythread_create( thread_fread_test,(void *)(long)xx);
6535 #endif
6536  if(childids[xx]==-1){
6537  printf("\nThread create failed\n");
6538  for(xy = 0; xy< xx ; xy++){
6539  kill((pid_t)myid,(int)SIGTERM);
6540  }
6541  exit(31);
6542  }
6543  }
6544  }
6545 #endif
6546  if(myid == (long long)getpid()){
6547  if(distributed && master_iozone)
6548  {
6550  }
6551  for(i=0;i<num_child; i++){ /* wait for children to start */
6552  child_stat=(struct child_stats *)&shmaddr[i];
6554  Poll((long long)1);
6555  }
6556  for(i=0;i<num_child; i++)
6557  {
6558  child_stat=(struct child_stats *)&shmaddr[i];
6559  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
6560  if(delay_start!=0)
6561  Poll((long long)delay_start);
6562  if(distributed && master_iozone)
6564  }
6565  starttime1 = time_so_far();
6566  goto jumpend3;
6567  }
6568 jumpend3:
6569  getout=0;
6570  if(myid == (long long)getpid()){ /* Parent here */
6571  for( i = 0; i < num_child; i++){
6572  child_stat = (struct child_stats *)&shmaddr[i];
6573  if(distributed && master_iozone)
6574  {
6575  printf("\n\tTest running:");
6576  wait_dist_join();
6577  break;
6578  }
6579  else
6580  {
6581  if(use_thread)
6582  {
6583  thread_join(childids[i],(void *)&pstatus);
6584  }
6585  else
6586  {
6587  wait(0);
6588  }
6589  }
6590  if(!jstarttime)
6591  jstarttime = time_so_far();
6592  }
6593  jtime = (time_so_far()-jstarttime)-time_res;
6594  if(jtime < (double).000001)
6595  {
6596  jtime=time_res;
6597  }
6598  }
6599  total_time = (time_so_far() - starttime1)-time_res; /* Parents time */
6600  if(total_time < (double).000001)
6601  {
6603  if(rec_prob < reclen)
6604  rec_prob = reclen;
6605  res_prob=1;
6606  }
6607 #ifdef JTIME
6608  total_time=total_time-jtime;/* Remove the join time */
6609  if(!silent) printf("\nJoin time %10.2f\n",jtime);
6610 #endif
6611 
6612  total_kilos=0;
6613  ptotal=0;
6614  min_throughput=max_throughput=min_xfer=0;
6615  if(!silent) printf("\n");
6616  for(xyz=0;xyz<num_child;xyz++){
6617  child_stat=(struct child_stats *)&shmaddr[xyz];
6619  ptotal+=child_stat->actual;
6620  if(!min_xfer)
6621  min_xfer=child_stat->actual;
6622  if(child_stat->actual < min_xfer)
6623  min_xfer=child_stat->actual;
6624  if(!min_throughput)
6625  min_throughput=child_stat->throughput;
6626  if(child_stat->throughput < min_throughput)
6627  min_throughput=child_stat->throughput;
6628  if(child_stat->throughput > max_throughput)
6629  max_throughput=child_stat->throughput;
6631  /* Get the earliest start time and latest fini time to calc. elapsed time. */
6634  if (child_stat->walltime > walltime)
6636  }
6637  avg_throughput=total_kilos/num_child;
6638  if(cpuutilflag)
6639  {
6640  if (cputime < cputime_res)
6641  cputime = 0.0;
6642  }
6643  if(cpuutilflag)
6644  store_times (walltime, cputime); /* Must be Before store_dvalue(). */
6646 #ifdef NO_PRINT_LLD
6647  if(!silent) printf("\tChildren see throughput for %2ld freaders \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
6648  if(!silent && !distributed) printf("\tParent sees throughput for %2ld freaders \t\t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
6649 #else
6650  if(!silent) printf("\tChildren see throughput for %2lld freaders \t= %10.2f %s/sec\n", num_child, total_kilos,unit);
6651  if(!silent && !distributed) printf("\tParent sees throughput for %2lld freaders \t\t= %10.2f %s/sec\n", num_child, (double)(ptotal)/total_time,unit);
6652 #endif
6653  if(!silent) printf("\tMin throughput per %s \t\t\t= %10.2f %s/sec \n", port,min_throughput,unit);
6654  if(!silent) printf("\tMax throughput per %s \t\t\t= %10.2f %s/sec\n", port,max_throughput,unit);
6655  if(!silent) printf("\tAvg throughput per %s \t\t\t= %10.2f %s/sec\n", port,avg_throughput,unit);
6656  if(!silent) printf("\tMin xfer \t\t\t\t\t= %10.2f %s\n", min_xfer,unit);
6657  /* CPU% can be > 100.0 for multiple CPUs */
6658  if(cpuutilflag)
6659  {
6660  if(walltime == 0.0)
6661  {
6662  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
6663  walltime, cputime, 0.0);
6664  }
6665  else
6666  {
6667  if(!silent) printf("\tCPU utilization: Wall time %8.3f CPU time %8.3f CPU utilization %6.2f %%\n\n",
6668  walltime, cputime, 100.0 * cputime / walltime);
6669  }
6670  }
6671  if(Cflag)
6672  {
6673  for(xyz=0;xyz<num_child;xyz++)
6674  {
6675  child_stat = (struct child_stats *) &shmaddr[xyz];
6676  if(cpuutilflag)
6677  {
6678  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec, wall=%6.3f, cpu=%6.3f, %%=%6.2f\n",
6679  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit, child_stat->walltime,
6681  }
6682  else
6683  {
6684  if(!silent) printf("\tChild[%ld] xfer count = %10.2f %s, Throughput = %10.2f %s/sec\n",
6685  (long)xyz, child_stat->actual, unit, child_stat->throughput, unit);
6686  }
6687  }
6688  }
6689  if((!distributed) || (distributed && master_iozone))
6690  stop_monitor("Fread");
6691  /**********************************************************/
6692  /*************** End of fread throughput ******************/
6693  /**********************************************************/
6694  sync();
6695  sleep(2);
6696  if(restf)
6697  sleep((int)rest_val);
6698  if(distributed && master_iozone)
6699  {
6701  cleanup_comm();
6702  }
6703 next10:
6704  sleep(2); /* You need this. If you stop and restart the
6705  master_listen it will fail on Linux */
6706  if (!no_unlink) {
6707  /**********************************************************/
6708  /* Cleanup all of the temporary files */
6709  /* This is not really a test. It behaves like a test so */
6710  /* it can unlink all of the same files that the other */
6711  /* tests left hanging around. */
6712  /**********************************************************/
6713  /* Hooks to start the distributed Iozone client/server code */
6714  if(distributed)
6715  {
6716  use_thread=0; /* Turn of any Posix threads */
6717  if(master_iozone)
6719  else
6720  become_client();
6721  }
6722  if(!use_thread)
6723  {
6724  for(xx = 0; xx< num_child ; xx++){
6725  chid=xx;
6727  if(childids[xx]==-1){
6728  printf("\nFork failed\n");
6729  for(xy = 0; xy< xx ; xy++){
6730  Kill((long long)childids[xy],(long long)SIGTERM);
6731  }
6732  exit(28);
6733  }
6734  if(childids[xx] == 0){
6735 #ifdef _64BIT_ARCH_
6736  thread_cleanup_test((void *)xx);
6737 #else
6738  thread_cleanup_test((void *)((long)xx));
6739 #endif
6740  }
6741  }
6742  }
6743 #ifndef NO_THREADS
6744  else
6745  {
6746  for(xx = 0; xx< num_child ; xx++){ /* Create the children */
6747 #ifdef _64BIT_ARCH_
6749 #else
6750  childids[xx] = mythread_create( thread_cleanup_test,(void *)(long)xx);
6751 #endif
6752  if(childids[xx]==-1){
6753  printf("\nThread create failed\n");
6754  for(xy = 0; xy< xx ; xy++){
6755  Kill((long long)myid,(long long)SIGTERM);
6756  }
6757  exit(29);
6758  }
6759  }
6760  }
6761 #endif
6762  if((long long)myid == getpid())
6763  {
6764  if(distributed && master_iozone)
6765  {
6767  }
6768  for(i=0;i<num_child; i++){
6769  child_stat = (struct child_stats *)&shmaddr[i];
6770  /* wait for children to start */
6771  while(child_stat->flag==CHILD_STATE_HOLD)
6772  Poll((long long)1);
6773  }
6774  for(i=0;i<num_child; i++)
6775  {
6776  child_stat = (struct child_stats *)&shmaddr[i];
6777  child_stat->flag = CHILD_STATE_BEGIN; /* tell children to go */
6778  if(delay_start!=0)
6779  Poll((long long)delay_start);
6780  if(distributed && master_iozone)
6782  }
6783  }
6784 
6785  getout=0;
6786  if((long long)myid == getpid()){ /* Parent only here */
6787  for( i = 0; i < num_child; i++){
6788  child_stat=(struct child_stats *)&shmaddr[i];
6789  if(distributed && master_iozone)
6790  {
6791  printf("\n\tTest cleanup:");
6792  wait_dist_join();
6793  break;
6794  }
6795  else
6796  {
6797  if(use_thread)
6798  {
6799  thread_join(childids[i],(void *)&pstatus);
6800  }
6801  else
6802  {
6803  wait(0);
6804  }
6805  }
6806  }
6807  }
6808 
6809  for(xyz=0;xyz<num_child;xyz++){ /* Reset state to 0 (HOLD) */
6810  child_stat=(struct child_stats *)&shmaddr[xyz];
6812  }
6813  sync();
6814  sleep(2);
6815  if(distributed && master_iozone)
6816  {
6818 #ifdef Windows
6819  /* windows needs time before shutting down sockets */
6820  sleep(1);
6821 #endif
6822  cleanup_comm();
6823  }
6824  }
6825  /********************************************************/
6826  /* End of cleanup */
6827  /********************************************************/
6828  sync();
6829  if(!silent) printf("\n");
6830  if(!silent) printf("\n");
6831  return;
6832 }
void become_client()
Definition: iozone.c:21555
char fflag
Definition: iozone.c:1329
store_times(double walltime, double cputime)
Definition: iozone.c:11551
long long rec_prob
Definition: iozone.c:1294
int w_traj_flag
Definition: iozone.c:1523
#define RANDOM_MIX_MASK
Definition: iozone.c:923
void *() thread_rread_test()
char sflag
Definition: iozone.c:1303
#define CHILD_STATE_HOLD
Definition: iozone.c:942
char Cflag
Definition: iozone.c:1371
int toutputindex
Definition: iozone.c:1477
void cleanup_comm()
Definition: iozone.c:22690
struct child_stats * child_stat
start_monitor(char *test)
Definition: iozone.c:23678
void *() thread_reverse_read_test()
int no_unlink
Definition: iozone.c:1521
#define THREAD_PWRITE_TEST
Definition: iozone.c:1438
int no_write
Definition: iozone.c:1522
void *() thread_fread_test()
VOLATILE struct child_stats * shmaddr
Definition: iozone.c:1267
void *() thread_stride_read_test()
#define RANDOM_RW_MASK
Definition: iozone.c:922
#define THREAD_PREAD_TEST
Definition: iozone.c:1439
#define THREAD_RANDOM_WRITE_TEST
Definition: iozone.c:1435
int restf
Definition: iozone.c:1514
void *() thread_fwrite_test()
char rflag
Definition: iozone.c:1303
float actual
Definition: iozone.c:463
void *() thread_rwrite_test()
#define STRIDE_READ_MASK
Definition: iozone.c:926
char * barray[MAXSTREAMS]
Definition: iozone.c:1287
char dummyfile[MAXSTREAMS][MAXNAMESIZE]
Definition: iozone.c:1362
void prepage()
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
#define THREAD_REREAD_TEST
Definition: iozone.c:1432
#define THREAD_WRITE_TEST
Definition: iozone.c:1429
#define CHILD_STATE_BEGIN
Definition: iozone.c:946
#define THREAD_FREAD_TEST
Definition: iozone.c:1441
long long * pstatus
Definition: iozone.c:1377
stop_monitor(char *test)
Definition: iozone.c:23696
long long reclen
Definition: iozone.c:1535
#define FREADER_MASK
Definition: iozone.c:928
long long myid
Definition: iozone.c:1335
void Kill()
char distributed
Definition: iozone.c:1296
char use_thread
Definition: iozone.c:1372
#define READER_MASK
Definition: iozone.c:921
void *() thread_ranread_test()
float throughput
Definition: iozone.c:462
#define THREAD_RANDOM_READ_TEST
Definition: iozone.c:1434
#define THREAD_REVERSE_READ_TEST
Definition: iozone.c:1436
char noretest
Definition: iozone.c:1510
char cpuutilflag
Definition: iozone.c:1321
int start_master_listen()
Definition: iozone.c:20277
long long debug1
Definition: iozone.c:1373
void *() thread_ranwrite_test()
char * alloc_mem()
long long delay_start
Definition: iozone.c:1536
void stop_master_listen()
char master_iozone
Definition: iozone.c:1296
char include_tflag
Definition: iozone.c:1329
float cputime
Definition: iozone.c:461
int wait()
char * mainbuffer
Definition: iozone.c:1366
VOLATILE char stoptime
Definition: iozone.c:1370
long long include_mask
Definition: iozone.c:1332
int aggflag
Definition: iozone.c:1480
long long num_child
Definition: iozone.c:1335
void store_dvalue()
#define KILOBYTES
Definition: iozone.c:789
long long chid
Definition: iozone.c:1529
void *() thread_mix_test()
#define THREAD_RANDOM_MIX_TEST
Definition: iozone.c:1437
char * haveshm
Definition: iozone.c:1288
#define THREAD_FWRITE_TEST
Definition: iozone.c:1440
VOLATILE char * stop_flag
Definition: iozone.c:1537
#define REVERSE_MASK
Definition: iozone.c:924
char * throughput_tests[]
Definition: iozone.c:1385
#define MAXBUFFERSIZE
Definition: iozone.c:809
char * buffer
Definition: iozone.c:1366
char * filearray[MAXSTREAMS]
Definition: iozone.c:1364
off64_t numrecs64
Definition: iozone.c:1534
void tell_children_begin()
#define THREAD_CLEANUP_TEST
Definition: iozone.c:1442
long long mythread_create()
long long flag
Definition: iozone.c:458
long long start_child_proc()
long long childids[MAXSTREAMS+1]
Definition: iozone.c:1335
int kill(__pid_t __pid, int __sig) __attribute__((__nothrow__
#define WRITER_MASK
Definition: iozone.c:920
off64_t kilobytes64
Definition: iozone.c:1277
static double cpu_util()
double total_kilos
Definition: iozone.c:1268
void start_master_listen_loop()
void wait_dist_join()
Definition: iozone.c:22391
int master_listen_socket
Definition: iozone.c:1473
void *() thread_read_test()
#define THREAD_READ_TEST
Definition: iozone.c:1431
#define THREAD_REWRITE_TEST
Definition: iozone.c:1430
void *() thread_write_test()
void Poll()
float walltime
Definition: iozone.c:460
char silent
Definition: iozone.c:1295
#define FWRITER_MASK
Definition: iozone.c:927
#define SHMSIZE
Definition: iozone.c:1263
long long res_prob
Definition: iozone.c:1294
static double time_so_far()
Definition: iozone.c:6844
#define VOLATILE
Definition: iozone.c:395
char OPS_flag
Definition: iozone.c:1517
#define THREAD_STRIDE_TEST
Definition: iozone.c:1433
void *() thread_cleanup_test()
long long orig_size
Definition: iozone.c:1274
void exit()
char toutput[20][20]
Definition: iozone.c:1476
void *() thread_join()
double cputime_res
Definition: iozone.c:1271
long long rest_val
Definition: iozone.c:1540
long long off64_t
Definition: iozone.c:357
unsigned long cache_size
Definition: iozone.c:1375
int i
Definition: fileop.c:140
double total_time
Definition: iozone.c:1268
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:
Here is the caller graph for this function:

◆ time_so_far()

static double time_so_far ( void  )
static

Definition at line 6844 of file iozone.c.

6846 {
6847 #ifdef Windows
6848  LARGE_INTEGER freq,counter;
6849  double wintime,bigcounter;
6850  struct timeval tp;
6851  /* For Windows the time_of_day() is useless. It increments in 55 milli
6852  * second increments. By using the Win32api one can get access to the
6853  * high performance measurement interfaces. With this one can get back
6854  * into the 8 to 9 microsecond resolution.
6855  */
6856  if(pit_hostname[0]){
6857  if (pit_gettimeofday(&tp, (struct timezone *) NULL, pit_hostname,
6858  pit_service) == -1)
6859  perror("pit_gettimeofday");
6860  return ((double) (tp.tv_sec)) + (((double) tp.tv_usec) * 0.000001 );
6861  }
6862  else
6863  {
6864  QueryPerformanceFrequency(&freq);
6865  QueryPerformanceCounter(&counter);
6866  bigcounter=(double)counter.HighPart *(double)0xffffffff +
6867  (double)counter.LowPart;
6868  wintime = (double)(bigcounter/(double)freq.LowPart);
6869  return((double)wintime);
6870  }
6871 #else
6872 #if defined (OSFV4) || defined(OSFV3) || defined(OSFV5)
6873  struct timespec gp;
6874 
6875  if (getclock(TIMEOFDAY, (struct timespec *) &gp) == -1)
6876  perror("getclock");
6877  return (( (double) (gp.tv_sec)) +
6878  ( ((float)(gp.tv_nsec)) * 0.000000001 ));
6879 #else
6880  struct timeval tp;
6881 
6882  if(pit_hostname[0]){
6883  if (pit_gettimeofday(&tp, (struct timezone *) NULL, pit_hostname, pit_service) == -1)
6884  perror("pit_gettimeofday");
6885  return ((double) (tp.tv_sec)) + (((double) tp.tv_usec) * 0.000001 );
6886  }
6887  else
6888  {
6889  if (gettimeofday(&tp, (struct timezone *) NULL) == -1)
6890  perror("gettimeofday");
6891  return ((double) (tp.tv_sec)) + (((double) tp.tv_usec) * 0.000001 );
6892  }
6893 #endif
6894 #endif
6895 }
char pit_hostname[40]
Definition: iozone.c:1400
int pit_gettimeofday()
int gettimeofday(void *ptr1, void *ptr2)
char pit_service[8]
Definition: iozone.c:1401
Here is the call graph for this function:
Here is the caller graph for this function:

◆ time_so_far1()

static double time_so_far1 ( )
static

Definition at line 19207 of file iozone.c.

19209 {
19210  /* For Windows the time_of_day() is useless. It increments in
19211  55 milli second increments. By using the Win32api one can
19212  get access to the high performance measurement interfaces.
19213  With this one can get back into the 8 to 9 microsecond resolution
19214  */
19215 #ifdef Windows
19216  LARGE_INTEGER freq,counter;
19217  double wintime;
19218  double bigcounter;
19219  struct timeval tp;
19220 
19221  if(pit_hostname[0]){
19222  pit_gettimeofday(&tp, (struct timezone *) NULL, pit_hostname,
19223  pit_service);
19224  return ((double) (tp.tv_sec)*1000000.0)+(((double)tp.tv_usec));
19225  }
19226  else
19227  {
19228 
19229  QueryPerformanceFrequency(&freq);
19230  QueryPerformanceCounter(&counter);
19231  bigcounter=(double)counter.HighPart *(double)0xffffffff +
19232  (double)counter.LowPart;
19233  wintime = (double)(bigcounter/(double)freq.LowPart);
19234  return((double)wintime*1000000.0);
19235  }
19236 #else
19237 #if defined (OSFV4) || defined(OSFV3) || defined(OSFV5)
19238  struct timespec gp;
19239 
19240  if (getclock(TIMEOFDAY, (struct timespec *) &gp) == -1)
19241  perror("getclock");
19242  return (( (double) (gp.tv_sec)*1000000.0) +
19243  ( ((float)(gp.tv_nsec)) * 0.001 ));
19244 #else
19245  struct timeval tp;
19246 
19247  if(pit_hostname[0]){
19248  if (pit_gettimeofday(&tp, (struct timezone *) NULL, pit_hostname,
19249  pit_service) == -1)
19250  perror("pit_gettimeofday");
19251  return ((double) (tp.tv_sec)*1000000.0) + (((double) tp.tv_usec) );
19252  }
19253  else
19254  {
19255  if (gettimeofday(&tp, (struct timezone *) NULL) == -1)
19256  perror("gettimeofday");
19257  return ((double) (tp.tv_sec)*1000000.0) + (((double) tp.tv_usec) );
19258  }
19259 #endif
19260 #endif
19261 }
char pit_hostname[40]
Definition: iozone.c:1400
int pit_gettimeofday()
int gettimeofday(void *ptr1, void *ptr2)
char pit_service[8]
Definition: iozone.c:1401
Here is the call graph for this function:
Here is the caller graph for this function:

◆ touch_dedup() [1/2]

void touch_dedup ( )
Here is the caller graph for this function:

◆ touch_dedup() [2/2]

void touch_dedup ( char *  i,
int  size 
)

Definition at line 23804 of file iozone.c.

23805 {
23806  register int x;
23807  register long *ip;
23808  ip = (long *)i;
23809  srand(DEDUPSEED);
23810  for(x=0;x<size/sizeof(long);x++)
23811  {
23812  *ip=rand(); /* fill initial buffer */
23813  ip++;
23814  }
23815 }
#define DEDUPSEED
Definition: iozone.c:449
void srand()
long long x
Definition: iozone.c:1335
int rand()
int i
Definition: fileop.c:140
Here is the call graph for this function:

◆ traj_vers()

void traj_vers ( )

Definition at line 19916 of file iozone.c.

19918 {
19919  FILE *fd;
19920  char *where;
19921  char buf[200];
19922  int things;
19923  char *ret1;
19924 
19925  if(r_traj_flag)
19926  {
19927  things=0;
19928  fd=fopen(read_traj_filename,"r");
19929  if(fd == (FILE *)0)
19930  {
19931  printf("Unable to open read telemetry file \"%s\"\n", read_traj_filename);
19932  exit(174);
19933  }
19934 loop1:
19935  ret1=fgets(buf,200,fd);
19936  if(ret1==(char *)0)
19937  {
19938  fclose(fd);
19939  return;
19940  }
19941  where=(char *)&buf[0];
19942  if((*where=='#') || (*where=='\n'))
19943  goto loop1;
19944  things++;
19945  strtok(where," ");
19946  while( (char *)(strtok( (char *)0," ")) != (char *)0)
19947  {
19948  things++;
19949  }
19950  r_traj_items=things;
19951 #ifdef DEBUG
19952  printf("Found %d items in the read telemetry file\n",things);
19953 #endif
19954  }
19955  if(w_traj_flag)
19956  {
19957  things=0;
19958  fd=fopen(write_traj_filename,"r");
19959  if(fd == (FILE *)0)
19960  {
19961  printf("Unable to open write telemetry file \"%s\"\n", write_traj_filename);
19962  exit(174);
19963  }
19964 loop2:
19965  ret1=fgets(buf,200,fd);
19966  if(ret1==(char *)0)
19967  {
19968  fclose(fd);
19969  return;
19970  }
19971  where=(char *)&buf[0];
19972  if((*where=='#') || (*where=='\n'))
19973  goto loop2;
19974  things++;
19975  strtok(where," ");
19976  while( (char *)(strtok( (char *)0," ")) != (char *)0)
19977  {
19978  things++;
19979  }
19980  fclose(fd);
19981  w_traj_items=things;
19982 #ifdef DEBUG
19983  printf("Found %d items in the write telemetry file\n",things);
19984 #endif
19985  }
19986 }
int w_traj_flag
Definition: iozone.c:1523
int fd
Definition: iozone.c:1291
int w_traj_items
Definition: iozone.c:1328
int r_traj_items
Definition: iozone.c:1328
char write_traj_filename[MAXNAMESIZE]
Definition: iozone.c:1507
int r_traj_flag
Definition: iozone.c:1523
char read_traj_filename[MAXNAMESIZE]
Definition: iozone.c:1508
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
void exit()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unlink()

int unlink ( )
Here is the caller graph for this function:

◆ verify_buffer()

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.

6948 {
6949  volatile unsigned long long *where;
6950  volatile unsigned long long dummy;
6951  long *de_ibuf, *de_obuf;
6952  long long j,k;
6953  off64_t file_position=0;
6954  off64_t i;
6955  char *where2;
6956  char *pattern_ptr;
6957  long long mpattern,xx2;
6958  unsigned int seed;
6959  unsigned long x;
6960  unsigned long long value,value1;
6961  unsigned long long a= 0x01020304;
6962  unsigned long long b = 0x05060708;
6963  unsigned long long c= 0x01010101;
6964  unsigned long long d = 0x01010101;
6965  unsigned long long pattern_buf;
6966  int lite = 1; /* Only validate 1 long when running
6967  de-deup validation */
6968 
6969  value = (a<<32) | b;
6970  value1 = (c<<32) | d;
6971 
6972  /* printf("Verify Sverify %d verify %d diag_v %d\n",sverify,verify,diag_v); */
6973  x=0;
6974  xx2=chid;
6975  if(share_file)
6976  xx2=(long long)0;
6977  mpattern=patt;
6978  pattern_buf=patt;
6979  where=(unsigned long long *)buffer;
6980  if(sverify == 2)
6981  {
6982  for(i=0;i<(length);i+=page_size)
6983  {
6984  dummy = *where;
6985  where+=(page_size/sizeof(long long));
6986  }
6987  return(0);
6988  }
6989  if(dedup)
6990  {
6991  gen_new_buf((char *)dedup_ibuf,(char *)dedup_temp, (long)recnum, (int)length,(int)dedup, (int) dedup_interior, dedup_compress, 0);
6992  de_ibuf = (long *)buffer;
6993  de_obuf = (long *)dedup_temp;
6994  if(lite) /* short touch to reduce intrusion */
6995  length = (long) sizeof(long);
6996  for(i=0;i<length/sizeof(long);i++)
6997  {
6998  if(de_ibuf[i]!= de_obuf[i])
6999  {
7000  if(!silent)
7001 #ifdef NO_PRINT_LLD
7002  printf("\nDedup mis-compare at %ld\n",
7003  (long long)((recnum*recsize)+(i*sizeof(long))) );
7004 #else
7005  printf("\nDedup mis-compare at %lld\n",
7006  (long long)((recnum*recsize)+(i*sizeof(long))) );
7007  printf("Found %.lx Expecting %.lx \n",de_ibuf[i], de_obuf[i]);
7008 #endif
7009  return(1);
7010  }
7011  }
7012  return(0);
7013  }
7014  if(diag_v)
7015  {
7016  if(no_unlink)
7017  base_time=0;
7018  seed= (unsigned int)(base_time+xx2+recnum);
7019  srand(seed);
7020  mpattern=(long long)rand();
7021  mpattern=(mpattern<<48) | (mpattern<<32) | (mpattern<<16) | mpattern;
7022  mpattern=mpattern+value;
7023  }
7024 
7025  /* printf("verify patt %llx CHid %d\n",mpattern,chid);*/
7026 
7027  where=(unsigned long long *)buffer;
7028 
7029  if(!verify)
7030  printf("\nOOPS You have entered verify_buffer unexpectedly !!! \n");
7031 
7032  if(sverify == 1)
7033  {
7034  for(i=0;i<(length);i+=page_size)
7035  {
7036  if((unsigned long long)(*where) != (unsigned long long)((pattern_buf<<32) | pattern_buf))
7037  {
7038  file_position = (off64_t)( (recnum * recsize)+ i);
7039  printf("\n\n");
7040 #ifdef NO_PRINT_LLD
7041  printf("Error in file: Found ?%lx? Expecting ?%lx? addr %lx\n",*where, (long long)((pattern_buf<<32)|pattern_buf),where);
7042  printf("Error in file: Position %ld \n",file_position);
7043  printf("Record # %ld Record size %ld kb \n",recnum,recsize/1024);
7044  printf("where %8.8llx loop %ld\n",where,i);
7045 #else
7046  printf("Error in file: Found ?%llx? Expecting ?%llx? addr %lx\n",*where, (long long)((pattern_buf<<32)|pattern_buf),((long)where));
7047  printf("Error in file: Position %lld \n",file_position);
7048  printf("Record # %lld Record size %lld kb \n",recnum,recsize/1024);
7049  printf("where %8.8lx loop %lld\n",(long)where,(long long)i);
7050 #endif
7051  return(1);
7052  }
7053  where+=(page_size/sizeof(long long));
7054  }
7055  }
7056  if(sverify == 0)
7057  {
7058  for(i=0;i<(length/cache_line_size);i++)
7059  {
7060  for(j=0;j<(cache_line_size/sizeof(long long));j++)
7061  {
7062  if(diag_v)
7063  {
7064  pattern_buf=mpattern;
7065  }
7066  else
7067  {
7068  pattern_buf= mpattern<<32 | mpattern;
7069  }
7070 
7071  pattern_ptr =(char *)&pattern_buf;
7072 
7073  if(*where != (unsigned long long)pattern_buf)
7074  {
7075  file_position = (off64_t)( (recnum * recsize))+
7076  ((i*cache_line_size)+(j*sizeof(long long)));
7077  where2=(char *)where;
7078  for(k=0;k<sizeof(long long);k++){
7079  if(*where2 != *pattern_ptr)
7080  break;
7081  where2++;
7082  pattern_ptr++;
7083  }
7084  file_position+=k;
7085  printf("\n\n");
7086 #ifdef NO_PRINT_LLD
7087  printf("Error in file: Position %ld %ld %ld \n",i,j,k);
7088  printf("Error in file: Position %ld \n",file_position);
7089  printf("Record # %ld Record size %ld kb \n",recnum,recsize/1024);
7090 #else
7091  printf("Error in file: Position %lld %lld %lld \n",i,j,k);
7092  printf("Error in file: Position %lld \n",file_position);
7093  printf("Record # %lld Record size %lld kb \n",recnum,recsize/1024);
7094 #endif
7095  printf("Found pattern: Char >>%c<< Expecting >>%c<<\n", *where2,*pattern_ptr);
7096  printf("Found pattern: Hex >>%x<< Expecting >>%x<<\n", *where2,*pattern_ptr);
7097  return(1);
7098  }
7099  where++;
7100  if(diag_v)
7101  mpattern=mpattern+value1;
7102  }
7103  }
7104  }
7105  return(0);
7106 }
unsigned long cache_line_size
Definition: iozone.c:1376
char diag_v
Definition: iozone.c:1304
char verify
Definition: iozone.c:1513
int no_unlink
Definition: iozone.c:1521
char dedup_compress
Definition: iozone.c:1304
void dummy(void *array)
Definition: do_loops.c:306
double c
Definition: multiplex.c:22
int gen_new_buf()
char * dedup_ibuf
Definition: iozone.c:1305
long base_time
Definition: iozone.c:1323
char sverify
Definition: iozone.c:1515
void srand()
long long page_size
Definition: iozone.c:428
unsigned int length
char * dedup_temp
Definition: iozone.c:1306
char dedup
Definition: iozone.c:1304
long long chid
Definition: iozone.c:1529
long long x
Definition: iozone.c:1335
char * buffer
Definition: iozone.c:1366
int share_file
Definition: iozone.c:1309
char dedup_interior
Definition: iozone.c:1304
int rand()
char silent
Definition: iozone.c:1295
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:39
long long off64_t
Definition: iozone.c:357
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:38
int i
Definition: fileop.c:140
Here is the call graph for this function:
Here is the caller graph for this function:

◆ w_traj_size()

long long w_traj_size ( )

Definition at line 19825 of file iozone.c.

19827 {
19828  FILE *fd;
19829  int ret;
19830  long long traj_offset = 0;
19831  long long traj_size = 0;
19832  long long max_offset = 0;
19833  int dummy;
19834  int tokens,lines;
19835  char *ret1;
19836  char buf[200];
19837  char sbuf[200];
19838  char *where;
19839 
19840  lines=0;
19841 
19842  fd=fopen(write_traj_filename,"r");
19843  if(fd == (FILE *)0)
19844  {
19845  printf("Unable to open write telemetry file \"%s\"\n",
19847  exit(174);
19848  }
19849  while(1)
19850  {
19851  tokens=0;
19852  ret1=fgets(buf,200,fd);
19853  if(ret1==(char *)0)
19854  break;
19855  lines++;
19856  where=(char *)&buf[0];
19857  strcpy(sbuf,buf);
19858  if((*where=='#') || (*where=='\n'))
19859  continue;
19860  tokens++;
19861  strtok(where," ");
19862  while( (char *)(strtok( (char *)0," ")) != (char *)0)
19863  {
19864  tokens++;
19865  }
19866  if(tokens==1)
19867  {
19868  printf("\n\tInvalid write telemetry file entry. Line %d\n",
19869  lines);
19870  signal_handler();
19871  }
19872  if(tokens==3)
19873  {
19874 #ifdef NO_PRINT_LLD
19875  ret=sscanf(sbuf,"%ld %ld %d\n",&traj_offset,&traj_size,&dummy);
19876 #else
19877  ret=sscanf(sbuf,"%lld %lld %d",&traj_offset,&traj_size,&dummy);
19878 #endif
19879  }
19880  if(tokens==2)
19881  {
19882 #ifdef NO_PRINT_LLD
19883  ret=sscanf(sbuf,"%ld %ld\n",&traj_offset,&traj_size);
19884 #else
19885  ret=sscanf(sbuf,"%lld %lld\n",&traj_offset,&traj_size);
19886 #endif
19887  }
19888  if(tokens > 3)
19889  {
19890  printf("\n\tInvalid write telemetry file entry. Line %d\n",
19891  lines);
19892  exit(174);
19893  }
19894  if(traj_offset + traj_size > max_offset)
19895  max_offset=traj_offset + traj_size;
19896 
19897  w_traj_ops++;
19898  }
19899  w_traj_fsize=max_offset;
19900 #ifdef DEBUG
19901  printf("File size of write %lld Item count %lld\n",w_traj_fsize,w_traj_ops);
19902 #endif
19903  fclose(fd);
19904  return(max_offset);
19905 }
int fd
Definition: iozone.c:1291
void signal_handler()
Definition: iozone.c:3336
void dummy(void *array)
Definition: do_loops.c:306
long long w_traj_fsize
Definition: iozone.c:1325
long long w_traj_ops
Definition: iozone.c:1325
long long ret
Definition: iozone.c:1346
char write_traj_filename[MAXNAMESIZE]
Definition: iozone.c:1507
volatile int buf[CACHE_FLUSH_BUFFER_SIZE_INTS]
Definition: do_loops.c:12
void exit()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wait()

int wait ( )
Here is the caller graph for this function:

◆ wait_dist_join()

void wait_dist_join ( )

Definition at line 22391 of file iozone.c.

22393 {
22394  wait(0);
22395  if(mdebug)
22396  printf("Master: All children have finished. Sending terminate\n");
22397  terminate_child_async(); /* All children are done, so terminate their async channel */
22398  current_client_number=0; /* start again */
22399 }
int current_client_number
Definition: iozone.c:1528
int mdebug
Definition: iozone.c:1479
int wait()
void terminate_child_async()
Definition: iozone.c:22538
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wait_for_master_go() [1/2]

void wait_for_master_go ( )
Here is the caller graph for this function:

◆ wait_for_master_go() [2/2]

void wait_for_master_go ( long long  chid)

Definition at line 22111 of file iozone.c.

22114 {
22115  struct client_neutral_command *cnc;
22116  struct client_command cc;
22117  bzero(&cc,sizeof(struct client_command));
22118  child_listen(l_sock,sizeof(struct client_neutral_command));
22119  cnc = (struct client_neutral_command *)child_rcv_buf;
22120  sscanf(cnc->c_command,"%d",&cc.c_command);
22121  if(cc.c_command == R_TERMINATE || cc.c_command==R_DEATH)
22122  {
22123  if(cdebug)
22124  {
22125  fprintf(newstdout,"Child %d received terminate on sync channel at barrier !!\n",(int)chid);
22126  fflush(newstdout);
22127  }
22128  exit(1);
22129  }
22130  if(cdebug>=1)
22131  {
22132  fprintf(newstdout,"Child %d return from wait_for_master_go\n",(int)chid);
22133  fflush(newstdout);
22134  }
22135 }
void bzero()
char child_rcv_buf[4096]
Definition: iozone.c:1463
#define R_DEATH
Definition: iozone.c:744
#define R_TERMINATE
Definition: iozone.c:743
char c_command[20]
Definition: iozone.c:656
int l_sock
Definition: iozone.c:1459
int cdebug
Definition: iozone.c:1478
long long chid
Definition: iozone.c:1529
FILE * newstdout
Definition: iozone.c:1475
void child_listen()
void exit()
Here is the call graph for this function:

◆ write_perf_test() [1/2]

void write_perf_test ( )

◆ write_perf_test() [2/2]

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

Definition at line 7258 of file iozone.c.

7264 {
7265  double starttime1;
7266  double writetime[2];
7267  double walltime[2], cputime[2];
7268  double qtime_start,qtime_stop;
7269  double hist_time;
7270  double compute_val = (double)0;
7271 #ifdef unix
7272  double qtime_u_start,qtime_u_stop;
7273  double qtime_s_start,qtime_s_stop;
7274 #endif
7275  long long i,j;
7276  off64_t numrecs64,traj_offset;
7277  off64_t lock_offset=0;
7278  long long Index = 0;
7279  long long file_flags = 0;
7280  long long traj_size;
7281  unsigned long long writerate[2];
7283  int ltest;
7284  char *maddr;
7285  char *wmaddr,*free_addr;
7286  char *pbuff;
7287  char *nbuff;
7288  int fd,wval;
7289 #ifdef ASYNC_IO
7290  struct cache *gc=0;
7291 #else
7292  long long *gc=0;
7293 #endif
7294 
7295  int test_foo;
7296 
7297 #ifdef unix
7298  qtime_u_start=qtime_u_stop=0;
7299  qtime_s_start=qtime_s_stop=0;
7300 #endif
7301  nbuff=wmaddr=free_addr=0;
7302  traj_offset=0;
7303  test_foo=0;
7304  hist_time=qtime_start=qtime_stop=0;
7305  maddr=0;
7306  pbuff=mainbuffer;
7307  if(w_traj_flag)
7308  {
7311  }
7312  else
7313  {
7314  numrecs64 = (kilo64*1024)/reclen;
7316  }
7317 
7318  if(Q_flag && (!wol_opened))
7319  {
7320  wol_opened++;
7321  wqfd=fopen("wol.dat","a");
7322  if(wqfd==0)
7323  {
7324  printf("Unable to open wol.dat\n");
7325  exit(40);
7326  }
7327  fprintf(wqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
7328  rwqfd=fopen("rwol.dat","a");
7329  if(rwqfd==0)
7330  {
7331  printf("Unable to open rwol.dat\n");
7332  exit(41);
7333  }
7334  fprintf(rwqfd,"Offset in Kbytes Latency in microseconds Transfer size in bytes\n");
7335  }
7336  fd = 0;
7337  if(oflag)
7338  file_flags = O_RDWR|O_SYNC;
7339  else
7340  file_flags = O_RDWR;
7341 #if defined(O_DSYNC)
7342  if(odsync)
7343  file_flags |= O_DSYNC;
7344 #endif
7345 #if defined(_HPUX_SOURCE) || defined(linux) || defined(__FreeBSD__) || defined(__DragonFly__)
7346  if(read_sync)
7347  file_flags |=O_RSYNC|O_SYNC;
7348 #endif
7349 
7350 #if ! defined(DONT_HAVE_O_DIRECT)
7351 #if defined(linux) || defined(__AIX__) || defined(IRIX) || defined(IRIX64) || defined(Windows) || defined (__FreeBSD__)
7352  if(direct_flag)
7353  file_flags |=O_DIRECT;
7354 #endif
7355 #if defined(TRU64)
7356  if(direct_flag)
7357  file_flags |=O_DIRECTIO;
7358 #endif
7359 #endif
7360 
7361 /* Sanity check */
7362 /* Some filesystems do not behave correctly and fail
7363  * when this sequence is performned. This is a very
7364  * bad thing. It breaks many applications and lurks
7365  * around quietly. This code should never get
7366  * triggered, but in the case of running iozone on
7367  * an NFS client, the filesystem type on the server
7368  * that is being exported can cause this failure.
7369  * If this failure happens, then the NFS client is
7370  * going to going to have problems, but the acutal
7371  * problem is the filesystem on the NFS server.
7372  * It's not NFS, it's the local filesystem on the
7373  * NFS server that is not correctly permitting
7374  * the sequence to function.
7375  */
7376 /* _SUA_ Services for Unix Applications, under Windows
7377  does not have a truncate, so this must be skipped */
7378 #if !defined(_SUA_)
7379  if((fd = I_OPEN(filename, (int)O_CREAT|O_WRONLY,0))<0)
7380  {
7381  printf("\nCan not open temp file: %s\n",
7382  filename);
7383  perror("open");
7384  exit(44);
7385  }
7386  if(!notruncate)
7387  {
7389  {
7390  wval=ftruncate(fd,0);
7391  if(wval < 0)
7392  {
7393  printf("\n\nSanity check failed. Do not deploy this filesystem in a production environment !\n");
7394  exit(44);
7395  }
7396  }
7397  close(fd);
7398 
7400  unlink(filename);
7401  }
7402 /* Sanity check */
7403 
7404 #endif
7405  if(noretest)
7406  ltest=1;
7407  else
7408  ltest=2;
7409 
7410  for( j=0; j<ltest; j++)
7411  {
7412  if(cpuutilflag)
7413  {
7414  walltime[j] = time_so_far();
7415  cputime[j] = cputime_so_far();
7416  }
7417  if(Uflag) /* Unmount and re-mount the mountpoint */
7418  {
7420  }
7421  if(j==0)
7422  {
7423 #if defined(Windows)
7424  if(unbuffered)
7425  {
7426  hand=CreateFile(filename,
7427  GENERIC_READ|GENERIC_WRITE,
7428  FILE_SHARE_WRITE|FILE_SHARE_READ,
7429  NULL,OPEN_ALWAYS,FILE_FLAG_NO_BUFFERING|
7430  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
7431  NULL);
7432  }
7433  else
7434  {
7435 #endif
7436  if(!notruncate)
7437  {
7438  if((fd = I_CREAT(filename, 0640))<0)
7439  {
7440  printf("\nCan not create temp file: %s\n",
7441  filename);
7442  perror("creat");
7443  exit(42);
7444  }
7445  }
7446 #if defined(Windows)
7447  }
7448 #endif
7449  }
7450 #if defined(Windows)
7451  if(unbuffered)
7452  CloseHandle(hand);
7453  else
7454  {
7455 #endif
7456  if(fd)
7457  close(fd);
7458 #if defined(Windows)
7459  }
7460 #endif
7461 
7462 #if defined(Windows)
7463  if(unbuffered)
7464  {
7465  hand=CreateFile(filename,
7466  GENERIC_READ|GENERIC_WRITE,
7467  FILE_SHARE_WRITE|FILE_SHARE_READ,
7468  NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING|
7469  FILE_FLAG_WRITE_THROUGH|FILE_FLAG_POSIX_SEMANTICS,
7470  NULL);
7471  }
7472  else
7473  {
7474 #endif
7475  if((fd = I_OPEN(filename, (int)file_flags,0))<0)
7476  {
7477  printf("\nCan not open temp file: %s\n",
7478  filename);
7479  perror("open");
7480  exit(44);
7481  }
7482 #if defined(Windows)
7483  }
7484 #endif
7485 #ifdef VXFS
7486  if(direct_flag)
7487  {
7488  ioctl(fd,VX_SETCACHE,VX_DIRECT);
7489  ioctl(fd,VX_GETCACHE,&test_foo);
7490  if(test_foo == 0)
7491  {
7492  if(!client_iozone)
7493  printf("\nVxFS advanced setcache feature not available.\n");
7494  exit(3);
7495  }
7496  }
7497 #endif
7498 #if defined(solaris)
7499  if(direct_flag)
7500  {
7501  test_foo = directio(fd, DIRECTIO_ON);
7502  if(test_foo != 0)
7503  {
7504  if(!client_iozone)
7505  printf("\ndirectio not available.\n");
7506  exit(3);
7507  }
7508  }
7509 #endif
7510 
7511  if(file_lock)
7512  if(mylockf((int) fd, (int) 1, (int)0)!=0)
7513  printf("File lock for write failed. %d\n",errno);
7514  if(mmapflag)
7515  {
7516  maddr=(char *)initfile(fd,filebytes64,1,PROT_READ|PROT_WRITE);
7517  }
7518  if(mmap_mix)
7519  {
7520  wval=write(fd, pbuff, (size_t) page_size);
7521  if(wval != page_size)
7522  {
7523 #ifdef NO_PRINT_LLD
7524  printf("\nError writing block %ld, fd= %d\n", (long long)0, fd);
7525 #else
7526  printf("\nError writing block %lld, fd= %d\n", (long long)0, fd);
7527 #endif
7528  if(wval==-1)
7529  perror("write");
7530  signal_handler();
7531  }
7532  I_LSEEK(fd,0,SEEK_SET);
7533  };
7534  wval=fsync(fd);
7535  if(wval==-1){
7536  perror("fsync");
7537  signal_handler();
7538  }
7539 #ifdef ASYNC_IO
7540  if(async_flag)
7541  async_init(&gc,fd,direct_flag);
7542 #endif
7543  pbuff=mainbuffer;
7544  if(fetchon)
7545  fetchit(pbuff,reclen);
7546  if(verify || dedup || dedup_interior)
7547  fill_buffer(pbuff,reclen,(long long)pattern,sverify,(long long)0);
7548  starttime1 = time_so_far();
7549 #ifdef unix
7550  if(Q_flag)
7551  {
7552  qtime_u_start=utime_so_far();
7553  qtime_s_start=stime_so_far();
7554  }
7555 #endif
7556  if(w_traj_flag)
7557  {
7558  rewind(w_traj_fd);
7559  }
7560  compute_val=(double)0;
7563  for(i=0; i<numrecs64; i++){
7564  if(w_traj_flag)
7565  {
7566  traj_offset=get_traj(w_traj_fd, (long long *)&traj_size,(float *)&compute_time,(long)1);
7567  reclen=traj_size;
7568 #if defined(Windows)
7569  if(unbuffered)
7570  SetFilePointer(hand,(LONG)traj_offset,0,FILE_BEGIN);
7571  else
7572 #endif
7573  I_LSEEK(fd,traj_offset,SEEK_SET);
7574  }
7575  if(Q_flag)
7576  {
7577 #if defined(Windows)
7578  if(unbuffered)
7579  traj_offset=SetFilePointer(hand,(LONG)0,0,FILE_CURRENT);
7580  else
7581 #endif
7582  traj_offset=I_LSEEK(fd,0,SEEK_CUR);
7583  }
7584  if(rlocking)
7585  {
7586  lock_offset=I_LSEEK(fd,0,SEEK_CUR);
7587  mylockr((int) fd, (int) 1, (int)0,
7588  lock_offset, reclen);
7589  }
7590  if((verify && diag_v) || dedup || dedup_interior)
7591  fill_buffer(pbuff,reclen,(long long)pattern,sverify,i);
7592  if(compute_flag)
7593  compute_val+=do_compute(compute_time);
7594  if(multi_buffer)
7595  {
7596  Index +=reclen;
7597  if(Index > (MAXBUFFERSIZE-reclen))
7598  Index=0;
7599  pbuff = mbuffer + Index;
7600  if(verify || dedup || dedup_interior)
7601  fill_buffer(pbuff,reclen,(long long)pattern,sverify,(long long)0);
7602  }
7603  if(async_flag && no_copy_flag)
7604  {
7605  free_addr=nbuff=(char *)malloc((size_t)reclen+page_size);
7606  nbuff=(char *)(((long)nbuff+(long)page_size) & (long)~(page_size-1));
7607  if(verify || dedup || dedup_interior)
7608  fill_buffer(nbuff,reclen,(long long)pattern,sverify,i);
7609  if(purge)
7610  purgeit(nbuff,reclen);
7611  }
7612  if(purge)
7613  purgeit(pbuff,reclen);
7614  if(Q_flag || hist_summary)
7615  {
7616  qtime_start=time_so_far();
7617  }
7618  if(mmapflag)
7619  {
7620  wmaddr = &maddr[i*reclen];
7621  fill_area((long long*)pbuff,(long long*)wmaddr,(long long)reclen);
7622  if(!mmapnsflag)
7623  {
7624  if(mmapasflag)
7625  msync(wmaddr,(size_t)reclen,MS_ASYNC);
7626  if(mmapssflag)
7627  msync(wmaddr,(size_t)reclen,MS_SYNC);
7628  }
7629  }
7630  else
7631  {
7632  if(async_flag)
7633  {
7634  if(no_copy_flag)
7635  async_write_no_copy(gc, (long long)fd, nbuff, reclen, (i*reclen), depth,free_addr);
7636  else
7637  async_write(gc, (long long)fd, pbuff, reclen, (i*reclen), depth);
7638  }
7639  else
7640  {
7641 #if defined(Windows)
7642  if(unbuffered)
7643  {
7644  WriteFile(hand, pbuff, reclen,(LPDWORD)&wval,
7645  0);
7646  }
7647  else
7648  {
7649 #endif
7650  wval=write(fd, pbuff, (size_t ) reclen);
7651  if(wval != reclen)
7652  {
7653 #ifdef NO_PRINT_LLD
7654  printf("\nError writing block %ld, fd= %d\n", i,
7655  fd);
7656 #else
7657  printf("\nError writing block %lld, fd= %d\n", i,
7658  fd);
7659 #endif
7660  if(wval == -1)
7661  perror("write");
7662  signal_handler();
7663  }
7664 #if defined(Windows)
7665  }
7666 #endif
7667  }
7668  }
7669  if(hist_summary)
7670  {
7671  qtime_stop=time_so_far();
7672  hist_time =(qtime_stop-qtime_start-time_res);
7673  hist_insert(hist_time);
7674  }
7675  if(Q_flag)
7676  {
7677  qtime_stop=time_so_far();
7678  if(j==0)
7679 #ifdef NO_PRINT_LLD
7680  fprintf(wqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((qtime_stop-qtime_start-time_res))*1000000,reclen);
7681  else
7682  fprintf(rwqfd,"%10.1ld %10.0f %10.1ld\n",(traj_offset)/1024,((qtime_stop-qtime_start-time_res))*1000000,reclen);
7683 #else
7684  fprintf(wqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((qtime_stop-qtime_start-time_res))*1000000,reclen);
7685  else
7686  fprintf(rwqfd,"%10.1lld %10.0f %10.1lld\n",(traj_offset)/1024,((qtime_stop-qtime_start-time_res))*1000000,reclen);
7687 #endif
7688  }
7691  if(rlocking)
7692  {
7693  mylockr((int) fd, (int) 0, (int)0,
7694  lock_offset, reclen);
7695  }
7696  }
7697 #ifdef unix
7698  if(Q_flag)
7699  {
7700  qtime_u_stop=utime_so_far();
7701  qtime_s_stop=stime_so_far();
7702  if(j==0)
7703  fprintf(wqfd,"\nSystem time %10.3f User time %10.3f Real %10.3f (seconds)\n",
7704  (qtime_s_stop-qtime_s_start)/sc_clk_tck,
7705  (qtime_u_stop-qtime_u_start)/sc_clk_tck,
7706  time_so_far()-starttime1);
7707  else
7708  fprintf(rwqfd,"\nSystem time %10.3f User time %10.3f Real %10.3f (seconds)\n",
7709  (qtime_s_stop-qtime_s_start)/sc_clk_tck,
7710  (qtime_u_stop-qtime_u_start)/sc_clk_tck,
7711  time_so_far()-starttime1);
7712  }
7713 #endif
7714 
7715 #ifdef ASYNC_IO
7716  if(async_flag)
7717  {
7718  end_async(gc);
7719  gc=0;
7720  }
7721 #endif
7722  if(include_flush)
7723  {
7724  if(mmapflag){
7725  msync(maddr,(size_t)filebytes64,MS_SYNC);
7726  }
7727  else
7728  {
7729  wval=fsync(fd);
7730  if(wval==-1){
7731  perror("fsync");
7732  signal_handler();
7733  }
7734  }
7735  }
7736  if(file_lock)
7737  if(mylockf((int) fd,(int)0,(int)0))
7738  printf("Unlock failed %d\n",errno);
7739  if(include_close)
7740  {
7741  if(mmapflag)
7742  {
7743  mmap_end(maddr,(unsigned long long)filebytes64);
7744  }
7745 #if defined(Windows)
7746  if(unbuffered)
7747  CloseHandle(hand);
7748  else
7749 #endif
7750  wval=close(fd);
7751  if(wval==-1){
7752  perror("close");
7753  signal_handler();
7754  }
7755  }
7756  writetime[j] = ((time_so_far() - starttime1)-time_res)
7757  -compute_val;
7758  if(writetime[j] < (double).000001)
7759  {
7760  writetime[j]=time_res;
7761  if(rec_prob < reclen)
7762  rec_prob = reclen;
7763  res_prob=1;
7764  }
7765  if(!include_close)
7766  {
7767  if(mmapflag)
7768  msync(maddr,(size_t)filebytes64,MS_SYNC);/* Clean up before read starts */
7769  else
7770  {
7771  wval=fsync(fd);
7772  if(wval==-1){
7773  perror("fsync");
7774  signal_handler();
7775  }
7776  }
7777  if(mmapflag)
7778  {
7779  mmap_end(maddr,(unsigned long long)filebytes64);
7780  }
7781 #if defined(Windows)
7782  if(unbuffered)
7783  CloseHandle(hand);
7784  else
7785 #endif
7786  wval=close(fd);
7787  if(wval==-1){
7788  perror("close");
7789  signal_handler();
7790  }
7791  }
7792  if(cpuutilflag)
7793  {
7794  cputime[j] = cputime_so_far() - cputime[j];
7795  if (cputime[j] < cputime_res)
7796  cputime[j] = 0.0;
7797  walltime[j] = time_so_far() - walltime[j];
7798  if (walltime[j] < cputime[j])
7799  walltime[j] = cputime[j];
7800  }
7801  if(restf)
7802  sleep((int)rest_val);
7803  }
7804  if(OPS_flag || MS_flag){
7806  /*filebytes64=filebytes64/reclen;*/
7807  }else
7809 
7810  for(j=0;j<ltest;j++)
7811  {
7812  if(MS_flag)
7813  {
7814  writerate[j]=1000000.0*(writetime[j] / (double)filebytes64);
7815  continue;
7816  }
7817  else
7818  {
7819  writerate[j] =
7820  (unsigned long long) ((double) filebytes64 / writetime[j]);
7821  }
7822  if(!(OPS_flag || MS_flag))
7823  writerate[j] >>= 10;
7824  }
7825  data1[0]=writerate[0];
7826  if(noretest)
7827  {
7828  writerate[1]=(long long) 0;
7829  if(cpuutilflag)
7830  {
7831  walltime[1]=0.0;
7832  cputime[1]=0.0;
7833  }
7834  }
7835  /* Must save walltime & cputime before calling store_value() for each/any cell.*/
7836  if(cpuutilflag)
7837  store_times(walltime[0], cputime[0]);
7838  store_value((off64_t)writerate[0]);
7839  if(cpuutilflag)
7840  store_times(walltime[1], cputime[1]);
7841  store_value((off64_t)writerate[1]);
7842 #ifdef NO_PRINT_LLD
7843  if(!silent) printf("%8ld",writerate[0]);
7844  if(!silent) printf("%8ld",writerate[1]);
7845  if(!silent) fflush(stdout);
7846 #else
7847  if(!silent) printf("%8lld",writerate[0]);
7848  if(!silent) printf("%8lld",writerate[1]);
7849  if(!silent) fflush(stdout);
7850 #endif
7851 }
int check_filename()
void end_async()
char wol_opened
Definition: iozone.c:1341
long long depth
Definition: iozone.c:1536
void fetchit()
void purgeit()
store_times(double walltime, double cputime)
Definition: iozone.c:11551
long long rec_prob
Definition: iozone.c:1294
int w_traj_flag
Definition: iozone.c:1523
char compute_flag
Definition: iozone.c:1520
char diag_v
Definition: iozone.c:1304
store_value(off64_t value)
Definition: iozone.c:11518
void mmap_end()
long long get_traj()
char verify
Definition: iozone.c:1513
size_t async_write()
Definition: iozone.c:19038
long long w_traj_bytes_completed
Definition: iozone.c:1327
FILE * rwqfd
Definition: iozone.c:1342
void fill_buffer()
char mmapflag
Definition: iozone.c:1512
int fd
Definition: iozone.c:1291
int restf
Definition: iozone.c:1514
void signal_handler()
Definition: iozone.c:3336
char filename[MAXNAMESIZE]
Definition: iozone.c:1360
long long multi_buffer
Definition: iozone.c:1290
#define I_LSEEK(x, y, z)
Definition: iozone.c:1182
#define I_OPEN(x, y, z)
Definition: iozone.c:1183
long long w_traj_ops_completed
Definition: iozone.c:1327
long long reclen
Definition: iozone.c:1535
char read_sync
Definition: iozone.c:1295
long long w_traj_fsize
Definition: iozone.c:1325
int mylockf()
float compute_time
Definition: iozone.c:1538
void async_init()
Definition: iozone.c:19044
char Uflag
Definition: iozone.c:1329
char * mbuffer
Definition: iozone.c:1366
char client_iozone
Definition: iozone.c:1296
char noretest
Definition: iozone.c:1510
char MS_flag
Definition: iozone.c:1525
char cpuutilflag
Definition: iozone.c:1321
off64_t filebytes64
Definition: iozone.c:1281
char include_flush
Definition: iozone.c:1519
char sverify
Definition: iozone.c:1515
ssize_t write(int fd, const void *buf, size_t count)
Definition: appio.c:298
char unbuffered
Definition: iozone.c:1509
char * initfile()
long long page_size
Definition: iozone.c:428
int file_lock
Definition: iozone.c:1530
long long purge
Definition: iozone.c:1533
char async_flag
Definition: iozone.c:1512
char mmapasflag
Definition: iozone.c:1512
size_t async_write_no_copy()
Definition: iozone.c:19032
char * mainbuffer
Definition: iozone.c:1366
long long w_traj_ops
Definition: iozone.c:1325
char odsync
Definition: iozone.c:1516
fill_area(long long *src_buffer, long long *dest_buffer, long long length)
Definition: iozone.c:19014
char dedup
Definition: iozone.c:1304
purge_buffer_cache()
Definition: iozone.c:12274
FILE * wqfd
Definition: iozone.c:1342
#define MAXBUFFERSIZE
Definition: iozone.c:809
off64_t numrecs64
Definition: iozone.c:1534
char notruncate
Definition: iozone.c:1511
char mmapssflag
Definition: iozone.c:1512
char dedup_interior
Definition: iozone.c:1304
long long fetchon
Definition: iozone.c:1533
unsigned int pattern
Definition: iozone.c:1531
float do_compute()
int close()
FILE * w_traj_fd
Definition: iozone.c:1367
#define cputime_so_far()
Definition: iozone.c:973
int mylockr()
char oflag
Definition: iozone.c:1509
#define I_CREAT(x, y)
Definition: iozone.c:1184
char silent
Definition: iozone.c:1295
char Q_flag
Definition: iozone.c:1517
long long res_prob
Definition: iozone.c:1294
char no_copy_flag
Definition: iozone.c:1519
static double time_so_far()
Definition: iozone.c:6844
char include_close
Definition: iozone.c:1519
void hist_insert()
char OPS_flag
Definition: iozone.c:1517
int unlink()
void exit()
int rlocking
Definition: iozone.c:1308
char mmapnsflag
Definition: iozone.c:1512
int fsync()
double cputime_res
Definition: iozone.c:1271
long long rest_val
Definition: iozone.c:1540
char mmap_mix
Definition: iozone.c:1512
long long off64_t
Definition: iozone.c:357
int errno
int i
Definition: fileop.c:140
int direct_flag
Definition: iozone.c:1527
int hist_summary
Definition: iozone.c:1300
double time_res
Definition: iozone.c:1271
Here is the call graph for this function:

Variable Documentation

◆ a_port

int a_port

Definition at line 1454 of file iozone.c.

◆ advise_flag

int advise_flag

Definition at line 1526 of file iozone.c.

◆ advise_op

int advise_op

Definition at line 1526 of file iozone.c.

◆ aflag

char aflag

Definition at line 1303 of file iozone.c.

◆ aggflag

int aggflag

Definition at line 1480 of file iozone.c.

◆ argcsave

int argcsave

Definition at line 1392 of file iozone.c.

◆ argvsave

char** argvsave

Definition at line 1393 of file iozone.c.

◆ async_flag

char async_flag

Definition at line 1512 of file iozone.c.

◆ auto_mode

long long auto_mode

Definition at line 1290 of file iozone.c.

◆ barray

char* barray[MAXSTREAMS]

Definition at line 1287 of file iozone.c.

◆ base_time

long base_time

Definition at line 1323 of file iozone.c.

◆ begin_proc

int begin_proc

Definition at line 1293 of file iozone.c.

◆ bif_column

int bif_column

Definition at line 1298 of file iozone.c.

◆ bif_fd

int bif_fd

Definition at line 1297 of file iozone.c.

◆ bif_filename

char bif_filename[MAXNAMESIZE]

Definition at line 1359 of file iozone.c.

◆ bif_flag

char bif_flag

Definition at line 1307 of file iozone.c.

◆ bif_row

int bif_row

Definition at line 1298 of file iozone.c.

◆ bucket_val

long long bucket_val[BUCKETS]
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.

◆ buckets

long long buckets[BUCKETS]

Definition at line 24212 of file iozone.c.

◆ buffer

char* buffer

Definition at line 1366 of file iozone.c.

◆ buffer1

char * buffer1

Definition at line 1366 of file iozone.c.

◆ build_name

char* build_name = NAME

Definition at line 1316 of file iozone.c.

◆ c_port

int c_port

Definition at line 1454 of file iozone.c.

◆ cache_line_size

unsigned long cache_line_size =CACHE_LINE_SIZE

Definition at line 1376 of file iozone.c.

◆ cache_size

unsigned long cache_size =CACHE_SIZE

Definition at line 1375 of file iozone.c.

◆ cdebug

int cdebug = 0

Definition at line 1478 of file iozone.c.

◆ Cflag

char Cflag

Definition at line 1371 of file iozone.c.

◆ chid

long long chid

Definition at line 1529 of file iozone.c.

◆ child_async_port

int child_async_port

Definition at line 1456 of file iozone.c.

◆ child_async_rcv_buf

char child_async_rcv_buf[4096]

Definition at line 1464 of file iozone.c.

◆ child_async_sock

struct sockaddr_in child_sync_sock child_async_sock

Definition at line 1481 of file iozone.c.

◆ child_idents

struct child_ident child_idents[MAXSTREAMS]

◆ child_listen_socket

int child_listen_socket

Definition at line 1467 of file iozone.c.

◆ child_listen_socket_async

int child_listen_socket_async

Definition at line 1468 of file iozone.c.

◆ child_port

int child_port

Definition at line 1455 of file iozone.c.

◆ child_rcv_buf

char child_rcv_buf[4096]

Definition at line 1463 of file iozone.c.

◆ child_send_buf

char child_send_buf[4096]

Definition at line 1465 of file iozone.c.

◆ child_send_socket

int child_send_socket

Definition at line 1466 of file iozone.c.

◆ child_stat

struct child_stats* child_stat

◆ childids

long long childids[MAXSTREAMS+1]

Definition at line 1335 of file iozone.c.

◆ client_error

int client_error

Definition at line 1398 of file iozone.c.

◆ client_filename

char client_filename[256]

Definition at line 1396 of file iozone.c.

◆ client_iozone

char client_iozone

Definition at line 1296 of file iozone.c.

◆ client_listen_pid

int client_listen_pid

Definition at line 1457 of file iozone.c.

◆ clients_found

int clients_found

Definition at line 1474 of file iozone.c.

◆ command_line

char command_line[1024] = "\0"

Definition at line 1387 of file iozone.c.

◆ compute_flag

char compute_flag

Definition at line 1520 of file iozone.c.

◆ compute_time

float compute_time

Definition at line 1538 of file iozone.c.

◆ controlling_host_name

char controlling_host_name[100]

Definition at line 1493 of file iozone.c.

◆ controlling_host_port

int controlling_host_port = HOST_LIST_PORT

Definition at line 1410 of file iozone.c.

◆ cputime_res

double cputime_res

Definition at line 1271 of file iozone.c.

◆ cpuutilflag

char cpuutilflag

Definition at line 1321 of file iozone.c.

◆ current_client_number

int current_client_number

Definition at line 1528 of file iozone.c.

◆ current_x

short current_x

Definition at line 1273 of file iozone.c.

◆ current_y

short current_y

Definition at line 1273 of file iozone.c.

◆ debug

long long debug =0

Definition at line 1374 of file iozone.c.

◆ debug1

long long debug1 =0

Definition at line 1373 of file iozone.c.

◆ dedup

char dedup

Definition at line 1304 of file iozone.c.

◆ dedup_compress

char dedup_compress

Definition at line 1304 of file iozone.c.

◆ dedup_ibuf

char* dedup_ibuf

Definition at line 1305 of file iozone.c.

◆ dedup_interior

char dedup_interior

Definition at line 1304 of file iozone.c.

◆ dedup_mseed

int dedup_mseed = 1

Definition at line 1299 of file iozone.c.

◆ dedup_temp

char* dedup_temp

Definition at line 1306 of file iozone.c.

◆ default_filename

char* default_filename ="iozone.tmp"

Definition at line 1369 of file iozone.c.

◆ delay

long long delay

Definition at line 1533 of file iozone.c.

◆ delay_start

long long delay_start

Definition at line 1536 of file iozone.c.

◆ depth

long long depth

Definition at line 1536 of file iozone.c.

◆ diag_v

char diag_v

Definition at line 1304 of file iozone.c.

◆ direct_flag

int direct_flag

Definition at line 1527 of file iozone.c.

◆ disrupt_flag

char disrupt_flag

Definition at line 1520 of file iozone.c.

◆ distributed

char distributed

Definition at line 1296 of file iozone.c.

◆ dummyfile

char dummyfile[MAXSTREAMS][MAXNAMESIZE]

Definition at line 1362 of file iozone.c.

◆ dummyfile1

char dummyfile1[MAXNAMESIZE]

Definition at line 1363 of file iozone.c.

◆ ecount

int ecount

Definition at line 1310 of file iozone.c.

◆ Eflag

char Eflag

Definition at line 1303 of file iozone.c.

◆ errno

int errno

◆ fd

int fd

Definition at line 1291 of file iozone.c.

◆ fetchon

long long fetchon

Definition at line 1533 of file iozone.c.

◆ fflag

char fflag

Definition at line 1329 of file iozone.c.

◆ file_lock

int file_lock

Definition at line 1530 of file iozone.c.

◆ filearray

char* filearray[MAXSTREAMS]

Definition at line 1364 of file iozone.c.

◆ filebytes64

off64_t filebytes64

Definition at line 1281 of file iozone.c.

◆ filename

char filename[MAXNAMESIZE]

Definition at line 1360 of file iozone.c.

◆ func

void(* func[])()
Initial value:
= {
}
void mix_perf_test()
void read_perf_test()
void fread_perf_test()
void reverse_perf_test()
void random_perf_test()
void fwrite_perf_test()
void write_perf_test()
void read_stride_perf_test()
void rewriterec_perf_test()

Definition at line 1198 of file iozone.c.

◆ gflag

char gflag

Definition at line 1311 of file iozone.c.

◆ goodkilos

unsigned long long goodkilos

Definition at line 1276 of file iozone.c.

◆ goodrecl

long long goodrecl

Definition at line 1278 of file iozone.c.

◆ h_errno

int h_errno

◆ h_flag

char h_flag

Definition at line 1509 of file iozone.c.

◆ haveshm

char* haveshm

Definition at line 1288 of file iozone.c.

◆ head1

char* head1[]
Initial value:
= {
" 'Iozone' Filesystem Benchmark Program",
" ",
" ",
" 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",
" ",
""}
#define THISVERSION
Definition: iozone.c:63
#define MODE
Definition: iozone.c:88

Definition at line 246 of file iozone.c.

◆ help

char* help[]

Definition at line 129 of file iozone.c.

◆ hflag

char hflag

Definition at line 1303 of file iozone.c.

◆ hist_summary

int hist_summary

Definition at line 1300 of file iozone.c.

◆ imon_start

char imon_start[256]

Definition at line 1318 of file iozone.c.

◆ imon_stop

char imon_stop[256]

Definition at line 1318 of file iozone.c.

◆ imon_sync

char imon_sync

Definition at line 1319 of file iozone.c.

◆ include_close

char include_close

Definition at line 1519 of file iozone.c.

◆ include_flush

char include_flush

Definition at line 1519 of file iozone.c.

◆ include_mask

long long include_mask

Definition at line 1332 of file iozone.c.

◆ include_test

long long include_test[50]

Definition at line 1331 of file iozone.c.

◆ include_tflag

char include_tflag

Definition at line 1329 of file iozone.c.

◆ ioz_processor_bind

int ioz_processor_bind

Definition at line 1293 of file iozone.c.

◆ jflag

char jflag

Definition at line 1509 of file iozone.c.

◆ junk

int junk

Definition at line 1402 of file iozone.c.

◆ k_flag

char k_flag

Definition at line 1509 of file iozone.c.

◆ kilobytes64

off64_t kilobytes64 = (off64_t)KILOBYTES

Definition at line 1277 of file iozone.c.

◆ Kplus_flag

char Kplus_flag

Definition at line 1509 of file iozone.c.

◆ Kplus_readers

int Kplus_readers

Definition at line 1506 of file iozone.c.

◆ l_async_sock

int l_async_sock

Definition at line 1459 of file iozone.c.

◆ L_flag

char L_flag =0

Definition at line 1518 of file iozone.c.

◆ l_sock

int l_sock

Definition at line 1459 of file iozone.c.

◆ lflag

char lflag

Definition at line 1329 of file iozone.c.

◆ listener_sync_sock

struct sockaddr_in listener_sync_sock

Definition at line 20343 of file iozone.c.

◆ mainbuffer

char * mainbuffer

Definition at line 1366 of file iozone.c.

◆ master_iozone

char master_iozone

Definition at line 1296 of file iozone.c.

◆ master_join_count

int master_join_count

Definition at line 1458 of file iozone.c.

◆ master_listen_pid

int master_listen_pid

Definition at line 1461 of file iozone.c.

◆ master_listen_port

int master_listen_port

Definition at line 1472 of file iozone.c.

◆ master_listen_socket

int master_listen_socket

Definition at line 1473 of file iozone.c.

◆ master_rcv_buf

char master_rcv_buf[4096]

Definition at line 1460 of file iozone.c.

◆ master_send_async_sockets

int master_send_async_sockets[MAXSTREAMS]

Definition at line 1471 of file iozone.c.

◆ master_send_buf

char master_send_buf[4096]

Definition at line 1462 of file iozone.c.

◆ master_send_socket

int master_send_socket

Definition at line 1469 of file iozone.c.

◆ master_send_sockets

int master_send_sockets[MAXSTREAMS]

Definition at line 1470 of file iozone.c.

◆ max_file_size

off64_t max_file_size = KILOBYTES_END

Definition at line 1379 of file iozone.c.

◆ max_rec_size

long long max_rec_size = RECLEN_END

Definition at line 1381 of file iozone.c.

◆ max_x

long long max_x

Definition at line 1275 of file iozone.c.

◆ max_y

long long max_y

Definition at line 1275 of file iozone.c.

◆ maximum_file_size

off64_t maximum_file_size

Definition at line 1356 of file iozone.c.

◆ maxt

long long maxt

Definition at line 1324 of file iozone.c.

◆ mbuffer

char * mbuffer

Definition at line 1366 of file iozone.c.

◆ mdebug

int mdebug = 0

Definition at line 1479 of file iozone.c.

◆ mfflag

char mfflag

Definition at line 1334 of file iozone.c.

◆ mflag

char mflag

Definition at line 1509 of file iozone.c.

◆ min_file_size

off64_t min_file_size = KILOBYTES_START

Definition at line 1378 of file iozone.c.

◆ min_rec_size

long long min_rec_size = RECLEN_START

Definition at line 1380 of file iozone.c.

◆ minimum_file_size

off64_t minimum_file_size

Definition at line 1357 of file iozone.c.

◆ mint

long long mint

Definition at line 1324 of file iozone.c.

◆ mmap_mix

char mmap_mix

Definition at line 1512 of file iozone.c.

◆ mmapasflag

char mmapasflag

Definition at line 1512 of file iozone.c.

◆ mmapflag

char mmapflag

Definition at line 1512 of file iozone.c.

◆ mmapnsflag

char mmapnsflag

Definition at line 1512 of file iozone.c.

◆ mmapssflag

char mmapssflag

Definition at line 1512 of file iozone.c.

◆ mountname

char mountname[MAXNAMESIZE]

Definition at line 1361 of file iozone.c.

◆ MS_flag

char MS_flag

Definition at line 1525 of file iozone.c.

◆ mt

unsigned long long mt[NN]
static

Definition at line 23882 of file iozone.c.

◆ mti

int mti =NN+1
static

Definition at line 23884 of file iozone.c.

◆ multi_buffer

long long multi_buffer

Definition at line 1290 of file iozone.c.

◆ multiplier

int multiplier = MULTIPLIER

Definition at line 1539 of file iozone.c.

◆ mygen

int mygen

Definition at line 1524 of file iozone.c.

◆ myid

long long myid

Definition at line 1335 of file iozone.c.

◆ nap_once

int nap_once

Definition at line 19086 of file iozone.c.

◆ nap_res

double nap_res

Definition at line 19087 of file iozone.c.

◆ newstderr

FILE * newstderr

Definition at line 1475 of file iozone.c.

◆ newstdin

FILE* newstdin

Definition at line 1475 of file iozone.c.

◆ newstdout

FILE * newstdout

Definition at line 1475 of file iozone.c.

◆ next64

off64_t next64

Definition at line 1340 of file iozone.c.

◆ nflag

char nflag

Definition at line 1311 of file iozone.c.

◆ no_copy_flag

char no_copy_flag

Definition at line 1519 of file iozone.c.

◆ no_unlink

int no_unlink = 0

Definition at line 1521 of file iozone.c.

◆ no_write

int no_write = 0

Definition at line 1522 of file iozone.c.

◆ NOCROSSflag

char NOCROSSflag

Definition at line 1333 of file iozone.c.

◆ noretest

char noretest

Definition at line 1510 of file iozone.c.

◆ notruncate

char notruncate

Definition at line 1511 of file iozone.c.

◆ num_child

long long num_child

Definition at line 1335 of file iozone.c.

◆ num_processors

int num_processors

Definition at line 1293 of file iozone.c.

◆ numrecs64

off64_t numrecs64 = (off64_t)NUMRECS

Definition at line 1534 of file iozone.c.

◆ odsync

char odsync = 0

Definition at line 1516 of file iozone.c.

◆ offset

off64_t offset = 0

Definition at line 1279 of file iozone.c.

◆ offset64

off64_t offset64 = 0

Definition at line 1280 of file iozone.c.

◆ oflag

char oflag

Definition at line 1509 of file iozone.c.

◆ onetime

long long onetime

Definition at line 1290 of file iozone.c.

◆ op_rate

int op_rate

Definition at line 1301 of file iozone.c.

◆ op_rate_flag

int op_rate_flag

Definition at line 1302 of file iozone.c.

◆ OPS_flag

char OPS_flag

Definition at line 1517 of file iozone.c.

◆ optarg

char* optarg

◆ optind

int optind

◆ orig_max_rec_size

long long orig_max_rec_size = RECLEN_END

Definition at line 1383 of file iozone.c.

◆ orig_min_rec_size

long long orig_min_rec_size = RECLEN_START

Definition at line 1382 of file iozone.c.

◆ orig_size

long long orig_size

Definition at line 1274 of file iozone.c.

◆ p_childids

pthread_t p_childids[MAXSTREAMS+1]

Definition at line 1338 of file iozone.c.

◆ page_size

long long page_size = 4096

Definition at line 428 of file iozone.c.

◆ pattern

unsigned int pattern

Definition at line 1531 of file iozone.c.

◆ pbuffer

VOLATILE char* pbuffer

Definition at line 1368 of file iozone.c.

◆ pct_read

int pct_read

Definition at line 1336 of file iozone.c.

◆ pflag

char pflag

Definition at line 1509 of file iozone.c.

◆ pi

FILE* pi

Definition at line 1367 of file iozone.c.

◆ pit_hostname

char pit_hostname[40]

Definition at line 1400 of file iozone.c.

◆ pit_service

char pit_service[8]

Definition at line 1401 of file iozone.c.

◆ proto_version

int proto_version = 25

Definition at line 1486 of file iozone.c.

◆ pstatus

long long* pstatus

Definition at line 1377 of file iozone.c.

◆ purge

long long purge

Definition at line 1533 of file iozone.c.

◆ Q_flag

char Q_flag

Definition at line 1517 of file iozone.c.

◆ qflag

char qflag

Definition at line 1312 of file iozone.c.

◆ r_count

int r_count

Definition at line 1286 of file iozone.c.

◆ r_range

off64_t r_range[100]

Definition at line 1282 of file iozone.c.

◆ r_traj_bytes_completed

long long r_traj_bytes_completed

Definition at line 1326 of file iozone.c.

◆ r_traj_fd

FILE * r_traj_fd

Definition at line 1367 of file iozone.c.

◆ r_traj_flag

int r_traj_flag

Definition at line 1523 of file iozone.c.

◆ r_traj_fsize

long long r_traj_fsize

Definition at line 1325 of file iozone.c.

◆ r_traj_items

int r_traj_items

Definition at line 1328 of file iozone.c.

◆ r_traj_ops

long long r_traj_ops

Definition at line 1325 of file iozone.c.

◆ r_traj_ops_completed

long long r_traj_ops_completed

Definition at line 1326 of file iozone.c.

◆ read_sync

char read_sync

Definition at line 1295 of file iozone.c.

◆ read_traj_filename

char read_traj_filename[MAXNAMESIZE]

Definition at line 1508 of file iozone.c.

◆ rec_prob

long long rec_prob

Definition at line 1294 of file iozone.c.

◆ rec_size_list

struct size_entry* rec_size_list =0

Definition at line 1355 of file iozone.c.

◆ reclen

long long reclen = RECLEN

Definition at line 1535 of file iozone.c.

◆ remote_shell

char remote_shell[256]

Definition at line 1397 of file iozone.c.

◆ report_array

off64_t report_array[MAX_X][MAX_Y]

Definition at line 1269 of file iozone.c.

◆ report_darray

double report_darray[MAX_X][MAXSTREAMS]

Definition at line 1270 of file iozone.c.

◆ res_prob

long long res_prob

Definition at line 1294 of file iozone.c.

◆ rest_val

long long rest_val

Definition at line 1540 of file iozone.c.

◆ restf

int restf

Definition at line 1514 of file iozone.c.

◆ ret

long long ret

Definition at line 1346 of file iozone.c.

◆ rflag

char rflag

Definition at line 1303 of file iozone.c.

◆ Rflag

char Rflag

Definition at line 1303 of file iozone.c.

◆ rlocking

int rlocking

Definition at line 1308 of file iozone.c.

◆ rol_opened

char rol_opened

Definition at line 1341 of file iozone.c.

◆ rqfd

FILE * rqfd

Definition at line 1342 of file iozone.c.

◆ rrqfd

FILE * rrqfd

Definition at line 1342 of file iozone.c.

◆ runtimes

struct runtime runtimes[MAX_X][MAX_Y]

Definition at line 1330 of file iozone.c.

◆ RWONLYflag

char RWONLYflag

Definition at line 1333 of file iozone.c.

◆ rwqfd

FILE * rwqfd

Definition at line 1342 of file iozone.c.

◆ s_count

int s_count

Definition at line 1286 of file iozone.c.

◆ s_range

off64_t s_range[100]

Definition at line 1283 of file iozone.c.

◆ sent_stop

char sent_stop

Definition at line 1304 of file iozone.c.

◆ seq_mix

char seq_mix

Definition at line 1322 of file iozone.c.

◆ sfd

long long sfd

Definition at line 1290 of file iozone.c.

◆ sflag

char sflag

Definition at line 1303 of file iozone.c.

◆ share_file

int share_file

Definition at line 1309 of file iozone.c.

◆ shmaddr

VOLATILE struct child_stats* shmaddr

Definition at line 1267 of file iozone.c.

◆ silent

char silent

Definition at line 1295 of file iozone.c.

◆ size_list

struct size_entry* size_list =0

Definition at line 1354 of file iozone.c.

◆ sp_buf

char* sp_buf

Definition at line 22795 of file iozone.c.

◆ sp_child_async_sock

struct sockaddr_in sp_child_sync_sock sp_child_async_sock

Definition at line 22793 of file iozone.c.

◆ sp_child_esend_port

int sp_child_esend_port = SP_CHILD_ESEND_PORT

Definition at line 22784 of file iozone.c.

◆ sp_child_listen_port

int sp_child_listen_port = SP_CHILD_LISTEN_PORT

Definition at line 22783 of file iozone.c.

◆ sp_child_mode

int sp_child_mode

Definition at line 22798 of file iozone.c.

◆ sp_command

char sp_command[1024]

Definition at line 22796 of file iozone.c.

◆ sp_count

int sp_count

Definition at line 22799 of file iozone.c.

◆ sp_cret

int sp_cret

Definition at line 22807 of file iozone.c.

◆ sp_crfd

int sp_crfd

Definition at line 1292 of file iozone.c.

◆ sp_csfd

int sp_csfd

Definition at line 1292 of file iozone.c.

◆ sp_dest

char* sp_dest

Definition at line 22781 of file iozone.c.

◆ sp_finish_time

double sp_finish_time

Definition at line 22801 of file iozone.c.

◆ sp_location

char sp_location[256]

Definition at line 22810 of file iozone.c.

◆ sp_master_async_sock

struct sockaddr_in sp_master_sync_sock sp_master_async_sock

Definition at line 22794 of file iozone.c.

◆ sp_master_esend_port

int sp_master_esend_port = SP_MASTER_ESEND_PORT

Definition at line 22787 of file iozone.c.

◆ sp_master_host

char sp_master_host[256]

Definition at line 22809 of file iozone.c.

◆ sp_master_listen_port

int sp_master_listen_port = SP_MASTER_LISTEN_PORT

Definition at line 22786 of file iozone.c.

◆ sp_master_results_port

int sp_master_results_port = SP_MASTER_RESULTS_PORT

Definition at line 22789 of file iozone.c.

◆ sp_mrfd

int sp_mrfd

Definition at line 1292 of file iozone.c.

◆ sp_msfd

int sp_msfd

Definition at line 1292 of file iozone.c.

◆ sp_msize

int sp_msize

Definition at line 22799 of file iozone.c.

◆ sp_my_cs_addr

struct in_addr sp_my_cs_addr

Definition at line 22791 of file iozone.c.

◆ sp_my_ms_addr

struct in_addr sp_my_ms_addr

Definition at line 22792 of file iozone.c.

◆ sp_once

int sp_once

Definition at line 22799 of file iozone.c.

◆ sp_remote_host

char sp_remote_host[256]

Definition at line 22808 of file iozone.c.

◆ sp_remote_shell

char sp_remote_shell[100]

Definition at line 22797 of file iozone.c.

◆ sp_start_time

double sp_start_time

Definition at line 22801 of file iozone.c.

◆ sp_tcount

int sp_tcount

Definition at line 22800 of file iozone.c.

◆ speed_code

int speed_code

Definition at line 1336 of file iozone.c.

◆ splash

void splash

Definition at line 1394 of file iozone.c.

◆ splash_line

int splash_line

Definition at line 1395 of file iozone.c.

◆ status

long long status

Definition at line 1335 of file iozone.c.

◆ stop_flag

VOLATILE char* stop_flag

Definition at line 1537 of file iozone.c.

◆ stoptime

VOLATILE char stoptime

Definition at line 1370 of file iozone.c.

◆ stride

long long stride = STRIDE

Definition at line 1532 of file iozone.c.

◆ stride_flag

char stride_flag

Definition at line 1512 of file iozone.c.

◆ sverify

char sverify = 1

Definition at line 1515 of file iozone.c.

◆ t_count

int t_count = 0

Definition at line 1285 of file iozone.c.

◆ t_range

int t_range[100]

Definition at line 1284 of file iozone.c.

◆ temp_time

double temp_time

Definition at line 1268 of file iozone.c.

◆ test_output

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

Definition at line 1234 of file iozone.c.

◆ test_soutput

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.

◆ tfile

char tfile[] = "iozone"

Definition at line 1365 of file iozone.c.

◆ throughput_array

long long throughput_array[MAX_X]

Definition at line 1272 of file iozone.c.

◆ throughput_tests

char* throughput_tests[]
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.

◆ time_res

double time_res

Definition at line 1271 of file iozone.c.

◆ total_kilos

double total_kilos

Definition at line 1268 of file iozone.c.

◆ total_time

double total_time

Definition at line 1268 of file iozone.c.

◆ totaltime

double totaltime

Definition at line 1268 of file iozone.c.

◆ toutput

char toutput[20][20]

Definition at line 1476 of file iozone.c.

◆ toutputindex

int toutputindex

Definition at line 1477 of file iozone.c.

◆ trflag

char trflag

Definition at line 1320 of file iozone.c.

◆ uflag

char uflag

Definition at line 1329 of file iozone.c.

◆ Uflag

char Uflag

Definition at line 1329 of file iozone.c.

◆ unbuffered

char unbuffered

Definition at line 1509 of file iozone.c.

◆ use_thread

char use_thread = 0

Definition at line 1372 of file iozone.c.

◆ verify

char verify = 1

Definition at line 1513 of file iozone.c.

◆ w_traj_bytes_completed

long long w_traj_bytes_completed

Definition at line 1327 of file iozone.c.

◆ w_traj_fd

FILE * w_traj_fd

Definition at line 1367 of file iozone.c.

◆ w_traj_flag

int w_traj_flag

Definition at line 1523 of file iozone.c.

◆ w_traj_fsize

long long w_traj_fsize

Definition at line 1325 of file iozone.c.

◆ w_traj_items

int w_traj_items

Definition at line 1328 of file iozone.c.

◆ w_traj_ops

long long w_traj_ops

Definition at line 1325 of file iozone.c.

◆ w_traj_ops_completed

long long w_traj_ops_completed

Definition at line 1327 of file iozone.c.

◆ wol_opened

char wol_opened

Definition at line 1341 of file iozone.c.

◆ wqfd

FILE* wqfd

Definition at line 1342 of file iozone.c.

◆ write_traj_filename

char write_traj_filename[MAXNAMESIZE]

Definition at line 1507 of file iozone.c.

◆ x

long long x

Definition at line 1335 of file iozone.c.

◆ X_flag

char X_flag

Definition at line 1520 of file iozone.c.

◆ xflag

char xflag

Definition at line 1520 of file iozone.c.

◆ xover

long long xover = CROSSOVER

Definition at line 1384 of file iozone.c.

◆ y

long long y

Definition at line 1335 of file iozone.c.

◆ yflag

char yflag

Definition at line 1312 of file iozone.c.

◆ Z_flag

char Z_flag

Definition at line 1520 of file iozone.c.