From 71619dc28506f7b7b40905b942e992b02f0d5b96 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sat, 13 Jan 2007 23:56:33 +0100 Subject: [PATCH] [PATCH] Include io depth distribution statistics Calculate the distribution of io depths for the job run. Signed-off-by: Jens Axboe --- HOWTO | 6 ++++++ fio.h | 7 +++++++ io_u.c | 26 ++++++++++++++++++++++++++ stat.c | 12 ++++++++++++ 4 files changed, 51 insertions(+) diff --git a/HOWTO b/HOWTO index 40f974cb..95d059e7 100644 --- a/HOWTO +++ b/HOWTO @@ -539,6 +539,7 @@ Client1 (g=0): err= 0: clat (msec): min= 0, max= 631, avg=48.50, stdev=86.82 bw (KiB/s) : min= 0, max= 1196, per=51.00%, avg=664.02, stdev=681.68 cpu : usr=1.49%, sys=0.25%, ctx=7969 + IO depths : 1=0.1%, 2=0.3%, 4=0.5%, 8=99.0%, 16=0.0%, 32=0.0%, >32=0.0% The client number is printed, along with the group id and error of that thread. Below is the io statistics, here for writes. In the order listed, @@ -563,6 +564,11 @@ runt= The runtime of that thread same disk, since they are then competing for disk access. cpu= CPU usage. User and system time, along with the number of context switches this thread went through. +IO depths= The distribution of io depths over the job life time. The + numbers are divided into powers of 2, so for example the + 16= entries includes depths up to that value but higher + than the previous entry. In other words, it covers the + range from 16 to 31. After each client has been listed, the group statistics are printed. They will look like this: diff --git a/fio.h b/fio.h index e85d6cc1..c2144066 100644 --- a/fio.h +++ b/fio.h @@ -167,6 +167,11 @@ struct fio_file { unsigned int unlink; }; +/* + * How many depth levels to log + */ +#define FIO_IO_U_MAP_NR 8 + /* * This describes a single thread/process executing a fio job. */ @@ -264,6 +269,8 @@ struct thread_data { * Current IO depth and list of free and busy io_u's. */ unsigned int cur_depth; + unsigned int io_u_map[FIO_IO_U_MAP_NR]; + unsigned long total_io_u; struct list_head io_u_freelist; struct list_head io_u_busylist; diff --git a/io_u.c b/io_u.c index 834e5d21..5e53b814 100644 --- a/io_u.c +++ b/io_u.c @@ -227,6 +227,31 @@ static int fill_io_u(struct thread_data *td, struct fio_file *f, return 1; } +static void io_u_mark_depth(struct thread_data *td) +{ + int index = 0; + + switch (td->cur_depth) { + default: + index++; + case 32 ... 63: + index++; + case 16 ... 31: + index++; + case 8 ... 15: + index++; + case 4 ... 7: + index++; + case 2 ... 3: + index++; + case 1: + break; + } + + td->io_u_map[index]++; + td->total_io_u++; +} + struct io_u *__get_io_u(struct thread_data *td) { struct io_u *io_u = NULL; @@ -240,6 +265,7 @@ struct io_u *__get_io_u(struct thread_data *td) list_del(&io_u->list); list_add(&io_u->list, &td->io_u_busylist); td->cur_depth++; + io_u_mark_depth(td); } return io_u; diff --git a/stat.c b/stat.c index e7ffd8cc..b4806e0e 100644 --- a/stat.c +++ b/stat.c @@ -375,6 +375,8 @@ static void show_thread_status(struct thread_data *td, { double usr_cpu, sys_cpu; unsigned long runtime; + double io_u_dist[FIO_IO_U_MAP_NR]; + int i; if (!(td->io_bytes[0] + td->io_bytes[1]) && !td->error) return; @@ -397,6 +399,16 @@ static void show_thread_status(struct thread_data *td, } fprintf(f_out, " cpu : usr=%3.2f%%, sys=%3.2f%%, ctx=%lu\n", usr_cpu, sys_cpu, td->ctx); + + /* + * Do depth distribution calculations + */ + for (i = 0; i < FIO_IO_U_MAP_NR; i++) { + io_u_dist[i] = (double) td->io_u_map[i] / (double) td->total_io_u; + io_u_dist[i] *= 100.0; + } + + fprintf(f_out, " IO depths : 1=%3.1f%%, 2=%3.1f%%, 4=%3.1f%%, 8=%3.1f%%, 16=%3.1f%%, 32=%3.1f%%, >32=%3.1f%%\n", io_u_dist[0], io_u_dist[1], io_u_dist[2], io_u_dist[3], io_u_dist[4], io_u_dist[5], io_u_dist[6]); } static void show_ddir_status_terse(struct thread_data *td, -- 2.25.1