server: start conversion of data structures to network friendly types
authorJens Axboe <axboe@kernel.dk>
Mon, 3 Oct 2011 08:06:44 +0000 (10:06 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 3 Oct 2011 08:06:44 +0000 (10:06 +0200)
Not done yet, but do the basic conversion.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fio.c
fio.h
init.c
iolog.h
stat.c

diff --git a/fio.c b/fio.c
index 0f12888..762303e 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -1230,33 +1230,33 @@ static void *thread_main(void *data)
        td->ts.io_bytes[1] = td->io_bytes[1];
 
        fio_mutex_down(writeout_mutex);
-       if (td->ts.bw_log) {
+       if (td->bw_log) {
                if (td->o.bw_log_file) {
-                       finish_log_named(td, td->ts.bw_log,
+                       finish_log_named(td, td->bw_log,
                                                td->o.bw_log_file, "bw");
                } else
-                       finish_log(td, td->ts.bw_log, "bw");
+                       finish_log(td, td->bw_log, "bw");
        }
-       if (td->ts.lat_log) {
+       if (td->lat_log) {
                if (td->o.lat_log_file) {
-                       finish_log_named(td, td->ts.lat_log,
+                       finish_log_named(td, td->lat_log,
                                                td->o.lat_log_file, "lat");
                } else
-                       finish_log(td, td->ts.lat_log, "lat");
+                       finish_log(td, td->lat_log, "lat");
        }
-       if (td->ts.slat_log) {
+       if (td->slat_log) {
                if (td->o.lat_log_file) {
-                       finish_log_named(td, td->ts.slat_log,
+                       finish_log_named(td, td->slat_log,
                                                td->o.lat_log_file, "slat");
                } else
-                       finish_log(td, td->ts.slat_log, "slat");
+                       finish_log(td, td->slat_log, "slat");
        }
-       if (td->ts.clat_log) {
+       if (td->clat_log) {
                if (td->o.lat_log_file) {
-                       finish_log_named(td, td->ts.clat_log,
+                       finish_log_named(td, td->clat_log,
                                                td->o.lat_log_file, "clat");
                } else
-                       finish_log(td, td->ts.clat_log, "clat");
+                       finish_log(td, td->clat_log, "clat");
        }
        fio_mutex_up(writeout_mutex);
        if (td->o.exec_postrun)
diff --git a/fio.h b/fio.h
index 82dc118..b0307df 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -175,16 +175,11 @@ enum {
 struct thread_stat {
        char *name;
        char *verror;
-       int error;
-       int groupid;
-       pid_t pid;
+       int32_t error;
+       int32_t groupid;
+       uint32_t pid;
        char *description;
-       int members;
-
-       struct io_log *slat_log;
-       struct io_log *clat_log;
-       struct io_log *lat_log;
-       struct io_log *bw_log;
+       uint32_t members;
 
        /*
         * bandwidth and latency stats
@@ -194,7 +189,7 @@ struct thread_stat {
        struct io_stat lat_stat[2];             /* total latency */
        struct io_stat bw_stat[2];              /* bandwidth stats */
 
-       unsigned long long stat_io_bytes[2];
+       uint64_t stat_io_bytes[2];
        struct timeval stat_sample_time[2];
 
        /*
@@ -202,40 +197,40 @@ struct thread_stat {
         */
        struct rusage ru_start;
        struct rusage ru_end;
-       unsigned long usr_time;
-       unsigned long sys_time;
-       unsigned long ctx;
-       unsigned long minf, majf;
+       uint64_t usr_time;
+       uint64_t sys_time;
+       uint64_t ctx;
+       uint64_t minf, majf;
 
        /*
         * IO depth and latency stats
         */
-       unsigned int clat_percentiles;
+       uint64_t clat_percentiles;
        double *percentile_list;
 
-       unsigned int io_u_map[FIO_IO_U_MAP_NR];
-       unsigned int io_u_submit[FIO_IO_U_MAP_NR];
-       unsigned int io_u_complete[FIO_IO_U_MAP_NR];
-       unsigned int io_u_lat_u[FIO_IO_U_LAT_U_NR];
-       unsigned int io_u_lat_m[FIO_IO_U_LAT_M_NR];
-       unsigned int io_u_plat[2][FIO_IO_U_PLAT_NR];
-       unsigned long total_io_u[3];
-       unsigned long short_io_u[3];
-       unsigned long total_submit;
-       unsigned long total_complete;
-
-       unsigned long long io_bytes[2];
-       unsigned long long runtime[2];
-       unsigned long total_run_time;
+       uint32_t io_u_map[FIO_IO_U_MAP_NR];
+       uint32_t io_u_submit[FIO_IO_U_MAP_NR];
+       uint32_t io_u_complete[FIO_IO_U_MAP_NR];
+       uint32_t io_u_lat_u[FIO_IO_U_LAT_U_NR];
+       uint32_t io_u_lat_m[FIO_IO_U_LAT_M_NR];
+       uint32_t io_u_plat[2][FIO_IO_U_PLAT_NR];
+       uint64_t total_io_u[3];
+       uint64_t short_io_u[3];
+       uint64_t total_submit;
+       uint64_t total_complete;
+
+       uint64_t io_bytes[2];
+       uint64_t runtime[2];
+       uint64_t total_run_time;
 
        /*
         * IO Error related stats
         */
-       unsigned continue_on_error;
-       unsigned long total_err_count;
-       int first_error;
+       uint16_t continue_on_error;
+       uint64_t total_err_count;
+       int32_t first_error;
 
-       unsigned int kb_base;
+       uint32_t kb_base;
 };
 
 struct bssplit {
@@ -431,6 +426,12 @@ struct thread_data {
        int thread_number;
        int groupid;
        struct thread_stat ts;
+
+       struct io_log *slat_log;
+       struct io_log *clat_log;
+       struct io_log *lat_log;
+       struct io_log *bw_log;
+
        struct fio_file **files;
        unsigned int files_size;
        unsigned int files_index;
diff --git a/init.c b/init.c
index 8efd7a4..22b9795 100644 (file)
--- a/init.c
+++ b/init.c
@@ -664,12 +664,12 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                goto err;
 
        if (td->o.write_lat_log) {
-               setup_log(&td->ts.lat_log);
-               setup_log(&td->ts.slat_log);
-               setup_log(&td->ts.clat_log);
+               setup_log(&td->lat_log);
+               setup_log(&td->slat_log);
+               setup_log(&td->clat_log);
        }
        if (td->o.write_bw_log)
-               setup_log(&td->ts.bw_log);
+               setup_log(&td->bw_log);
 
        if (!td->o.name)
                td->o.name = strdup(jobname);
diff --git a/iolog.h b/iolog.h
index c35ce1e..fa0a218 100644 (file)
--- a/iolog.h
+++ b/iolog.h
@@ -5,9 +5,9 @@
  * Use for maintaining statistics
  */
 struct io_stat {
-       unsigned long max_val;
-       unsigned long min_val;
-       unsigned long samples;
+       uint64_t max_val;
+       uint64_t min_val;
+       uint64_t samples;
 
        double mean;
        double S;
diff --git a/stat.c b/stat.c
index 3662fd9..998e414 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -954,8 +954,8 @@ void add_clat_sample(struct thread_data *td, enum fio_ddir ddir,
 
        add_stat_sample(&ts->clat_stat[ddir], usec);
 
-       if (ts->clat_log)
-               add_log_sample(td, ts->clat_log, usec, ddir, bs);
+       if (td->clat_log)
+               add_log_sample(td, td->clat_log, usec, ddir, bs);
 
        if (ts->clat_percentiles)
                add_clat_percentile_sample(ts, usec, ddir);
@@ -971,8 +971,8 @@ void add_slat_sample(struct thread_data *td, enum fio_ddir ddir,
 
        add_stat_sample(&ts->slat_stat[ddir], usec);
 
-       if (ts->slat_log)
-               add_log_sample(td, ts->slat_log, usec, ddir, bs);
+       if (td->slat_log)
+               add_log_sample(td, td->slat_log, usec, ddir, bs);
 }
 
 void add_lat_sample(struct thread_data *td, enum fio_ddir ddir,
@@ -985,8 +985,8 @@ void add_lat_sample(struct thread_data *td, enum fio_ddir ddir,
 
        add_stat_sample(&ts->lat_stat[ddir], usec);
 
-       if (ts->lat_log)
-               add_log_sample(td, ts->lat_log, usec, ddir, bs);
+       if (td->lat_log)
+               add_log_sample(td, td->lat_log, usec, ddir, bs);
 }
 
 void add_bw_sample(struct thread_data *td, enum fio_ddir ddir, unsigned int bs,
@@ -1006,8 +1006,8 @@ void add_bw_sample(struct thread_data *td, enum fio_ddir ddir, unsigned int bs,
                        1000 / spent / 1024;
        add_stat_sample(&ts->bw_stat[ddir], rate);
 
-       if (ts->bw_log)
-               add_log_sample(td, ts->bw_log, rate, ddir, bs);
+       if (td->bw_log)
+               add_log_sample(td, td->bw_log, rate, ddir, bs);
 
        fio_gettime(&ts->stat_sample_time[ddir], NULL);
        ts->stat_io_bytes[ddir] = td->this_io_bytes[ddir];