projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
android: fix compile by not defining FIO_NO_HAVE_SHM_H twice
[fio.git]
/
stat.c
diff --git
a/stat.c
b/stat.c
index fb5ff64f06859abc63f78cf14dd06311e1076a5e..fe09a2968e6b4cfea853ef526640fd46eee58faa 100644
(file)
--- a/
stat.c
+++ b/
stat.c
@@
-182,11
+182,12
@@
static unsigned int calc_clat_percentiles(unsigned int *io_u_plat,
* 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)
@@
-204,20
+205,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;
@@
-227,7
+231,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");
}
@@
-440,7
+444,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;
@@
-655,7
+660,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))
@@
-753,7
+758,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]);
}
@@
-1210,6
+1215,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++;
@@
-1352,10
+1358,10
@@
void show_run_stats(void)
if (is_backend)
fio_server_send_du();
if (is_backend)
fio_server_send_du();
- else if (output_format == FIO_OUTPUT_NORMAL)
+ else if (output_format == FIO_OUTPUT_NORMAL)
{
show_disk_util(0, NULL);
show_disk_util(0, NULL);
-
- show_idle_prof_stats(FIO_OUTPUT_NORMAL, NULL);
+ show_idle_prof_stats(FIO_OUTPUT_NORMAL, NULL);
+ }
free(runstats);
free(threadstats);
free(runstats);
free(threadstats);