logging: expand runstates eligible for logging
authorVincent Fu <vincent.fu@samsung.com>
Wed, 24 Jan 2024 17:41:16 +0000 (17:41 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Tue, 13 Feb 2024 16:44:43 +0000 (11:44 -0500)
commitba03f5afa7cd13a428305298a234db959d3f0c82
treee7d6f0a37854e745fdcf16b946a25937d3e72a93
parente4a0c352f4ce59bbdffcd621143db70faef23f9b
logging: expand runstates eligible for logging

Currently recording log entries for IOPS and BW logging with
log_avg_msec enabled only happens when a thread has completed its ramp
time and is in the TD_RUNNING or TD_VERIFYING run states.

It may happen that a final bandwidth or IOPS log entry is missed
when a job transitions from TD_RUNNING/TD_VERIFYING to TD_FINISHING
before the helper thread has a chance to calculate a final log entry.

This patch expands the run states where logging is permitted, allowing
log entries to be recorded for jobs in the TD_FINISHING or TD_EXITED
states. Each job cleans itself up and typically transitions quickly from
TD_FINISHING to TD_EXITED. The main fio backend thread carries out the
transition from TD_EXITED to TD_REAPED.

The window during which a job is in the TD_FINISHING and TD_EXITED
states is short, so measurements should still be reasonablly accurate.

I tested these patches with the following job:

fio --name=test --ioengine=null --time_based --runtime=3s --filesize=1T \
  --write_iops_log=test --write_bw_log=test --log_avg_msec=1000 \
  && cat test_iops.1.log && cat test_bw.1.log

Before this patch series 10/10 trials had missing log entries. With only
the helper_thread change in the preceding patch 3/10 trials had missing
log entries. With this entire patch series, only 1/10 trials had missing
log entries.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
stat.c