summaryrefslogtreecommitdiff
path: root/t/btrace2fio.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2014-09-16 17:40:03 +0200
committerJens Axboe <axboe@kernel.dk>2014-09-16 17:40:03 +0200
commit35661615f8c42ef078ae0b7d23f632060d723826 (patch)
treecbdeead2c3a55925b71f30382cb9260c4c30014c /t/btrace2fio.c
parent1a8cad44cf3a1078411b36e97ca5dd37a0dcbd70 (diff)
downloadfio-35661615f8c42ef078ae0b7d23f632060d723826.tar.gz
fio-35661615f8c42ef078ae0b7d23f632060d723826.tar.bz2
btrace2fio: use percentage_random and add filename option
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 't/btrace2fio.c')
-rw-r--r--t/btrace2fio.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/t/btrace2fio.c b/t/btrace2fio.c
index c88c0509..d09f1be9 100644
--- a/t/btrace2fio.c
+++ b/t/btrace2fio.c
@@ -18,6 +18,7 @@
static unsigned int rt_threshold = 1000000;
static unsigned int ios_threshold = 10;
static int output_ascii = 1;
+static char *filename;
struct bs {
unsigned int bs;
@@ -230,6 +231,8 @@ static void btrace_add_file(struct btrace_out *o, uint32_t devno)
unsigned int i;
char dev[256];
+ if (filename)
+ return;
if (o->last_major == maj && o->last_minor == min)
return;
@@ -561,7 +564,7 @@ static int __output_p_fio(struct btrace_pid *p, unsigned long *ios)
printf("rwmixread=%u\n", (int) (perc + 0.99));
}
- printf("percentage_sequential=");
+ printf("percentage_random=");
for (i = 0; i < DDIR_RWDIR_CNT; i++) {
if (o->seq[i] && o->ios[i]) {
perc = ((float) o->seq[i] * 100.0) / (float) o->ios[i];
@@ -572,6 +575,7 @@ static int __output_p_fio(struct btrace_pid *p, unsigned long *ios)
if (i)
printf(",");
+ perc = 100.0 - perc;
printf("%u", (int) perc);
}
printf("\n");
@@ -626,6 +630,12 @@ static int __output_p(struct btrace_pid *p, unsigned long *ios)
qsort(o->bs[i], o->nr_bs[i], sizeof(struct bs), bs_cmp);
}
+ if (filename) {
+ o->files = malloc(sizeof(struct trace_file));
+ o->nr_files++;
+ o->files[0].name = filename;
+ }
+
if (output_ascii)
__output_p_ascii(p, ios);
else
@@ -698,6 +708,7 @@ static int usage(char *argv[])
fprintf(stderr, "\t-t\tUsec threshold to ignore task\n");
fprintf(stderr, "\t-n\tNumber IOS threshold to ignore task\n");
fprintf(stderr, "\t-f\tFio job file output\n");
+ fprintf(stderr, "\t-d\tUse this file/device for replay\n");
return 1;
}
@@ -710,7 +721,7 @@ int main(int argc, char *argv[])
if (argc < 2)
return usage(argv);
- while ((c = getopt(argc, argv, "t:n:f")) != -1) {
+ while ((c = getopt(argc, argv, "t:n:fd:")) != -1) {
switch (c) {
case 't':
rt_threshold = atoi(optarg);
@@ -721,6 +732,9 @@ int main(int argc, char *argv[])
case 'f':
output_ascii = 0;
break;
+ case 'd':
+ filename = strdup(optarg);
+ break;
case '?':
default:
return usage(argv);