summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
723d7b3)
We cap the output at %2.2f right now, that's not always enough.
Make the parser check and store the precision required to
output the list correctly.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
unsigned int trim_zero;
unsigned long long trim_backlog;
unsigned int clat_percentiles;
unsigned int trim_zero;
unsigned long long trim_backlog;
unsigned int clat_percentiles;
+ unsigned int percentile_precision; /* digits after decimal for percentiles */
fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
char *read_iolog_file;
fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
char *read_iolog_file;
td->mutex = fio_mutex_init(FIO_MUTEX_LOCKED);
td->ts.clat_percentiles = td->o.clat_percentiles;
td->mutex = fio_mutex_init(FIO_MUTEX_LOCKED);
td->ts.clat_percentiles = td->o.clat_percentiles;
+ td->ts.percentile_precision = td->o.percentile_precision;
memcpy(td->ts.percentile_list, td->o.percentile_list, sizeof(td->o.percentile_list));
for (i = 0; i < DDIR_RWDIR_CNT; i++) {
memcpy(td->ts.percentile_list, td->o.percentile_list, sizeof(td->o.percentile_list));
for (i = 0; i < DDIR_RWDIR_CNT; i++) {
.name = "percentile_list",
.type = FIO_OPT_FLOAT_LIST,
.off1 = td_var_offset(percentile_list),
.name = "percentile_list",
.type = FIO_OPT_FLOAT_LIST,
.off1 = td_var_offset(percentile_list),
+ .off2 = td_var_offset(percentile_precision),
.help = "Specify a custom list of percentiles to report",
.def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
.maxlen = FIO_IO_U_LIST_MAX_LEN,
.help = "Specify a custom list of percentiles to report",
.def = "1:5:10:20:30:40:50:60:70:80:90:95:99:99.5:99.9:99.95:99.99",
.maxlen = FIO_IO_U_LIST_MAX_LEN,
long ul1, ul2;
double uf;
char **cp = NULL;
long ul1, ul2;
double uf;
char **cp = NULL;
int ret = 0, is_time = 0;
const struct value_pair *vp;
struct value_pair posval[PARSE_MAX_VP];
int ret = 0, is_time = 0;
const struct value_pair *vp;
struct value_pair posval[PARSE_MAX_VP];
- int i, all_skipped = 1;
+ int i, len, all_skipped = 1;
dprint(FD_PARSE, "__handle_option=%s, type=%d, ptr=%s\n", o->name,
o->type, ptr);
dprint(FD_PARSE, "__handle_option=%s, type=%d, ptr=%s\n", o->name,
o->type, ptr);
break;
}
case FIO_OPT_FLOAT_LIST: {
break;
}
case FIO_OPT_FLOAT_LIST: {
+ if (first) {
+ /*
+ ** Initialize precision to 0 and zero out list
+ ** in case specified list is shorter than default
+ */
+ ul2 = 0;
+ ilp = td_var(data, o->off2);
+ *ilp = ul2;
+
+ flp = td_var(data, o->off1);
+ for(i = 0; i < o->maxlen; i++)
+ flp[i].u.f = 0.0;
+ }
if (curr >= o->maxlen) {
log_err("the list exceeding max length %d\n",
o->maxlen);
if (curr >= o->maxlen) {
log_err("the list exceeding max length %d\n",
o->maxlen);
flp = td_var(data, o->off1);
flp[curr].u.f = uf;
flp = td_var(data, o->off1);
flp[curr].u.f = uf;
+ /*
+ ** Calculate precision for output by counting
+ ** number of digits after period. Find first
+ ** period in entire remaining list each time
+ */
+ cp2 = strchr(ptr, '.');
+ if (cp2 != NULL) {
+ len = 0;
+
+ while (*++cp2 != '\0' && *cp2 >= '0' && *cp2 <= '9')
+ len++;
+
+ ilp = td_var(data, o->off2);
+ if (len > *ilp)
+ *ilp = len;
+ }
+
break;
}
case FIO_OPT_STR_STORE: {
break;
}
case FIO_OPT_STR_STORE: {
* Find and display the p-th percentile of clat
*/
static void show_clat_percentiles(unsigned int *io_u_plat, unsigned long nr,
* Find and display the p-th percentile of clat
*/
static void show_clat_percentiles(unsigned int *io_u_plat, unsigned long nr,
+ fio_fp64_t *plist, uint64_t precision)
{
unsigned int len, j = 0, minv, maxv;
unsigned int *ovals;
int is_last, scale_down;
{
unsigned int len, j = 0, minv, maxv;
unsigned int *ovals;
int is_last, scale_down;
+ char buf1[32], buf2[32];
len = calc_clat_percentiles(io_u_plat, nr, plist, &ovals, &maxv, &minv);
if (!len)
len = calc_clat_percentiles(io_u_plat, nr, plist, &ovals, &maxv, &minv);
if (!len)
log_info(" clat percentiles (usec):\n |");
}
log_info(" clat percentiles (usec):\n |");
}
+ snprintf(buf1, sizeof(buf1), " %%1.%luf", precision);
+ snprintf(buf2, sizeof(buf1), "%%1.%luf", precision);
for (j = 0; j < len; j++) {
for (j = 0; j < len; j++) {
/* for formatting */
if (j != 0 && (j % 4) == 0)
/* for formatting */
if (j != 0 && (j % 4) == 0)
is_last = (j == len - 1);
if (plist[j].u.f < 10.0)
is_last = (j == len - 1);
if (plist[j].u.f < 10.0)
- sprintf(fbuf, " %2.2f", plist[j].u.f);
+ snprintf(fbuf, sizeof(fbuf), buf1, plist[j].u.f);
- sprintf(fbuf, "%2.2f", plist[j].u.f);
+ snprintf(fbuf, sizeof(fbuf), buf2, plist[j].u.f);
if (scale_down)
ovals[j] = (ovals[j] + 999) / 1000;
if (scale_down)
ovals[j] = (ovals[j] + 999) / 1000;
if (ts->clat_percentiles) {
show_clat_percentiles(ts->io_u_plat[ddir],
ts->clat_stat[ddir].samples,
if (ts->clat_percentiles) {
show_clat_percentiles(ts->io_u_plat[ddir],
ts->clat_stat[ddir].samples,
+ ts->percentile_list,
+ ts->percentile_precision);
}
if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) {
double p_of_agg = 100.0;
}
if (calc_lat(&ts->bw_stat[ddir], &min, &max, &mean, &dev)) {
double p_of_agg = 100.0;
log_info(";0%%=0");
continue;
}
log_info(";0%%=0");
continue;
}
- log_info(";%2.2f%%=%u", ts->percentile_list[i].u.f, ovals[i]);
+ log_info(";%f%%=%u", ts->percentile_list[i].u.f, ovals[i]);
}
if (calc_lat(&ts->lat_stat[ddir], &min, &max, &mean, &dev))
}
if (calc_lat(&ts->lat_stat[ddir], &min, &max, &mean, &dev))
json_object_add_value_int(percentile_object, "0.00", 0);
continue;
}
json_object_add_value_int(percentile_object, "0.00", 0);
continue;
}
- snprintf(buf, sizeof(buf), "%2.2f", ts->percentile_list[i].u.f);
+ snprintf(buf, sizeof(buf), "%f", ts->percentile_list[i].u.f);
json_object_add_value_int(percentile_object, (const char *)buf, ovals[i]);
}
json_object_add_value_int(percentile_object, (const char *)buf, ovals[i]);
}
ts = &threadstats[j];
ts->clat_percentiles = td->o.clat_percentiles;
ts = &threadstats[j];
ts->clat_percentiles = td->o.clat_percentiles;
+ ts->percentile_precision = td->o.percentile_precision;
memcpy(ts->percentile_list, td->o.percentile_list, sizeof(td->o.percentile_list));
idx++;
memcpy(ts->percentile_list, td->o.percentile_list, sizeof(td->o.percentile_list));
idx++;
* IO depth and latency stats
*/
uint64_t clat_percentiles;
* IO depth and latency stats
*/
uint64_t clat_percentiles;
+ uint64_t percentile_precision;
fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
uint32_t io_u_map[FIO_IO_U_MAP_NR];
fio_fp64_t percentile_list[FIO_IO_U_LIST_MAX_LEN];
uint32_t io_u_map[FIO_IO_U_MAP_NR];