Flexible I/O Tester development
 help / color / mirror / Atom feed
* Bug in stats, KB/s vs. KiB/s?
@ 2009-04-19 13:07 Carl Henrik Lunde
  2009-04-20  6:52 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Carl Henrik Lunde @ 2009-04-19 13:07 UTC (permalink / raw)
  To: fio

Hi!  I think there's a bug in the stats report:

When I specify rate=8192 I got 8388 KiB/s in the report, which happens
to be 8192*1.024.

I believe the problem is that bytes / ms is used as KiB/s.  I'm not
sure what the correct value of "base" should be (1000 vs. 1024), but
it doesn't affect the result.  I haven't reviewed all the reporting,
but at least I *think* these three are wrong.

diff --git a/stat.c b/stat.c
index 5fecbd0..9fd0255 100644
--- a/stat.c
+++ b/stat.c
@@ -199,10 +199,10 @@ static void show_ddir_status(struct
group_run_stats *rs, struct thread_stat *ts,
        if (!ts->runtime[ddir])
                return;

-       bw = ts->io_bytes[ddir] / ts->runtime[ddir];
+       bw = (1000 * ts->io_bytes[ddir]) / ts->runtime[ddir];
        iops = (1000 * ts->total_io_u[ddir]) / ts->runtime[ddir];
-       io_p = num2str(ts->io_bytes[ddir] >> 10, 6, 1000, 1);
-       bw_p = num2str(bw, 6, 1000, 1);
+       io_p = num2str(ts->io_bytes[ddir] >> 10, 6, 1024, 1);
+       bw_p = num2str(bw >> 10, 6, 1024, 1);
        iops_p = num2str(iops, 6, 1, 0);

        log_info("  %s: io=%siB, bw=%siB/s, iops=%s, runt=%6lumsec\n",
@@ -623,8 +623,9 @@ void show_run_stats(void)

                        bw = 0;
                        if (ts->runtime[j])
-                               bw = ts->io_bytes[j]
-                                       / (unsigned long long) ts->runtime[j];
+                               bw = (1000 * ts->io_bytes[j])
+                                       / (unsigned long long) ts->runtime[j]
+                                       / 1024;
                        if (bw < rs->min_bw[j])
                                rs->min_bw[j] = bw;
                        if (bw > rs->max_bw[j])
@@ -750,7 +751,7 @@ void add_bw_sample(struct thread_data *td, enum
fio_ddir ddir,
        if (spent < td->o.bw_avg_time)
                return;

-       rate = (td->this_io_bytes[ddir] - ts->stat_io_bytes[ddir]) / spent;
+       rate = (td->this_io_bytes[ddir] - ts->stat_io_bytes[ddir]) *
1000 / spent / 1024;
        add_stat_sample(&ts->bw_stat[ddir], rate);

        if (ts->bw_log)




-- 
mvh
Carl Henrik

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Bug in stats, KB/s vs. KiB/s?
  2009-04-19 13:07 Bug in stats, KB/s vs. KiB/s? Carl Henrik Lunde
@ 2009-04-20  6:52 ` Jens Axboe
  2009-04-20  6:59   ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2009-04-20  6:52 UTC (permalink / raw)
  To: Carl Henrik Lunde; +Cc: fio

On Sun, Apr 19 2009, Carl Henrik Lunde wrote:
> Hi!  I think there's a bug in the stats report:
> 
> When I specify rate=8192 I got 8388 KiB/s in the report, which happens
> to be 8192*1.024.
> 
> I believe the problem is that bytes / ms is used as KiB/s.  I'm not
> sure what the correct value of "base" should be (1000 vs. 1024), but
> it doesn't affect the result.  I haven't reviewed all the reporting,
> but at least I *think* these three are wrong.

Hmm, it actually seems like the reporting is correct, but that the rate
throttling is off by 1024/1000. So the fix is likely there somewhere,
I'll take a look.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug in stats, KB/s vs. KiB/s?
  2009-04-20  6:52 ` Jens Axboe
@ 2009-04-20  6:59   ` Jens Axboe
  2009-04-20  8:12     ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2009-04-20  6:59 UTC (permalink / raw)
  To: Carl Henrik Lunde; +Cc: fio

On Mon, Apr 20 2009, Jens Axboe wrote:
> On Sun, Apr 19 2009, Carl Henrik Lunde wrote:
> > Hi!  I think there's a bug in the stats report:
> > 
> > When I specify rate=8192 I got 8388 KiB/s in the report, which happens
> > to be 8192*1.024.
> > 
> > I believe the problem is that bytes / ms is used as KiB/s.  I'm not
> > sure what the correct value of "base" should be (1000 vs. 1024), but
> > it doesn't affect the result.  I haven't reviewed all the reporting,
> > but at least I *think* these three are wrong.
> 
> Hmm, it actually seems like the reporting is correct, but that the rate
> throttling is off by 1024/1000. So the fix is likely there somewhere,
> I'll take a look.

Hmm nope, I think you are right, it's the reporting. Looking further...

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug in stats, KB/s vs. KiB/s?
  2009-04-20  6:59   ` Jens Axboe
@ 2009-04-20  8:12     ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2009-04-20  8:12 UTC (permalink / raw)
  To: Carl Henrik Lunde; +Cc: fio

On Mon, Apr 20 2009, Jens Axboe wrote:
> On Mon, Apr 20 2009, Jens Axboe wrote:
> > On Sun, Apr 19 2009, Carl Henrik Lunde wrote:
> > > Hi!  I think there's a bug in the stats report:
> > > 
> > > When I specify rate=8192 I got 8388 KiB/s in the report, which happens
> > > to be 8192*1.024.
> > > 
> > > I believe the problem is that bytes / ms is used as KiB/s.  I'm not
> > > sure what the correct value of "base" should be (1000 vs. 1024), but
> > > it doesn't affect the result.  I haven't reviewed all the reporting,
> > > but at least I *think* these three are wrong.
> > 
> > Hmm, it actually seems like the reporting is correct, but that the rate
> > throttling is off by 1024/1000. So the fix is likely there somewhere,
> > I'll take a look.
> 
> Hmm nope, I think you are right, it's the reporting. Looking further...

I hope it works alright now, can you check? I checked in a patch based
on your patch, as far as I can tell, it's fine now.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-04-20  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-19 13:07 Bug in stats, KB/s vs. KiB/s? Carl Henrik Lunde
2009-04-20  6:52 ` Jens Axboe
2009-04-20  6:59   ` Jens Axboe
2009-04-20  8:12     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox