Remove extra \n before printing run status
[fio.git] / stat.c
diff --git a/stat.c b/stat.c
index c2705d26f38bbd82f25b82882aa1f5910901a7d0..e7195c2845c5a156ae441444e25e88776276b171 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -128,6 +128,9 @@ static void show_clat_percentiles(unsigned int *io_u_plat, unsigned long nr,
        while (len < FIO_IO_U_LIST_MAX_LEN && plist[len].u.f != 0.0)
                len++;
 
+       if (!len)
+               return;
+
        /*
         * Sort the percentile list. Note that it may already be sorted if
         * we are using the default values, but since it's a short list this
@@ -136,29 +139,37 @@ static void show_clat_percentiles(unsigned int *io_u_plat, unsigned long nr,
        if (len > 1)
                qsort((void*)plist, len, sizeof(plist[0]), double_cmp);
 
-       log_info("    clat percentiles (usec) :");
+       log_info("    clat percentiles (usec):\n     |");
 
        for (i = 0; i < FIO_IO_U_PLAT_NR && !is_last; i++) {
                sum += io_u_plat[i];
                while (sum >= (plist[j].u.f / 100.0 * nr)) {
+                       char fbuf[8];
+
                        assert(plist[j].u.f <= 100.0);
 
                        /* for formatting */
                        if (j != 0 && (j % 4) == 0)
-                               log_info("                             ");
+                               log_info("     |");
 
                        /* end of the list */
                        is_last = (j == len - 1);
 
-                       log_info(" %2.2fth=%u%c", plist[j], plat_idx_to_val(i),
-                                (is_last? '\n' : ','));
+                       if (plist[j].u.f < 10.0)
+                               sprintf(fbuf, " %2.2f", plist[j].u.f);
+                       else
+                               sprintf(fbuf, "%2.2f", plist[j].u.f);
+
+                       log_info(" %sth=[%5u]%c", fbuf, plat_idx_to_val(i),
+                                       is_last ? '\n' : ',');
 
                        if (is_last)
                                break;
 
                        if (j % 4 == 3) /* for formatting */
                                log_info("\n");
-                       j++;
+                       if (++j == FIO_IO_U_LIST_MAX_LEN)
+                               break;
                }
        }
 }
@@ -191,7 +202,7 @@ void show_group_stats(struct group_run_stats *rs)
        const char *ddir_str[] = { "   READ", "  WRITE" };
        int i;
 
-       log_info("\nRun status group %d (all jobs):\n", rs->groupid);
+       log_info("Run status group %d (all jobs):\n", rs->groupid);
 
        for (i = 0; i <= DDIR_WRITE; i++) {
                const int i2p = is_power_of_2(rs->kb_base);