Skip to content

Commit

Permalink
Better way to track priority of io_u for clat calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
brschwartz committed Sep 3, 2017
1 parent eaa6844 commit b7ad900
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
4 changes: 1 addition & 3 deletions io_u.c
Original file line number Diff line number Diff line change
Expand Up @@ -1779,8 +1779,6 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u,
if (td->parent)
td = td->parent;

td->priorityBit = io_u->priorityBit;

if (!td->o.stats)
return;

Expand Down Expand Up @@ -1811,7 +1809,7 @@ static void account_io_completion(struct thread_data *td, struct io_u *io_u,
if (ddir_rw(idx)) {

if (!td->o.disable_clat) {
add_clat_sample(td, idx, llnsec, bytes, io_u->offset);
add_clat_sample(td, idx, llnsec, bytes, io_u->offset, io_u->priorityBit);
io_u_mark_latency(td, llnsec);
}

Expand Down
24 changes: 9 additions & 15 deletions stat.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ static void show_thread_status_normal(struct thread_stat *ts,

if (!ddir_rw_sum(ts->io_bytes) && !ddir_rw_sum(ts->total_io_u))
return;

memset(time_buf, 0, sizeof(time_buf));

time(&time_p);
Expand Down Expand Up @@ -2464,29 +2464,26 @@ void add_agg_sample(union io_sample_data data, enum fio_ddir ddir, unsigned int
}

static void add_clat_percentile_sample(struct thread_stat *ts,
unsigned long long nsec, enum fio_ddir ddir)
unsigned long long nsec, enum fio_ddir ddir, unsigned int priorityBit)
{
unsigned int idx = plat_val_to_idx(nsec);
assert(idx < FIO_IO_U_PLAT_NR);

ts->io_u_plat[ddir][idx]++;

if (ts->priorityBit && ddir == DDIR_READ) {

if (priorityBit && ddir == DDIR_READ) {
ts->io_u_plat_prio[ddir][idx]++;
ts->priorityBit = 0;
}

else if (!ts->priorityBit && ddir == DDIR_READ) {

else if (!priorityBit && ddir == DDIR_READ) {
ts->io_u_plat_low_prio[ddir][idx]++;
}


}

void add_clat_sample(struct thread_data *td, enum fio_ddir ddir,
unsigned long long nsec, unsigned int bs, uint64_t offset)
unsigned long long nsec, unsigned int bs, uint64_t offset, unsigned int priorityBit)
{
unsigned long elapsed, this_window;
struct thread_stat *ts = &td->ts;
Expand All @@ -2495,11 +2492,11 @@ void add_clat_sample(struct thread_data *td, enum fio_ddir ddir,
td_io_u_lock(td);

add_stat_sample(&ts->clat_stat[ddir], nsec);
if (td->priorityBit && ddir == DDIR_READ) {
if (priorityBit && ddir == DDIR_READ) {
add_stat_sample(&ts->clat_prio_stat[ddir], nsec);
}

if (!td->priorityBit && ddir == DDIR_READ) {
if (!priorityBit && ddir == DDIR_READ) {
add_stat_sample(&ts->clat_low_prio_stat[ddir], nsec);
}

Expand All @@ -2508,10 +2505,7 @@ if (td->priorityBit && ddir == DDIR_READ) {
offset);

if (ts->clat_percentiles) {
if (td->priorityBit && ddir == DDIR_READ) {
ts->priorityBit = td->priorityBit;
}
add_clat_percentile_sample(ts, nsec, ddir);
add_clat_percentile_sample(ts, nsec, ddir, priorityBit);
}

if (iolog && iolog->hist_msec) {
Expand All @@ -2522,7 +2516,7 @@ if (td->priorityBit && ddir == DDIR_READ) {
if (!hw->hist_last)
hw->hist_last = elapsed;
this_window = elapsed - hw->hist_last;

if (this_window >= iolog->hist_msec) {
unsigned int *io_u_plat;
struct io_u_plat_entry *dst;
Expand Down
2 changes: 1 addition & 1 deletion stat.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ extern void clear_rusage_stat(struct thread_data *);
extern void add_lat_sample(struct thread_data *, enum fio_ddir, unsigned long long,
unsigned int, uint64_t);
extern void add_clat_sample(struct thread_data *, enum fio_ddir, unsigned long long,
unsigned int, uint64_t);
unsigned int, uint64_t, unsigned int);
extern void add_slat_sample(struct thread_data *, enum fio_ddir, unsigned long,
unsigned int, uint64_t);
extern void add_agg_sample(union io_sample_data, enum fio_ddir, unsigned int, unsigned int);
Expand Down

0 comments on commit b7ad900

Please sign in to comment.