Merge branch 'For_Each_Td_Private_Scope' of https://github.com/horshack-dpreview/fio
authorJens Axboe <axboe@kernel.dk>
Fri, 3 Mar 2023 17:46:26 +0000 (10:46 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 3 Mar 2023 17:46:26 +0000 (10:46 -0700)
* 'For_Each_Td_Private_Scope' of https://github.com/horshack-dpreview/fio:
  Refactor for_each_td() to catch inappropriate td ptr reuse

Signed-off-by: Jens Axboe <axboe@kernel.dk>
eta.c
tools/fiologparser.py

diff --git a/eta.c b/eta.c
index b392b83c2a44b4904b103b740eb51ace22fe9392..ce1c6f2dcd86431fc7561fdac4d684e2d9b0751b 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -382,6 +382,7 @@ bool eta_time_within_slack(unsigned int time)
 bool calc_thread_status(struct jobs_eta *je, int force)
 {
        int unified_rw_rep;
+       bool any_td_in_ramp;
        uint64_t rate_time, disp_time, bw_avg_time, *eta_secs;
        unsigned long long io_bytes[DDIR_RWDIR_CNT] = {};
        unsigned long long io_iops[DDIR_RWDIR_CNT] = {};
@@ -504,7 +505,11 @@ bool calc_thread_status(struct jobs_eta *je, int force)
        fio_gettime(&now, NULL);
        rate_time = mtime_since(&rate_prev_time, &now);
 
-       if (write_bw_log && rate_time > bw_avg_time /* && !in_ramp_time(td) fixme: td isn't valid here */) {
+       any_td_in_ramp = false;
+       for_each_td(td) {
+               any_td_in_ramp |= in_ramp_time(td);
+       } end_for_each();
+       if (write_bw_log && rate_time > bw_avg_time && !any_td_in_ramp) {
                calc_rate(unified_rw_rep, rate_time, io_bytes, rate_io_bytes,
                                je->rate);
                memcpy(&rate_prev_time, &now, sizeof(now));
index 054f1f60784879023fcc31051379a892d8adbed1..708c5d4920ea7ff287d695cc971d1066c48677de 100755 (executable)
@@ -166,7 +166,7 @@ class TimeSeries(object):
         f = open(fn, 'r')
         p_time = 0
         for line in f:
-            (time, value, foo, bar) = line.rstrip('\r\n').rsplit(', ')
+            (time, value) = line.rstrip('\r\n').rsplit(', ')[:2]
             self.add_sample(p_time, int(time), int(value))
             p_time = int(time)