From: Jens Axboe Date: Wed, 14 Mar 2012 10:39:13 +0000 (+0100) Subject: iolog: note type of log X-Git-Tag: gfio-0.1~150 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=ea51b956a15dd4aee047233be892bb3607f3adbd iolog: note type of log Signed-off-by: Jens Axboe --- diff --git a/backend.c b/backend.c index 7343286d..7149c115 100644 --- a/backend.c +++ b/backend.c @@ -1623,8 +1623,8 @@ 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_READ], 0, IO_LOG_TYPE_BW); + setup_log(&agg_io_log[DDIR_WRITE], 0, IO_LOG_TYPE_BW); } startup_mutex = fio_mutex_init(0); diff --git a/init.c b/init.c index 61b3d4b1..820c30c5 100644 --- a/init.c +++ b/init.c @@ -846,14 +846,14 @@ 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->lat_log, td->o.log_avg_msec); - setup_log(&td->slat_log, td->o.log_avg_msec); - setup_log(&td->clat_log, td->o.log_avg_msec); + setup_log(&td->lat_log, td->o.log_avg_msec, IO_LOG_TYPE_LAT); + setup_log(&td->slat_log, td->o.log_avg_msec, IO_LOG_TYPE_SLAT); + setup_log(&td->clat_log, td->o.log_avg_msec, IO_LOG_TYPE_CLAT); } if (td->o.write_bw_log) - setup_log(&td->bw_log, td->o.log_avg_msec); + setup_log(&td->bw_log, td->o.log_avg_msec, IO_LOG_TYPE_BW); if (td->o.write_iops_log) - setup_log(&td->iops_log, td->o.log_avg_msec); + setup_log(&td->iops_log, td->o.log_avg_msec, IO_LOG_TYPE_IOPS); if (!td->o.name) td->o.name = strdup(jobname); diff --git a/iolog.c b/iolog.c index 1d61ba23..5d7c5ab7 100644 --- a/iolog.c +++ b/iolog.c @@ -492,13 +492,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 e790e7d6..d00d00c4 100644 --- a/iolog.h +++ b/iolog.h @@ -27,6 +27,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 */ @@ -38,6 +46,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. @@ -110,7 +120,7 @@ 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 update_io_ticks(void); -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 *);