X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=stat.c;h=718a8ab2acc1ee65618f132c3efabb9dc6ce7aef;hp=7f38d96da7093d90c1af1eac5d51d0b3b6777bfa;hb=ec94ec567cae47f91fa31a18250c2a7a0029d2ad;hpb=3307d653f9cfc05b9c02e4cda91e6b45444dc1b0 diff --git a/stat.c b/stat.c index 7f38d96d..718a8ab2 100644 --- a/stat.c +++ b/stat.c @@ -187,6 +187,7 @@ static int find_block_dir(dev_t dev, char *path) void init_disk_util(struct thread_data *td) { + struct fio_file *f; struct stat st; char foo[256], tmp[256]; dev_t dev; @@ -195,7 +196,11 @@ void init_disk_util(struct thread_data *td) if (!td->do_disk_util) return; - if (!stat(td->file_name, &st)) { + /* + * Just use the same file, they are on the same device. + */ + f = &td->files[0]; + if (!stat(f->file_name, &st)) { if (S_ISBLK(st.st_mode)) dev = st.st_rdev; else @@ -204,7 +209,7 @@ void init_disk_util(struct thread_data *td) /* * must be a file, open "." in that path */ - strcpy(foo, td->file_name); + strcpy(foo, f->file_name); p = dirname(foo); if (stat(p, &st)) { perror("disk util stat"); @@ -234,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); @@ -440,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; @@ -495,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)