From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdhCl-00057H-Fh for qemu-devel@nongnu.org; Mon, 13 Oct 2014 11:06:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XdhCf-0004FA-5T for qemu-devel@nongnu.org; Mon, 13 Oct 2014 11:06:35 -0400 Received: from dew.nodalink.com ([95.130.14.197]:40793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdhCe-0004EO-Vd for qemu-devel@nongnu.org; Mon, 13 Oct 2014 11:06:29 -0400 Date: Mon, 13 Oct 2014 15:06:55 +0000 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20141013150654.GD10088@nodalink.com> References: <1411572065-18072-1-git-send-email-benoit.canet@nodalink.com> <1411572065-18072-4-git-send-email-benoit.canet@nodalink.com> <543BC00E.2060907@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <543BC00E.2060907@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 3/3] util: Infrastructure for computing recent averages List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, =?iso-8859-1?Q?Beno=EEt?= Canet , armbru@redhat.com On Mon, Oct 13, 2014 at 02:05:34PM +0200, Paolo Bonzini wrote: > Il 24/09/2014 17:21, Beno=EEt Canet ha scritto: > > The module takes care of computing minimal and maximal > > values over the time slice duration. >=20 > The code looks good, just two comments: >=20 > > +/* 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 =3D current_window(ta); > > + > > + if (w->count) { > > + return w->sum / w->count; >=20 > First, do we want this to return double? >=20 > 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. >=20 > 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? >=20 > 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 floa= t or baking the 1.33 ratio in timed average. Which one would you prefer ? Best regards Beno=EEt Thanks for reviewing. >=20 > Paolo >=20 > > + } > > + > > + 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; > > +} > >=20 >=20