Skip to contentSkip to conversation

fio: reset more counters when ramp time has elapsed

PATCH In review [email protected] 3 participants 4 messages Oct 18, 2018

lore
Share & tools
lore
#0 lore raw

v2 cover fio: reset more counters when ramp time has elapsed

From: Vincent Fu <[email protected]>

Jens, I sent the wrong patch earlier.

This version should be safer since reset_io_stats() is now called in ramp_time_over() instead of in reset_all_stats().

Vincent Fu (1):
fio: reset more counters when ramp time has elapsed

 time.c | 1 +
 1 file changed, 1 insertion(+)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/1 fio: reset more counters when ramp time has elapsed

From: Vincent Fu <[email protected]>

Currently,

fio --name=test --ramp_time=2 --time_based=1 --runtime=2s --size=1M

will produce an output line like

IO depths : 1=184.7%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%

184.7% appears because the denominator used in the IO depth calculation is reset at the conclusion of ramp_time but the numerator is not. Latency and other IO depth statistics also include data from IOs completed during ramp time. This patch resets these counters when ramp time is over.

---
 time.c | 1 +
 1 file changed, 1 insertion(+)
time.c +1 -0
index c8876829..19999699 100644
@@ -118,6 +118,7 @@ bool ramp_time_over(struct thread_data *td)
 	if (utime_since_now(&td->epoch) >= td->o.ramp_time) {
 		td->ramp_time_over = true;
 		reset_all_stats(td);
+		reset_io_stats(td);
 		td_set_runstate(td, TD_RAMP);
 
 		/*
Signature · 1 line
2.17.1
Tested-by on v2 1/1
#2 lore raw
Quoted 9 lines · On 2018-10-18 4:42 p.m., [email protected] wrote:

From: Vincent Fu <[email protected]>

Currently,

fio --name=test --ramp_time=2 --time_based=1 --runtime=2s --size=1M

will produce an output line like

IO depths : 1=184.7%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%

I reproduced this with fio d5dbacf662b1cc3fb09b5cd70b236ab98d1c0dbe :

[sboisvert@GT480:fio]$ ./fio --name=test --ramp_time=2 --time_based=1 --runtime=2s --size=1M | grep "IO depths"
  IO depths    : 1=184.1%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
Quoted 16 lines

184.7% appears because the denominator used in the IO depth calculation is reset at the conclusion of ramp_time but the numerator is not. Latency and other IO depth statistics also include data from IOs completed during ramp time. This patch resets these counters when ramp time is over.

---
 time.c | 1 +
 1 file changed, 1 insertion(+)
time.c +0 -0
index c8876829..19999699 100644

time.c bool ramp_time_over(struct thread_data *td) · line 124

Quoted 7 lines
time.c +1 -0
@@ -118,6 +118,7 @@ bool ramp_time_over(struct thread_data *td)
 	if (utime_since_now(&td->epoch) >= td->o.ramp_time) {
 		td->ramp_time_over = true;
 		reset_all_stats(td);
+		reset_io_stats(td);
 		td_set_runstate(td, TD_RAMP);
 
 		/*

With d5dbacf662b1cc3fb09b5cd70b236ab98d1c0dbe + this patch :

[sboisvert@GT480:fio]$ ./fio --name=test --ramp_time=2 --time_based=1 --runtime=2s --size=1M | grep "IO depths"
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%

Thanks