projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into gfio
[fio.git]
/
stat.c
diff --git
a/stat.c
b/stat.c
index b16c55c6bfd0c42db41e99f2ff4283b1187a1216..8835f7f960ad93b223ffd0ccfe29d16ae0661f04 100644
(file)
--- a/
stat.c
+++ b/
stat.c
@@
-180,11
+180,12
@@
unsigned int calc_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,
* 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)
+ fio_fp64_t *plist
, unsigned int precision
)
{
unsigned int len, j = 0, minv, maxv;
unsigned int *ovals;
{
unsigned int len, j = 0, minv, maxv;
unsigned int *ovals;
- int is_last, scale_down;
+ int is_last, per_line, scale_down;
+ char fmt[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)
@@
-202,20
+203,23
@@
static void show_clat_percentiles(unsigned int *io_u_plat, unsigned long nr,
log_info(" clat percentiles (usec):\n |");
}
log_info(" clat percentiles (usec):\n |");
}
+ snprintf(fmt, sizeof(fmt), "%%1.%uf", precision);
+ per_line = (80 - 7) / (precision + 14);
+
for (j = 0; j < len; j++) {
for (j = 0; j < len; j++) {
- char fbuf[
8]
;
+ char fbuf[
16], *ptr = fbuf
;
/* for formatting */
/* for formatting */
- if (j != 0 && (j %
4
) == 0)
+ if (j != 0 && (j %
per_line
) == 0)
log_info(" |");
/* end of the list */
is_last = (j == len - 1);
if (plist[j].u.f < 10.0)
log_info(" |");
/* end of the list */
is_last = (j == len - 1);
if (plist[j].u.f < 10.0)
-
sprintf(fbuf, " %2.2f", plist[j].u.f
);
- else
-
sprintf(fbuf, "%2.2f"
, plist[j].u.f);
+
ptr += sprintf(fbuf, " "
);
+
+
snprintf(ptr, sizeof(fbuf), fmt
, plist[j].u.f);
if (scale_down)
ovals[j] = (ovals[j] + 999) / 1000;
if (scale_down)
ovals[j] = (ovals[j] + 999) / 1000;
@@
-225,7
+229,7
@@
static void show_clat_percentiles(unsigned int *io_u_plat, unsigned long nr,
if (is_last)
break;
if (is_last)
break;
- if (
j % 4 == 3)
/* for formatting */
+ if (
(j % per_line) == per_line - 1)
/* for formatting */
log_info("\n");
}
log_info("\n");
}
@@
-397,7
+401,8
@@
static void show_ddir_status(struct group_run_stats *rs, struct thread_stat *ts,
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_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;
@@
-614,7
+619,7
@@
static void show_ddir_status_terse(struct thread_stat *ts,
log_info(";0%%=0");
continue;
}
log_info(";0%%=0");
continue;
}
- log_info(";%
2.2
f%%=%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))
@@
-712,7
+717,7
@@
static void add_ddir_status_json(struct thread_stat *ts,
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.2
f", 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]);
}
@@
-1169,6
+1174,7
@@
void show_run_stats(void)
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++;