iolog: note type of log
authorJens Axboe <axboe@kernel.dk>
Wed, 14 Mar 2012 10:39:13 +0000 (11:39 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 11 Apr 2013 10:22:34 +0000 (12:22 +0200)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Conflicts:
backend.c
init.c
iolog.h

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

index 9438ffd3b7a8161084547ff5584e6c21d34e99a9..035ba73b1d0e2c3423a1d008e25aabc5face4354 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -1868,9 +1868,9 @@ int fio_backend(void)
                return 0;
 
        if (write_bw_log) {
-               setup_log(&agg_io_log[DDIR_READ], 0);
-               setup_log(&agg_io_log[DDIR_WRITE], 0);
-               setup_log(&agg_io_log[DDIR_TRIM], 0);
+               setup_log(&agg_io_log[DDIR_READ], 0, IO_LOG_TYPE_BW);
+               setup_log(&agg_io_log[DDIR_WRITE], 0, IO_LOG_TYPE_BW);
+               setup_log(&agg_io_log[DDIR_TRIM], 0, IO_LOG_TYPE_BW);
        }
 
        startup_mutex = fio_mutex_init(FIO_MUTEX_LOCKED);
diff --git a/init.c b/init.c
index 7a9284299a6099a69134155f7d9e914de4831b14..90521e5f36dbce8c53eeb37b74840f39ad42864a 100644 (file)
--- a/init.c
+++ b/init.c
@@ -984,14 +984,14 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num)
                goto err;
 
        if (o->write_lat_log) {
-               setup_log(&td->lat_log, o->log_avg_msec);
-               setup_log(&td->slat_log, o->log_avg_msec);
-               setup_log(&td->clat_log, o->log_avg_msec);
+               setup_log(&td->lat_log, o->log_avg_msec, IO_LOG_TYPE_LAT);
+               setup_log(&td->slat_log, o->log_avg_msec, IO_LOG_TYPE_LAT);
+               setup_log(&td->clat_log, o->log_avg_msec, IO_LOG_TYPE_LAT);
        }
        if (o->write_bw_log)
-               setup_log(&td->bw_log, o->log_avg_msec);
+               setup_log(&td->bw_log, o->log_avg_msec, IO_LOG_TYPE_BW);
        if (o->write_iops_log)
-               setup_log(&td->iops_log, o->log_avg_msec);
+               setup_log(&td->iops_log, o->log_avg_msec, IO_LOG_TYPE_IOPS);
 
        if (!o->name)
                o->name = strdup(jobname);
diff --git a/iolog.c b/iolog.c
index b73c208e468e5e948c799d4a2d8d9beb72c60f49..d6473515a1953920ce5bda9d6eb6efb4c7da8d0b 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -495,13 +495,14 @@ int init_iolog(struct thread_data *td)
        return ret;
 }
 
-void setup_log(struct io_log **log, unsigned long avg_msec)
+void setup_log(struct io_log **log, unsigned long avg_msec, int log_type)
 {
        struct io_log *l = malloc(sizeof(*l));
 
        memset(l, 0, sizeof(*l));
        l->nr_samples = 0;
        l->max_samples = 1024;
+       l->log_type = log_type;
        l->log = malloc(l->max_samples * sizeof(struct io_sample));
        l->avg_msec = avg_msec;
        *log = l;
diff --git a/iolog.h b/iolog.h
index 3d140a20070dd1638f9144f53b0604a97a34982c..6068384386af40373c36fc27b7667b6ca2bc8387 100644 (file)
--- a/iolog.h
+++ b/iolog.h
@@ -26,6 +26,14 @@ struct io_sample {
        unsigned int bs;
 };
 
+enum {
+       IO_LOG_TYPE_LAT = 1,
+       IO_LOG_TYPE_CLAT,
+       IO_LOG_TYPE_SLAT,
+       IO_LOG_TYPE_BW,
+       IO_LOG_TYPE_IOPS,
+};
+
 /*
  * Dynamically growing data sample log
  */
@@ -37,6 +45,8 @@ struct io_log {
        unsigned long max_samples;
        struct io_sample *log;
 
+       int log_type;
+
        /*
         * Windowed average, for logging single entries average over some
         * period of time.
@@ -109,7 +119,7 @@ extern void add_bw_sample(struct thread_data *, enum fio_ddir, unsigned int,
 extern void add_iops_sample(struct thread_data *, enum fio_ddir, struct timeval *);
 extern void init_disk_util(struct thread_data *);
 extern void update_rusage_stat(struct thread_data *);
-extern void setup_log(struct io_log **, unsigned long);
+extern void setup_log(struct io_log **, unsigned long, int);
 extern void finish_log(struct thread_data *, struct io_log *, const char *);
 extern void finish_log_named(struct thread_data *, struct io_log *, const char *, const char *);
 extern void __finish_log(struct io_log *, const char *);