From 8ad3b3dd6b1fc9a63f5932340b17d504c9e4ce56 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 9 Jul 2014 10:31:34 +0200 Subject: [PATCH] Add thread number to log filename Since commit aee2ab6775d9, we open the log files for writing and truncate the output. This breaks when you have multiple jobs with the same name, as will happen with numjobs=x. Instead of reverting this part of the commit, lets keep the truncate open and instead store log files separately. This makes more sense anyway, since otherwise the logs are all the entries from job X, then all the entries from job Y, etc. It's easy enough to collate the logs, should anyone want to do that. Signed-off-by: Jens Axboe --- HOWTO | 16 ++++++++++------ fio.1 | 14 +++++++++----- init.c | 20 ++++++++++---------- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/HOWTO b/HOWTO index fbc455d4..ac960698 100644 --- a/HOWTO +++ b/HOWTO @@ -1307,7 +1307,9 @@ write_bw_log=str If given, write a bandwidth log of the jobs in this job jobs in their lifetime. The included fio_generate_plots script uses gnuplot to turn these text files into nice graphs. See write_lat_log for behaviour of given - filename. For this option, the suffix is _bw.log. + filename. For this option, the suffix is _bw.x.log, where + x is the index of the job (1..N, where N is the number of + jobs). write_lat_log=str Same as write_bw_log, except that this option stores io submission, completion, and total latencies instead. If no @@ -1317,14 +1319,16 @@ write_lat_log=str Same as write_bw_log, except that this option stores io write_lat_log=foo - The actual log names will be foo_slat.log, foo_clat.log, - and foo_lat.log. This helps fio_generate_plot fine the logs - automatically. + The actual log names will be foo_slat.x.log, foo_clat.x.log, + and foo_lat.x.log, where x is the index of the job (1..N, + where N is the number of jobs). This helps fio_generate_plot + fine the logs automatically. write_iops_log=str Same as write_bw_log, but writes IOPS. If no filename is given with this option, the default filename of - "jobname_type.log" is used. Even if the filename is given, - fio will still append the type of log. + "jobname_type.x.log" is used,where x is the index of the job + (1..N, where N is the number of jobs). Even if the filename + is given, fio will still append the type of log. log_avg_msec=int By default, fio will log an entry in the iops, latency, or bw log for every IO that completes. When writing to the diff --git a/fio.1 b/fio.1 index c58e8176..22d6b1e8 100644 --- a/fio.1 +++ b/fio.1 @@ -1191,17 +1191,21 @@ If given, write a bandwidth log of the jobs in this job file. Can be used to store data of the bandwidth of the jobs in their lifetime. The included fio_generate_plots script uses gnuplot to turn these text files into nice graphs. See \fBwrite_lat_log\fR for behaviour of given filename. For this -option, the postfix is _bw.log. +option, the postfix is _bw.x.log, where x is the index of the job (1..N, +where N is the number of jobs) .TP .BI write_lat_log \fR=\fPstr Same as \fBwrite_bw_log\fR, but writes I/O completion latencies. If no -filename is given with this option, the default filename of "jobname_type.log" -is used. Even if the filename is given, fio will still append the type of log. +filename is given with this option, the default filename of +"jobname_type.x.log" is used, where x is the index of the job (1..N, where +N is the number of jobs). Even if the filename is given, fio will still +append the type of log. .TP .BI write_iops_log \fR=\fPstr Same as \fBwrite_bw_log\fR, but writes IOPS. If no filename is given with this -option, the default filename of "jobname_type.log" is used. Even if the -filename is given, fio will still append the type of log. +option, the default filename of "jobname_type.x.log" is used, where x is the +index of the job (1..N, where N is the number of jobs). Even if the filename +is given, fio will still append the type of log. .TP .BI log_avg_msec \fR=\fPint By default, fio will log an entry in the iops, latency, or bw log for every diff --git a/init.c b/init.c index 8268ed59..57aa7024 100644 --- a/init.c +++ b/init.c @@ -1167,14 +1167,14 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, else suf = "log"; - snprintf(logname, sizeof(logname), "%s_lat.%s", - o->lat_log_file, suf); + snprintf(logname, sizeof(logname), "%s_lat.%d.%s", + o->lat_log_file, td->thread_number, suf); setup_log(&td->lat_log, &p, logname); - snprintf(logname, sizeof(logname), "%s_slat.%s", - o->lat_log_file, suf); + snprintf(logname, sizeof(logname), "%s_slat.%d.%s", + o->lat_log_file, td->thread_number, suf); setup_log(&td->slat_log, &p, logname); - snprintf(logname, sizeof(logname), "%s_clat.%s", - o->lat_log_file, suf); + snprintf(logname, sizeof(logname), "%s_clat.%d.%s", + o->lat_log_file, td->thread_number, suf); setup_log(&td->clat_log, &p, logname); } if (o->bw_log_file) { @@ -1193,8 +1193,8 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, else suf = "log"; - snprintf(logname, sizeof(logname), "%s_bw.%s", - o->bw_log_file, suf); + snprintf(logname, sizeof(logname), "%s_bw.%d.%s", + o->bw_log_file, td->thread_number, suf); setup_log(&td->bw_log, &p, logname); } if (o->iops_log_file) { @@ -1213,8 +1213,8 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, else suf = "log"; - snprintf(logname, sizeof(logname), "%s_iops.%s", - o->iops_log_file, suf); + snprintf(logname, sizeof(logname), "%s_iops.%d.%s", + o->iops_log_file, td->thread_number, suf); setup_log(&td->iops_log, &p, logname); } -- 2.25.1