From 01452055af61d6f5de543575dba3ebb0c9e55fab Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 7 Jun 2006 10:29:47 +0200 Subject: [PATCH] [PATCH] Add name=x option to name jobs This makes it easier to see what is going on with large job files. --- README | 1 + fio.c | 10 +++++----- fio.h | 1 + init.c | 10 +++++++++- stat.c | 4 ++-- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/README b/README index 24bf5a00..d27ee875 100644 --- a/README +++ b/README @@ -43,6 +43,7 @@ $ fio The format is as follows: + name=x Use 'x' as the identifier for this job. directory=x Use 'x' as the top level directory for storing files rw=x 'x' may be: read, randread, write, randwrite, rw (read-write mix), randrw (read-write random mix) diff --git a/fio.c b/fio.c index 8ac44522..d3f9cc03 100644 --- a/fio.c +++ b/fio.c @@ -221,7 +221,7 @@ static int check_min_rate(struct thread_data *td, struct timeval *now) rate = (td->this_io_bytes[ddir] - td->rate_bytes) / spent; if (rate < td->ratemin) { - printf("Client%d: min rate %d not met, got %ldKiB/sec\n", td->thread_number, td->ratemin, rate); + printf("%s: min rate %d not met, got %ldKiB/sec\n", td->name, td->ratemin, rate); if (rate_quit) terminate_threads(td->groupid); return 1; @@ -966,10 +966,10 @@ static int create_file(struct thread_data *td, unsigned long long size, if (!extend) { oflags = O_CREAT | O_TRUNC; - printf("Client%d: Laying out IO file (%LuMiB)\n", td->thread_number, size >> 20); + printf("%s: Laying out IO file (%LuMiB)\n", td->name, size >> 20); } else { oflags = O_APPEND; - printf("Client%d: Extending IO file (%Lu -> %LuMiB)\n", td->thread_number, (td->file_size - size) >> 20, td->file_size >> 20); + printf("%s: Extending IO file (%Lu -> %LuMiB)\n", td->name, (td->file_size - size) >> 20, td->file_size >> 20); } td->fd = open(td->file_name, O_WRONLY | oflags, 0644); @@ -1075,13 +1075,13 @@ static int get_file_size(struct thread_data *td) return ret; if (td->file_offset > td->real_file_size) { - fprintf(stderr, "Client%d: offset extends end (%Lu > %Lu)\n", td->thread_number, td->file_offset, td->real_file_size); + fprintf(stderr, "%s: offset extends end (%Lu > %Lu)\n", td->name, td->file_offset, td->real_file_size); return 1; } td->io_size = td->file_size; if (td->io_size == 0) { - fprintf(stderr, "Client%d: no io blocks\n", td->thread_number); + fprintf(stderr, "%s: no io blocks\n", td->name); td_verror(td, EINVAL); return 1; } diff --git a/fio.h b/fio.h index 045fd012..f2e3adf2 100644 --- a/fio.h +++ b/fio.h @@ -102,6 +102,7 @@ struct group_run_stats { }; struct thread_data { + char name[64]; char file_name[256]; char *directory; char verror[80]; diff --git a/init.c b/init.c index d2122e3f..46c51322 100644 --- a/init.c +++ b/init.c @@ -251,10 +251,13 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num) if (write_bw_log) setup_log(&td->bw_log); + if (td->name[0] == '\0') + snprintf(td->name, sizeof(td->name)-1, "client%d", td->thread_number); + ddir = td->ddir + (!td->sequential << 1) + (td->iomix << 2); if (!job_add_num) - printf("Client%d (g=%d): rw=%s, odir=%d, bs=%d-%d, rate=%d, ioengine=%s, iodepth=%d\n", td->thread_number, td->groupid, ddir_str[ddir], td->odirect, td->min_bs, td->max_bs, td->rate, td->io_engine_name, td->iodepth); + printf("%s: (g=%d): rw=%s, odir=%d, bs=%d-%d, rate=%d, ioengine=%s, iodepth=%d\n", td->name, td->groupid, ddir_str[ddir], td->odirect, td->min_bs, td->max_bs, td->rate, td->io_engine_name, td->iodepth); else if (job_add_num == 1) printf("...\n"); @@ -877,6 +880,11 @@ int parse_jobs_ini(char *file) fgetpos(f, &off); continue; } + if (!check_strstore(p, "name", tmpbuf)) { + snprintf(td->name, sizeof(td->name)-1, "%s%d", tmpbuf, td->thread_number); + fgetpos(f, &off); + continue; + } if (!check_str(p, "mem", str_mem_cb, td)) { fgetpos(f, &off); continue; diff --git a/stat.c b/stat.c index 54527169..60d52600 100644 --- a/stat.c +++ b/stat.c @@ -351,7 +351,7 @@ static void show_thread_status(struct thread_data *td, if (!(td->io_bytes[0] + td->io_bytes[1]) && !td->error) return; - printf("Client%d (groupid=%d): err=%2d:\n", td->thread_number, td->groupid, td->error); + printf("%s: (groupid=%d): err=%2d:\n",td->name, td->groupid, td->error); show_ddir_status(td, rs, td->ddir); if (td->io_bytes[td->ddir ^ 1]) @@ -392,7 +392,7 @@ void show_run_stats(void) td = &threads[i]; if (td->error) { - printf("Client%d: %s\n", td->thread_number, td->verror); + printf("%s: %s\n", td->name, td->verror); continue; } -- 2.25.1