* [PATCH RFC] gauss.c: correct the stddev initializtion
@ 2020-03-17 12:53 Feng Tang
2020-03-17 14:34 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Feng Tang @ 2020-03-17 12:53 UTC (permalink / raw)
To: Jens Axboe, fio; +Cc: Feng Tang
Signed-off-by: Feng Tang <feng.tang@intel.com>
---
lib/gauss.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/gauss.c b/lib/gauss.c
index 1d24e187..3f84dbc6 100644
--- a/lib/gauss.c
+++ b/lib/gauss.c
@@ -51,7 +51,7 @@ void gauss_init(struct gauss_state *gs, unsigned long nranges, double dev,
gs->nranges = nranges;
if (dev != 0.0) {
- gs->stddev = ceil((double) (nranges * 100.0) / dev);
+ gs->stddev = ceil((double)(nranges * dev) / 100.0);
if (gs->stddev > nranges / 2)
gs->stddev = nranges / 2;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH RFC] gauss.c: correct the stddev initializtion
2020-03-17 12:53 [PATCH RFC] gauss.c: correct the stddev initializtion Feng Tang
@ 2020-03-17 14:34 ` Jens Axboe
2020-03-17 14:52 ` Feng Tang
0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2020-03-17 14:34 UTC (permalink / raw)
To: Feng Tang, fio
On 3/17/20 6:53 AM, Feng Tang wrote:
> Signed-off-by: Feng Tang <feng.tang@intel.com>
> ---
> lib/gauss.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/gauss.c b/lib/gauss.c
> index 1d24e187..3f84dbc6 100644
> --- a/lib/gauss.c
> +++ b/lib/gauss.c
> @@ -51,7 +51,7 @@ void gauss_init(struct gauss_state *gs, unsigned long nranges, double dev,
> gs->nranges = nranges;
>
> if (dev != 0.0) {
> - gs->stddev = ceil((double) (nranges * 100.0) / dev);
> + gs->stddev = ceil((double)(nranges * dev) / 100.0);
> if (gs->stddev > nranges / 2)
> gs->stddev = nranges / 2;
> }
Looks like I very helpfully did not include a reference to to where
this is from... Can you expand on the need for the patch?
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH RFC] gauss.c: correct the stddev initializtion
2020-03-17 14:34 ` Jens Axboe
@ 2020-03-17 14:52 ` Feng Tang
2020-03-17 14:56 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Feng Tang @ 2020-03-17 14:52 UTC (permalink / raw)
To: Jens Axboe; +Cc: fio
Hi,
On Tue, Mar 17, 2020 at 08:34:48AM -0600, Jens Axboe wrote:
> On 3/17/20 6:53 AM, Feng Tang wrote:
> > Signed-off-by: Feng Tang <feng.tang@intel.com>
> > ---
> > lib/gauss.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/gauss.c b/lib/gauss.c
> > index 1d24e187..3f84dbc6 100644
> > --- a/lib/gauss.c
> > +++ b/lib/gauss.c
> > @@ -51,7 +51,7 @@ void gauss_init(struct gauss_state *gs, unsigned long nranges, double dev,
> > gs->nranges = nranges;
> >
> > if (dev != 0.0) {
> > - gs->stddev = ceil((double) (nranges * 100.0) / dev);
> > + gs->stddev = ceil((double)(nranges * dev) / 100.0);
> > if (gs->stddev > nranges / 2)
> > gs->stddev = nranges / 2;
> > }
>
> Looks like I very helpfully did not include a reference to to where
> this is from... Can you expand on the need for the patch?
Thanks for your prompt response!
I tried to run fio with "random_distribution=normal:20" as one
parameter, and didn't notice it has difference with "normal:50",
so I went to read the source code, as the man page says the
deviation ranges from 0 to 100, so this gs->stddev will
always be "nranges/2". Or I misunderstood the man page?
Thanks,
Feng
>
> --
> Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH RFC] gauss.c: correct the stddev initializtion
2020-03-17 14:52 ` Feng Tang
@ 2020-03-17 14:56 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2020-03-17 14:56 UTC (permalink / raw)
To: Feng Tang; +Cc: fio
On 3/17/20 8:52 AM, Feng Tang wrote:
> Hi,
>
> On Tue, Mar 17, 2020 at 08:34:48AM -0600, Jens Axboe wrote:
>> On 3/17/20 6:53 AM, Feng Tang wrote:
>>> Signed-off-by: Feng Tang <feng.tang@intel.com>
>>> ---
>>> lib/gauss.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/lib/gauss.c b/lib/gauss.c
>>> index 1d24e187..3f84dbc6 100644
>>> --- a/lib/gauss.c
>>> +++ b/lib/gauss.c
>>> @@ -51,7 +51,7 @@ void gauss_init(struct gauss_state *gs, unsigned long nranges, double dev,
>>> gs->nranges = nranges;
>>>
>>> if (dev != 0.0) {
>>> - gs->stddev = ceil((double) (nranges * 100.0) / dev);
>>> + gs->stddev = ceil((double)(nranges * dev) / 100.0);
>>> if (gs->stddev > nranges / 2)
>>> gs->stddev = nranges / 2;
>>> }
>>
>> Looks like I very helpfully did not include a reference to to where
>> this is from... Can you expand on the need for the patch?
>
> Thanks for your prompt response!
>
> I tried to run fio with "random_distribution=normal:20" as one
> parameter, and didn't notice it has difference with "normal:50",
> so I went to read the source code, as the man page says the
> deviation ranges from 0 to 100, so this gs->stddev will
> always be "nranges/2". Or I misunderstood the man page?
Nope I think you are right, I looked up the original change
that made it a parameter:
https://git.kernel.dk/cgit/fio/commit/?id=3cdb8cf38198d5cea73074d427ae310320e1d65f
and that clearly indicates that your patch is correct. I'll
apply it, thanks!
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-17 14:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-17 12:53 [PATCH RFC] gauss.c: correct the stddev initializtion Feng Tang
2020-03-17 14:34 ` Jens Axboe
2020-03-17 14:52 ` Feng Tang
2020-03-17 14:56 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox