summaryrefslogtreecommitdiff
path: root/init.c
diff options
context:
space:
mode:
authorDennis Zhou <dennis@kernel.org>2018-09-20 14:08:08 -0400
committerJens Axboe <axboe@kernel.dk>2018-09-20 13:07:37 -0600
commitb9921d1a56d9a6576dcf6c276b380a2a29a112be (patch)
tree7984dfb84f958e941175965a392df3a49b7f656f /init.c
parent532eda7ed384fff8ebfde90fc50f94618d6a5fb6 (diff)
blktrace: add support to interleave blktrace files
Running concurrent workloads via multiple jobs can lead to nondeterministic results as we are at the scheduler's mercy. While the actual performance of the workload may vary regardless, this makes the order of events consistent. This patch introduces two flags: --merge_blktrace_file=<file> and --merge-blktrace-only. When the first is specified, files that are ':' separated in --read_iolog are passed to a merge function wich then produces a single sorted trace file. This file is then passed on in place of the sorted list or fio exists if --merge-blktrace-only is specified. During merging, events are filtered based on what fio cares about and the pdu is discarded as well. Signed-off-by: Dennis Zhou <dennis@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'init.c')
-rw-r--r--init.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/init.c b/init.c
index c235b05..560da8f 100644
--- a/init.c
+++ b/init.c
@@ -30,6 +30,7 @@
#include "idletime.h"
#include "filelock.h"
#include "steadystate.h"
+#include "blktrace.h"
#include "oslib/getopt.h"
#include "oslib/strcasestr.h"
@@ -46,6 +47,7 @@ static char **ini_file;
static int max_jobs = FIO_MAX_JOBS;
static int dump_cmdline;
static int parse_only;
+static int merge_blktrace_only;
static struct thread_data def_thread;
struct thread_data *threads = NULL;
@@ -287,6 +289,11 @@ static struct option l_opts[FIO_NR_OPTIONS] = {
.val = 'K',
},
{
+ .name = (char *) "merge-blktrace-only",
+ .has_arg = no_argument,
+ .val = 'A' | FIO_CLIENT_FLAG,
+ },
+ {
.name = NULL,
},
};
@@ -1724,6 +1731,14 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
if (td_steadystate_init(td))
goto err;
+ if (o->merge_blktrace_file && !merge_blktrace_iologs(td))
+ goto err;
+
+ if (merge_blktrace_only) {
+ put_job(td);
+ return 0;
+ }
+
/*
* recurse add identical jobs, clear numjobs and stonewall options
* as they don't apply to sub-jobs
@@ -2173,6 +2188,7 @@ static void usage(const char *name)
printf(" --debug=options\tEnable debug logging. May be one/more of:\n");
show_debug_categories();
printf(" --parse-only\t\tParse options only, don't start any IO\n");
+ printf(" --merge-blktrace-only\tMerge blktraces only, don't start any IO\n");
printf(" --output\t\tWrite output to file\n");
printf(" --bandwidth-log\tGenerate aggregate bandwidth logs\n");
printf(" --minimal\t\tMinimal (terse) output\n");
@@ -2889,6 +2905,11 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
}
trigger_timeout /= 1000000;
break;
+
+ case 'A':
+ did_arg = true;
+ merge_blktrace_only = 1;
+ break;
case '?':
log_err("%s: unrecognized option '%s'\n", argv[0],
argv[optind - 1]);