Skip to content

Commit

Permalink
stress-vecshuf: report shuffle rates as Harmonic Mean
Browse files Browse the repository at this point in the history
Rates need to be "averaged" using Harmonic Mean instead of
Mean. Fix this.

Signed-off-by: Colin Ian King <[email protected]>
  • Loading branch information
ColinIanKing committed Dec 21, 2023
1 parent fa0816d commit e00b6a1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions stress-vecshuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ static int stress_vecshuf(stress_args_t *args)
double total_duration = 0.0;
double total_ops = 0.0;
double total_bytes = 0.0;
double inverse_sum_ops = 0.0;
double inverse_sum_bytes = 0.0;
double n = 0.0;

pr_block_begin();
pr_dbg("%s: shuffle throughput for just stressor instance 0:\n", args->name);
Expand All @@ -414,18 +417,23 @@ static int stress_vecshuf(stress_args_t *args)
const double ops_rate = (ops / duration) / 1000000.0;
const double bytes_rate = (bytes / duration) / (1.0 * MB);

inverse_sum_ops += 1.0 / ops_rate;
inverse_sum_bytes += 1.0 / bytes_rate;
n += 1.0;

pr_dbg("%s: %14.14s %13.3f %13.3f %13.3f\n", args->name,
stress_vecshuf_funcs[i].name, bytes_rate, ops_rate,
100.0 * duration / total_duration);
}
}

if (total_duration > 0.0) {
const double ops_rate = (total_ops / total_duration) / 1000000.0;
const double bytes_rate = (total_bytes / total_duration) / (1.0 * MB);
double ops_rate, bytes_rate;

ops_rate = n / inverse_sum_ops;
bytes_rate = n / inverse_sum_bytes;
pr_dbg("%s: %14.14s %13.3f %13.3f\n", args->name,
"Mean:", bytes_rate, ops_rate);
"Harmonic Mean:", bytes_rate, ops_rate);
}
pr_block_end();
}
Expand Down

0 comments on commit e00b6a1

Please sign in to comment.