[PATCH] Add bw/lat log as job options
[fio.git] / stat.c
diff --git a/stat.c b/stat.c
index e43a336108f0f78c18dcc28d5baf6cd1859b576c..718a8ab2acc1ee65618f132c3efabb9dc6ce7aef 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -239,7 +239,8 @@ void init_disk_util(struct thread_data *td)
                        log_err("unknown sysfs layout\n");
                        return;
                }
-               sprintf(foo, "%s", p);
+               strcpy(tmp, p);
+               sprintf(foo, "%s", tmp);
        }
 
        td->sysfs_root = strdup(foo);
@@ -445,11 +446,9 @@ void show_run_stats(void)
                rs->min_bw[1] = rs->min_run[1] = ~0UL;
        }
 
-       for (i = 0; i < thread_number; i++) {
+       for_each_td(td, i) {
                unsigned long long rbw, wbw;
 
-               td = &threads[i];
-
                if (td->error) {
                        fprintf(f_out, "%s: %s\n", td->name, td->verror);
                        continue;
@@ -500,8 +499,7 @@ void show_run_stats(void)
        if (!terse_output)
                printf("\n");
 
-       for (i = 0; i < thread_number; i++) {
-               td = &threads[i];
+       for_each_td(td, i) {
                rs = &runstats[td->groupid];
 
                if (terse_output)