Flexible I/O Tester development
 help / color / mirror / Atom feed
From: Steven Pratt <slpratt@austin.ibm.com>
To: "fio@vger.kernel.org" <fio@vger.kernel.org>,
	Jens Axboe <JAxboe@fusionio.com>
Subject: [PATCH] fix ramp_in
Date: Mon, 13 Dec 2010 12:50:24 -0700	[thread overview]
Message-ID: <4D067900.7080004@austin.ibm.com> (raw)

There are a couple of problems with the relatively new ramp_in feature 
of fio.  First, the estimated time to completion did not correctly take 
it into account and bounces around. Second and more importantly, the 
runtime was including ramp in time in throughput calculations even 
though the IO done during that time was ignored, thus making throughput 
metrics incorrect. This patch fixes both.

Signed-off-by Steven Pratt <slpratt@austin.ibm.com>

 eta.c  |    4 ++--
 fio.c  |   12 +++++++-----
 fio.h  |    2 +-
 stat.c |    4 ++--
 4 files changed, 12 insertions(+), 10 deletions(-)

diff -Naur fio-1.44.1/eta.c fio-ramp/eta.c    
--- fio-1.44.1/eta.c    2010-10-22 14:44:00.000000000 -0500
+++ fio-ramp/eta.c      2010-12-13 13:28:50.573808191 -0600
@@ -161,12 +161,12 @@                                     
                 * if given, otherwise assume it'll run at the specified 
rate.
                 
*/                                                          
                if (td->o.timeout) 
{                                         
-                       t_eta = td->o.timeout + 
td->o.start_delay;           
+                       t_eta = td->o.timeout + td->o.start_delay 
+td->o.ramp_time;
                                                                                   

                        if (in_ramp_time(td)) 
{                                   
                                unsigned long 
ramp_left;                          
                                                                                   

-                               ramp_left = 
mtime_since_now(&td->start);          
+                               ramp_left = 
mtime_since_now(&td->epoch);          
                                ramp_left = (ramp_left + 999) / 
1000;             
                                if (ramp_left <= 
t_eta)                           
                                        t_eta -= 
ramp_left;                       
diff -Naur fio-1.44.1/fio.c 
fio-ramp/fio.c                                        
--- fio-1.44.1/fio.c    2010-10-22 14:44:00.000000000 
-0500                       
+++ fio-ramp/fio.c      2010-12-13 13:29:36.611258945 
-0600                       
@@ -972,6 +972,8 
@@                                                               
        
}                                                                         
                                                                                   

        fio_gettime(&tv, 
NULL);                                                   
+       td->ts.runtime[0] = 
0;                                                    
+       td->ts.runtime[1] = 
0;                                                    
        memcpy(&td->epoch, &tv, 
sizeof(tv));                                      
        memcpy(&td->start, &tv, 
sizeof(tv));                                      
 }                                                                                 

@@ -1153,11 +1155,11 
@@                                                           
                                                                                   

                if (td_read(td) && td->io_bytes[DDIR_READ]) 
{                     
                        elapsed = 
utime_since_now(&td->start);                    
-                       runtime[DDIR_READ] += 
elapsed;                            
+                       td->ts.runtime[DDIR_READ] += 
elapsed;                     
                
}                                                                 
                if (td_write(td) && td->io_bytes[DDIR_WRITE]) 
{                   
                        elapsed = 
utime_since_now(&td->start);                    
-                       runtime[DDIR_WRITE] += 
elapsed;                           
+                       td->ts.runtime[DDIR_WRITE] += 
elapsed;                    
                
}                                                                 
                                                                                   

                if (td->error || 
td->terminate)                                   
@@ -1174,15 +1176,15 
@@                                                           
                                                                                   

                
do_verify(td);                                                    
                                                                                   

-               runtime[DDIR_READ] += 
utime_since_now(&td->start);                
+               td->ts.runtime[DDIR_READ] += 
utime_since_now(&td->start);         
                                                                                   

                if (td->error || td->terminate)
                        break;
        }

        update_rusage_stat(td);
-       td->ts.runtime[0] = (runtime[0] + 999) / 1000;
-       td->ts.runtime[1] = (runtime[1] + 999) / 1000;
+       td->ts.runtime[0] = (td->ts.runtime[0] + 999) / 1000;
+       td->ts.runtime[1] = (td->ts.runtime[1] + 999) / 1000;
        td->ts.total_run_time = mtime_since_now(&td->epoch);
        td->ts.io_bytes[0] = td->io_bytes[0];
        td->ts.io_bytes[1] = td->io_bytes[1];
diff -Naur fio-1.44.1/fio.h fio-ramp/fio.h
--- fio-1.44.1/fio.h    2010-10-22 14:44:00.000000000 -0500
+++ fio-ramp/fio.h      2010-10-29 16:30:55.000000000 -0500
@@ -126,7 +126,7 @@
        unsigned long total_complete;

        unsigned long long io_bytes[2];
-       unsigned long runtime[2];
+       unsigned long long runtime[2];
        unsigned long total_run_time;

        /*
diff -Naur fio-1.44.1/stat.c fio-ramp/stat.c
--- fio-1.44.1/stat.c   2010-10-22 14:44:00.000000000 -0500
+++ fio-ramp/stat.c     2010-10-29 16:33:49.000000000 -0500
@@ -172,7 +172,7 @@
        iops = (1000 * ts->total_io_u[ddir]) / runt;
        iops_p = num2str(iops, 6, 1, 0);

-       log_info("  %s: io=%sB, bw=%sB/s, iops=%s, runt=%6lumsec\n",
+       log_info("  %s: io=%sB, bw=%sB/s, iops=%s, runt=%6llumsec\n",
                                        ddir_str[ddir], io_p, bw_p, iops_p,
                                        ts->runtime[ddir]);

@@ -380,7 +380,7 @@
        if (ts->runtime[ddir])
                bw = ts->io_bytes[ddir] / ts->runtime[ddir];

-       log_info(";%llu;%llu;%lu", ts->io_bytes[ddir] >> 10, bw,
+       log_info(";%llu;%llu;%llu", ts->io_bytes[ddir] >> 10, bw,
                                                        ts->runtime[ddir]);

        if (calc_lat(&ts->slat_stat[ddir], &min, &max, &mean, &dev))



                 reply	other threads:[~2010-12-13 19:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D067900.7080004@austin.ibm.com \
    --to=slpratt@austin.ibm.com \
    --cc=JAxboe@fusionio.com \
    --cc=fio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox