From 5a812f9b9d987d1cacbb6f17a65835cbe0d66361 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 14 Mar 2012 11:39:13 +0100 Subject: [PATCH] iolog: note type of log Signed-off-by: Jens Axboe Conflicts: backend.c init.c iolog.h Signed-off-by: Jens Axboe --- backend.c | 6 +++--- init.c | 10 +++++----- iolog.c | 3 ++- iolog.h | 12 +++++++++++- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/backend.c b/backend.c index 9438ffd3..035ba73b 100644 --- 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 7a928429..90521e5f 100644 --- 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 b73c208e..d6473515 100644 --- 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 3d140a20..60683843 100644 --- 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 *); -- 2.25.1