[PATCH] syslet: fix leak of ring and ahu
[fio.git] / stat.c
diff --git a/stat.c b/stat.c
index fb776e9c0ecbe4c0ee5eac9c1c8660cad2b714df..f9c6985338d998095fd35a229d8b0be5ed533760 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -21,8 +21,8 @@ static char *num2str(unsigned long num, int maxlen, int base)
         * could be passed in for 10^3 base, but every caller expects
         * 2^10 base right now.
         */
-       const int thousand = 1024;
-       char postfix[] = { 'K', 'M', 'G', 'P' };
+       const unsigned int thousand = 1024;
+       char postfix[] = { 'K', 'M', 'G', 'P', 'E' };
        char *buf;
        int i;
 
@@ -47,7 +47,7 @@ static char *num2str(unsigned long num, int maxlen, int base)
                num /= thousand;
                num += carry;
                i++;
-       } while (i <= 4);
+       } while (i <= 5);
 
        return buf;
 }
@@ -441,10 +441,13 @@ static void show_thread_status(struct thread_data *td,
        double io_u_dist[FIO_IO_U_MAP_NR];
        int i;
 
-       if (!(td->io_bytes[0] + td->io_bytes[1]) && !td->error)
+       if (!(td->io_bytes[0] + td->io_bytes[1]))
                return;
 
-       fprintf(f_out, "%s: (groupid=%d): err=%2d: pid=%d\n",td->name, td->groupid, td->error, td->pid);
+       if (!td->error)
+               fprintf(f_out, "%s: (groupid=%d): err=%2d: pid=%d\n",td->name, td->groupid, td->error, td->pid);
+       else
+               fprintf(f_out, "%s: (groupid=%d): err=%2d (%s): pid=%d\n",td->name, td->groupid, td->error, td->verror, td->pid);
 
        show_ddir_status(td, rs, td->ddir);
        if (td->io_bytes[td->ddir ^ 1])
@@ -553,11 +556,6 @@ void show_run_stats(void)
        for_each_td(td, i) {
                unsigned long long rbw, wbw;
 
-               if (td->error) {
-                       fprintf(f_out, "%s: %s\n", td->name, td->verror);
-                       continue;
-               }
-
                rs = &runstats[td->groupid];
 
                if (td->runtime[0] < rs->min_run[0] || !rs->min_run[0])