[PATCH] Add name=x option to name jobs
This makes it easier to see what is going on with large job files.
diff --git a/README b/README
index 24bf5a0..d27ee87 100644
--- a/README
+++ b/README
@@ -43,6 +43,7 @@
The <jobs> 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 8ac4452..d3f9cc0 100644
--- a/fio.c
+++ b/fio.c
@@ -221,7 +221,7 @@
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 @@
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 @@
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 045fd01..f2e3adf 100644
--- a/fio.h
+++ b/fio.h
@@ -102,6 +102,7 @@
};
struct thread_data {
+ char name[64];
char file_name[256];
char *directory;
char verror[80];
diff --git a/init.c b/init.c
index d2122e3..46c5132 100644
--- a/init.c
+++ b/init.c
@@ -251,10 +251,13 @@
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 @@
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 5452716..60d5260 100644
--- a/stat.c
+++ b/stat.c
@@ -351,7 +351,7 @@
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 @@
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;
}