summaryrefslogtreecommitdiff
path: root/btreplay
diff options
context:
space:
mode:
authorLuis Useche <luis@cis.fiu.edu>2008-05-05 20:53:13 +0200
committerJens Axboe <jens.axboe@oracle.com>2008-05-05 20:53:13 +0200
commit4a7968cc672f39573abc6002f0afbed2a8e8139b (patch)
treec75b92ac4e0e6c1f1def1c299e085c2ed15efc48 /btreplay
parent7072ee3f2f12a1363d6f7378df3f268350e5bd52 (diff)
downloadblktrace-4a7968cc672f39573abc6002f0afbed2a8e8139b.tar.gz
blktrace-4a7968cc672f39573abc6002f0afbed2a8e8139b.tar.bz2
Add -x accellerator option
This patch adds a new functionality to the btreplay tool, the -x option. This parameter accelerate the replication by the factor specified. This means that the stall time is divided by the number introduced. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'btreplay')
-rw-r--r--btreplay/btreplay.c27
-rw-r--r--btreplay/doc/btreplay.tex13
2 files changed, 36 insertions, 4 deletions
diff --git a/btreplay/btreplay.c b/btreplay/btreplay.c
index 8e6b7dc..23e13b8 100644
--- a/btreplay/btreplay.c
+++ b/btreplay/btreplay.c
@@ -154,6 +154,7 @@ static LIST_HEAD(input_files); // List of input files to handle
static LIST_HEAD(map_devs); // List of device maps
static int nfiles = 0; // Number of files to handle
static int no_stalls = 0; // Boolean: Disable pre-stalls
+static unsigned acc_factor = 1; // Int: Acceleration factor
static int find_records = 0; // Boolean: Find record files auto
/*
@@ -1175,6 +1176,8 @@ static void stall(struct thr_info *tip, long long oclock)
struct timespec req;
long long dreal, tclock = gettime() - rgenesis;
+ oclock /= acc_factor;
+
if (verbose > 1)
fprintf(tip->vfp, " stall(%lld.%09lld, %lld.%09lld)\n",
du64_to_sec(oclock), du64_to_nsec(oclock),
@@ -1347,22 +1350,23 @@ static void *replay_sub(void *arg)
*/
static char usage_str[] = \
- "\n" \
+ "\n" \
"\t[ -c <cpus> : --cpus=<cpus> ] Default: 1\n" \
"\t[ -d <dir> : --input-directory=<dir> ] Default: .\n" \
- "\t[ -F : --find-records ] Default: Off\n" \
+ "\t[ -F : --find-records ] Default: Off\n" \
"\t[ -h : --help ] Default: Off\n" \
"\t[ -i <base> : --input-base=<base> ] Default: replay\n" \
"\t[ -I <iters>: --iterations=<iters> ] Default: 1\n" \
"\t[ -M <file> : --map-devs=<file> ] Default: None\n" \
"\t[ -N : --no-stalls ] Default: Off\n" \
+ "\t[ -x : --acc-factor ] Default: 1\n" \
"\t[ -v : --verbose ] Default: Off\n" \
"\t[ -V : --version ] Default: Off\n" \
"\t[ -W : --write-enable ] Default: Off\n" \
"\t<dev...> Default: None\n" \
"\n";
-#define S_OPTS "c:d:Fhi:I:M:Nt:vVW"
+#define S_OPTS "c:d:Fhi:I:M:Nx:t:vVW"
static struct option l_opts[] = {
{
.name = "cpus",
@@ -1413,6 +1417,12 @@ static struct option l_opts[] = {
.val = 'N'
},
{
+ .name = "acc-factor",
+ .has_arg = required_argument,
+ .flag = NULL,
+ .val = 'x'
+ },
+ {
.name = "verbose",
.has_arg = no_argument,
.flag = NULL,
@@ -1445,6 +1455,7 @@ static struct option l_opts[] = {
static void handle_args(int argc, char *argv[])
{
int c;
+ int r;
while ((c = getopt_long(argc, argv, S_OPTS, l_opts, NULL)) != -1) {
switch (c) {
@@ -1499,6 +1510,16 @@ static void handle_args(int argc, char *argv[])
no_stalls = 1;
break;
+ case 'x':
+ r = sscanf(optarg,"%u",&acc_factor);
+ if (r!=1) {
+ fprintf(stderr,
+ "Invalid acceleration factor\n");
+ exit(ERR_ARGS);
+ /*NOTREACHED*/
+ }
+ break;
+
case 'V':
fprintf(stderr, "btreplay -- version %s\n",
my_btversion);
diff --git a/btreplay/doc/btreplay.tex b/btreplay/doc/btreplay.tex
index beec720..b4027ff 100644
--- a/btreplay/doc/btreplay.tex
+++ b/btreplay/doc/btreplay.tex
@@ -386,12 +386,13 @@ Usage: btreplay -- version 0.9.3
[ -c <cpus> : --cpus=<cpus> ] Default: 1
[ -d <dir> : --input-directory=<dir> ] Default: .
- [ -F : --find-records ] Default: Off
+ [ -F : --find-records ] Default: Off
[ -h : --help ] Default: Off
[ -i <base> : --input-base=<base> ] Default: replay
[ -I <iters>: --iterations=<iters> ] Default: 1
[ -M <file> : --map-devs=<file> ] Default: None
[ -N : --no-stalls ] Default: Off
+ [ -x <int> : --acc-factor=<int> ] Default: 1
[ -v : --verbose ] Default: Off
[ -V : --version ] Default: Off
[ -W : --write-enable ] Default: Off
@@ -496,6 +497,16 @@ Pre-bunch Stalls}
When specified on the command line, all pre-bunch stall indicators will be
ignored. IOs will be replayed without inter-bunch delays.
+\subsubsection{\label{sec:o-x}\texttt{-x} or \texttt{--acc-factor}\\Accelaration
+Factor}
+
+ While the \texttt{--no-stalls} option allows the traces to be replayed
+ with no waiting time, this option specifies some acceleration factor
+ to be used. If the value of two is used, then the stall time is
+ divided by half resulting in a reduction of the execution time by
+ this factor. Note that if this number is too high, the results will
+ be equivalent of not having stall.
+
\subsubsection{\label{sec:p-o-v}\texttt{-v} or
\texttt{--verbose}\\Select Verbose Output}