* Fix runtime of terse output
@ 2015-12-22 8:16 shoichi.sawada
2015-12-23 16:03 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: shoichi.sawada @ 2015-12-22 8:16 UTC (permalink / raw)
To: fio; +Cc: yoshihiro7.tsuchiya
Hi,
When I used fio with option of '--status-interval=1 --minimal' and 'random_distribution=zipf:1.2',
'runtime' of 2nd line was 18446744073709551345.
This value is -271 in int_64.
This is because 'runtime' was subtracted in function '__show_running_run_stats'.
If 'td->io_bytes' is 0 when this function was called,
and 'td->io_bytes' is not 0 when '__show_run_stats' returned,
'runtime' is subtracted by 'rt' even though 'runtime' have not added.
I fixed the problem by applying this patch to fio-2.2.13.
Regards
Shoichi
----
diff --git a/stat.c b/stat.c
index ca06617..1c1609e 100644
--- a/stat.c
+++ b/stat.c
@@ -1687,19 +1687,19 @@ void __show_running_run_stats(void)
fio_gettime(&tv, NULL);
for_each_td(td, i) {
- rt[i] = mtime_since(&td->start, &tv);
- if (td_read(td) && td->io_bytes[DDIR_READ])
- td->ts.runtime[DDIR_READ] += rt[i];
- if (td_write(td) && td->io_bytes[DDIR_WRITE])
- td->ts.runtime[DDIR_WRITE] += rt[i];
- if (td_trim(td) && td->io_bytes[DDIR_TRIM])
- td->ts.runtime[DDIR_TRIM] += rt[i];
-
td->update_rusage = 1;
td->ts.io_bytes[DDIR_READ] = td->io_bytes[DDIR_READ];
td->ts.io_bytes[DDIR_WRITE] = td->io_bytes[DDIR_WRITE];
td->ts.io_bytes[DDIR_TRIM] = td->io_bytes[DDIR_TRIM];
td->ts.total_run_time = mtime_since(&td->epoch, &tv);
+
+ rt[i] = mtime_since(&td->start, &tv);
+ if (td_read(td) && td->ts.io_bytes[DDIR_READ])
+ td->ts.runtime[DDIR_READ] += rt[i];
+ if (td_write(td) && td->ts.io_bytes[DDIR_WRITE])
+ td->ts.runtime[DDIR_WRITE] += rt[i];
+ if (td_trim(td) && td->ts.io_bytes[DDIR_TRIM])
+ td->ts.runtime[DDIR_TRIM] += rt[i];
}
for_each_td(td, i) {
@@ -1715,11 +1715,11 @@ void __show_running_run_stats(void)
__show_run_stats();
for_each_td(td, i) {
- if (td_read(td) && td->io_bytes[DDIR_READ])
+ if (td_read(td) && td->ts.io_bytes[DDIR_READ])
td->ts.runtime[DDIR_READ] -= rt[i];
- if (td_write(td) && td->io_bytes[DDIR_WRITE])
+ if (td_write(td) && td->ts.io_bytes[DDIR_WRITE])
td->ts.runtime[DDIR_WRITE] -= rt[i];
- if (td_trim(td) && td->io_bytes[DDIR_TRIM])
+ if (td_trim(td) && td->ts.io_bytes[DDIR_TRIM])
td->ts.runtime[DDIR_TRIM] -= rt[i];
}
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: Fix runtime of terse output
2015-12-22 8:16 Fix runtime of terse output shoichi.sawada
@ 2015-12-23 16:03 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2015-12-23 16:03 UTC (permalink / raw)
To: shoichi.sawada, fio; +Cc: yoshihiro7.tsuchiya
On 12/22/2015 01:16 AM, shoichi.sawada@toshiba.co.jp wrote:
> Hi,
>
> When I used fio with option of '--status-interval=1 --minimal' and 'random_distribution=zipf:1.2',
> 'runtime' of 2nd line was 18446744073709551345.
> This value is -271 in int_64.
>
> This is because 'runtime' was subtracted in function '__show_running_run_stats'.
> If 'td->io_bytes' is 0 when this function was called,
> and 'td->io_bytes' is not 0 when '__show_run_stats' returned,
> 'runtime' is subtracted by 'rt' even though 'runtime' have not added.
>
> I fixed the problem by applying this patch to fio-2.2.13.
Thanks, applied.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-23 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-22 8:16 Fix runtime of terse output shoichi.sawada
2015-12-23 16:03 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox