Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stat: Increase depth levels to log latency #1103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion HOWTO
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ Command line options
Use the directory specified by `path` for generated state files instead
of the current working directory.

.. option:: --latency-stats=nr

Change default latency stats number. The default buckets number is 10.

sitsofe marked this conversation as resolved.
Show resolved Hide resolved
Any parameters following the options will be assumed to be job files, unless
they match a job file parameter. Multiple job files can be listed and each job
file will be regarded as a separate group. Fio will :option:`stonewall`
Expand Down Expand Up @@ -4045,13 +4049,20 @@ field was introduced or whether it's specific to some terse version):

<=1, 2, 4, 8, 16, 32, >=64

I/O latencies nanoseconds::

<=2, 4, 10, 20, 50, 100, 250, 500, 750, 1000
The number of buckets may vary.

sitsofe marked this conversation as resolved.
Show resolved Hide resolved
I/O latencies microseconds::

<=2, 4, 10, 20, 50, 100, 250, 500, 750, 1000
The number of buckets may vary.

I/O latencies milliseconds::

<=2, 4, 10, 20, 50, 100, 250, 500, 750, 1000, 2000, >=2000
The number of buckets may vary.

Disk utilization [v3]::

Expand Down Expand Up @@ -4084,7 +4095,7 @@ minimal output v3, separated by semicolons::
In client/server mode terse output differs from what appears when jobs are run
locally. Disk utilization data is omitted from the standard terse output and
for v3 and later appears on its own separate line at the end of each terse
reporting cycle.
reporting cycle. The number of buckets may vary.


JSON output
Expand Down
2 changes: 2 additions & 0 deletions client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2150,6 +2150,8 @@ int fio_handle_clients(struct client_ops *ops)

fio_client_json_fini();

stat_free_lat(&client_ts);

free(pfds);
return retval || error_clients;
}
Expand Down
1 change: 1 addition & 0 deletions debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum {
FD_STEADYSTATE,
FD_HELPERTHREAD,
FD_ZBD,
FD_STAT,
FD_DEBUG_MAX,
};

Expand Down
17 changes: 16 additions & 1 deletion fio.1
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ Set this \fIcommand\fR as remote trigger.
.BI \-\-aux\-path \fR=\fPpath
Use the directory specified by \fIpath\fP for generated state files instead
of the current working directory.
.TP
.BI \-\-latency\-stats \fR=\fPnr
Change default latency stats number. The default buckets number is 10.
.SH "JOB FILE FORMAT"
Any parameters following the options will be assumed to be job files, unless
they match a job file parameter. Multiple job files can be listed and each job
Expand Down Expand Up @@ -3748,11 +3751,22 @@ I/O depths:
.RS
.P
.B
I/O latencies nanoseconds:
.RE
.P
.nf
<=2, 4, 10, 20, 50, 100, 250, 500, 750, 1000
The number of buckets may vary.
.fi
.RS
.P
.B
I/O latencies microseconds:
.RE
.P
.nf
<=2, 4, 10, 20, 50, 100, 250, 500, 750, 1000
The number of buckets may vary.
.fi
.RS
.P
Expand All @@ -3762,6 +3776,7 @@ I/O latencies milliseconds:
.P
.nf
<=2, 4, 10, 20, 50, 100, 250, 500, 750, 1000, 2000, >=2000
The number of buckets may vary.
.fi
.RS
.P
Expand Down Expand Up @@ -3813,7 +3828,7 @@ minimal output v3, separated by semicolons:
In client/server mode terse output differs from what appears when jobs are run
locally. Disk utilization data is omitted from the standard terse output and
for v3 and later appears on its own separate line at the end of each terse
reporting cycle.
reporting cycle. The number of buckets may vary.
.SH JSON OUTPUT
The \fBjson\fR output format is intended to be both human readable and convenient
for automated parsing. For the most part its sections mirror those of the
Expand Down
21 changes: 20 additions & 1 deletion init.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ static struct option l_opts[FIO_NR_OPTIONS] = {
.has_arg = no_argument,
.val = 'A' | FIO_CLIENT_FLAG,
},
{
.name = (char *) "latency-stats",
.has_arg = required_argument,
.val = 'n' | FIO_CLIENT_FLAG,
},
{
.name = NULL,
},
Expand Down Expand Up @@ -537,6 +542,8 @@ static void put_job(struct thread_data *td)
if (td->o.name)
free(td->o.name);

stat_free_lat(&td->ts);

memset(td, 0, sizeof(*td));
segments[cur_segment].nr_threads--;
thread_number--;
Expand Down Expand Up @@ -1532,6 +1539,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num,
td->ts.clat_low_prio_stat[i].min_val = ULONG_MAX;
}
td->ts.sync_stat.min_val = ULONG_MAX;
stat_alloc_lat(&td->ts);
td->ddir_seq_nr = o->ddir_seq_nr;

if ((o->stonewall || o->new_group) && prev_group_jobs) {
Expand Down Expand Up @@ -2241,6 +2249,7 @@ static void usage(const char *name)
printf(" --trigger=cmd\t\tSet this command as local trigger\n");
printf(" --trigger-remote=cmd\tSet this command as remote trigger\n");
printf(" --aux-path=path\tUse this path for fio state generated files\n");
printf(" --latency-stats=nr\tChange default latency stats number\n");
printf("\nFio was written by Jens Axboe <[email protected]>\n");
}

Expand Down Expand Up @@ -2322,6 +2331,10 @@ const struct debug_level debug_levels[] = {
.help = "Zoned Block Device logging",
.shift = FD_ZBD,
},
{ .name = "stat",
.help = "Statisitics logging",
.shift = FD_STAT,
},
{ .name = NULL, },
};

Expand Down Expand Up @@ -2906,11 +2919,17 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
}
trigger_timeout /= 1000000;
break;

case 'A':
did_arg = true;
merge_blktrace_only = true;
break;
case 'n':
if (!stat_set_lat(atoi(optarg))) {
log_err("fio: bad latency stats number\n");
exit_val = 1;
do_exit++;
}
break;
case '?':
log_err("%s: unrecognized option '%s'\n", argv[0],
argv[optind - 1]);
Expand Down
105 changes: 10 additions & 95 deletions io_u.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,129 +1045,44 @@ void io_u_mark_depth(struct thread_data *td, unsigned int nr)

static void io_u_mark_lat_nsec(struct thread_data *td, unsigned long long nsec)
{
int idx = 0;
int idx;

assert(nsec < 1000);

switch (nsec) {
case 750 ... 999:
idx = 9;
break;
case 500 ... 749:
idx = 8;
break;
case 250 ... 499:
idx = 7;
break;
case 100 ... 249:
idx = 6;
break;
case 50 ... 99:
idx = 5;
break;
case 20 ... 49:
idx = 4;
break;
case 10 ... 19:
idx = 3;
break;
case 4 ... 9:
idx = 2;
break;
case 2 ... 3:
idx = 1;
fallthrough;
case 0 ... 1:
break;
}
idx = stat_get_lat_idx(nsec);

assert(idx < FIO_IO_U_LAT_N_NR);
td->ts.io_u_lat_n[idx]++;
}

static void io_u_mark_lat_usec(struct thread_data *td, unsigned long long usec)
{
int idx = 0;
int idx;

assert(usec < 1000 && usec >= 1);

switch (usec) {
case 750 ... 999:
idx = 9;
break;
case 500 ... 749:
idx = 8;
break;
case 250 ... 499:
idx = 7;
break;
case 100 ... 249:
idx = 6;
break;
case 50 ... 99:
idx = 5;
break;
case 20 ... 49:
idx = 4;
break;
case 10 ... 19:
idx = 3;
break;
case 4 ... 9:
idx = 2;
break;
case 2 ... 3:
idx = 1;
fallthrough;
case 0 ... 1:
break;
}
idx = stat_get_lat_idx(usec);

assert(idx < FIO_IO_U_LAT_U_NR);
td->ts.io_u_lat_u[idx]++;
}

static void io_u_mark_lat_msec(struct thread_data *td, unsigned long long msec)
{
int idx = 0;
int idx;
int nr = stat_get_lat_m_nr();

assert(msec >= 1);

switch (msec) {
default:
idx = 11;
idx = nr - 1;
break;
case 1000 ... 1999:
idx = 10;
break;
case 750 ... 999:
idx = 9;
break;
case 500 ... 749:
idx = 8;
idx = nr - 2;
break;
case 250 ... 499:
idx = 7;
break;
case 100 ... 249:
idx = 6;
break;
case 50 ... 99:
idx = 5;
break;
case 20 ... 49:
idx = 4;
break;
case 10 ... 19:
idx = 3;
break;
case 4 ... 9:
idx = 2;
break;
case 2 ... 3:
idx = 1;
fallthrough;
case 0 ... 1:
case 1 ... 999:
idx = stat_get_lat_idx(msec);
break;
}

Expand Down
2 changes: 1 addition & 1 deletion server.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct fio_net_cmd_reply {
};

enum {
FIO_SERVER_VER = 91,
FIO_SERVER_VER = 92,

FIO_SERVER_MAX_FRAGMENT_PDU = 1024,
FIO_SERVER_MAX_CMD_MB = 2048,
Expand Down
Loading