Merge branch 'master' of https://github.com/SuhoSon/fio
authorJens Axboe <axboe@kernel.dk>
Tue, 4 Apr 2023 13:37:37 +0000 (07:37 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 4 Apr 2023 13:37:37 +0000 (07:37 -0600)
* 'master' of https://github.com/SuhoSon/fio:
  thinktime: Fix missing re-init thinktime when using ramptime

fio.h
libfio.c

diff --git a/fio.h b/fio.h
index f2acd4302b39a3c82cb314643e8dbe8c73d67ed8..6b841e9c263bf1b1960d00b551d78e7ebb986467 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -377,7 +377,7 @@ struct thread_data {
 
        uint64_t *thinktime_blocks_counter;
        struct timespec last_thinktime;
-       uint64_t last_thinktime_blocks;
+       int64_t last_thinktime_blocks;
 
        /*
         * State for random io, a bitmap of blocks done vs not done
index a52014ce6bd3afebcf8e5bc4adecea1fcc0794cd..ddd49cd76da2e6062cbd4c0a246fe603f5d75cde 100644 (file)
--- a/libfio.c
+++ b/libfio.c
@@ -131,10 +131,14 @@ void clear_io_state(struct thread_data *td, int all)
 
 void reset_all_stats(struct thread_data *td)
 {
+       unsigned long long b;
        int i;
 
        reset_io_counters(td, 1);
 
+       b = ddir_rw_sum(td->thinktime_blocks_counter);
+       td->last_thinktime_blocks -= b;
+
        for (i = 0; i < DDIR_RWDIR_CNT; i++) {
                td->io_bytes[i] = 0;
                td->io_blocks[i] = 0;
@@ -149,6 +153,8 @@ void reset_all_stats(struct thread_data *td)
        memcpy(&td->bw_sample_time, &td->epoch, sizeof(td->epoch));
        memcpy(&td->ss.prev_time, &td->epoch, sizeof(td->epoch));
 
+       td->last_thinktime = td->epoch;
+
        lat_target_reset(td);
        clear_rusage_stat(td);
        helper_reset();