#include "lib/ieee754.h"
#include "json.h"
#include "lib/getrusage.h"
+#include "idletime.h"
void update_rusage_stat(struct thread_data *td)
{
* 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, uint64_t precision)
{
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)
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++) {
- char fbuf[8];
+ char fbuf[16];
/* for formatting */
if (j != 0 && (j % 4) == 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);
else
- 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 (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;
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))
json_object_add_value_int(percentile_object, "0.00", 0);
continue;
}
- snprintf(buf, sizeof(buf) - 1, "%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]);
}
for (i = 0; i < 7; i++) {
char name[20];
if (i < 6)
- snprintf(name, 19, "%d", 1 << i);
+ snprintf(name, 20, "%d", 1 << i);
else
- snprintf(name, 19, ">=%d", 1 << i);
+ snprintf(name, 20, ">=%d", 1 << i);
json_object_add_value_float(tmp, (const char *)name, io_u_dist[i]);
}
ts = &threadstats[j];
ts->clat_percentiles = td->o.clat_percentiles;
- if (td->o.overwrite_plist)
- memcpy(ts->percentile_list, td->o.percentile_list, sizeof(td->o.percentile_list));
- else
- memcpy(ts->percentile_list, def_percentile_list, sizeof(def_percentile_list));
+ ts->percentile_precision = td->o.percentile_precision;
+ memcpy(ts->percentile_list, td->o.percentile_list, sizeof(td->o.percentile_list));
idx++;
ts->members++;
/* disk util stats, if any */
show_disk_util(1, root);
+ show_idle_prof_stats(FIO_OUTPUT_JSON, root);
+
json_print_object(root);
log_info("\n");
json_free_object(root);
else if (output_format == FIO_OUTPUT_NORMAL)
show_disk_util(0, NULL);
+ show_idle_prof_stats(FIO_OUTPUT_NORMAL, NULL);
+
free(runstats);
free(threadstats);
}