From: "Benoît Canet" <benoit.canet@nodalink.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org,
"Benoît Canet" <benoit.canet@nodalink.com>,
armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 3/3] util: Infrastructure for computing recent averages
Date: Mon, 13 Oct 2014 15:06:55 +0000 [thread overview]
Message-ID: <20141013150654.GD10088@nodalink.com> (raw)
In-Reply-To: <543BC00E.2060907@redhat.com>
On Mon, Oct 13, 2014 at 02:05:34PM +0200, Paolo Bonzini wrote:
> Il 24/09/2014 17:21, Benoît Canet ha scritto:
> > The module takes care of computing minimal and maximal
> > values over the time slice duration.
>
> The code looks good, just two comments:
>
> > +/* Get the average value
> > + *
> > + * @ta: the timed average structure used
> > + * @ret: the average value
> > + */
> > +uint64_t timed_average_avg(TimedAverage *ta)
> > +{
> > + Window *w;
> > + check_expirations(ta);
> > +
> > + w = current_window(ta);
> > +
> > + if (w->count) {
> > + return w->sum / w->count;
>
> First, do we want this to return double?
>
> Second, this will return the min/max/avg in an unknown amount of time
> between period/2 and period---on average period*3/4, e.g. 0.75 seconds
> for a period equal to one second.
>
> Would it make sense to tweak the TimedAverage period to be higher, e.g.
> 1.33 seconds/80 seconds/80 minutes, so that the _average_ period is 1
> second/1 minute/1 hour?
>
> This only applies to how the code is used, not to TimedAverage itself;
> hence, feel free to post the patch with Reviewed-by once
> timed_average_avg's return type is changed to a double.
This would require either changing _init period units or making it a float
or baking the 1.33 ratio in timed average.
Which one would you prefer ?
Best regards
Benoît
Thanks for reviewing.
>
> Paolo
>
> > + }
> > +
> > + return 0;
> > +}
> > +
> > +/* Get the maximum value
> > + *
> > + * @ta: the timed average structure used
> > + * @ret: the maximal value
> > + */
> > +uint64_t timed_average_max(TimedAverage *ta)
> > +{
> > + check_expirations(ta);
> > + return current_window(ta)->max;
> > +}
> >
>
prev parent reply other threads:[~2014-10-13 15:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-24 15:21 [Qemu-devel] [PATCH v3 0/3] timed average infrastructure for use in block statistics Benoît Canet
2014-09-24 15:21 ` [Qemu-devel] [PATCH v3 1/3] throttle: Make NANOSECONDS_PER_SECOND an integer Benoît Canet
2014-09-24 16:33 ` Eric Blake
2014-09-24 15:21 ` [Qemu-devel] [PATCH v3 2/3] timers: Move NANOSECONDS_PER_SECONDS to timer.h for future reuse Benoît Canet
2014-09-24 15:33 ` Paolo Bonzini
2014-09-24 15:33 ` Paolo Bonzini
2014-09-29 16:04 ` Benoît Canet
2014-09-29 21:54 ` Paolo Bonzini
2014-09-29 23:08 ` Benoît Canet
2014-09-24 15:21 ` [Qemu-devel] [PATCH v3 3/3] util: Infrastructure for computing recent averages Benoît Canet
2014-10-13 12:05 ` Paolo Bonzini
2014-10-13 15:06 ` Benoît Canet [this message]
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=20141013150654.GD10088@nodalink.com \
--to=benoit.canet@nodalink.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).