From: Paolo Bonzini <pbonzini@redhat.com>
To: "Benoît Canet" <benoit.canet@irqsave.net>
Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org,
"Benoît Canet" <benoit.canet@nodalink.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/3] util: Add an utility infrastructure used to compute an average on a time slice
Date: Mon, 08 Sep 2014 17:09:38 +0200 [thread overview]
Message-ID: <540DC6B2.8060704@redhat.com> (raw)
In-Reply-To: <20140908144936.GA5723@irqsave.net>
Il 08/09/2014 16:49, Benoît Canet ha scritto:
>> > - create two windows, with twice the suggested expiration period, and
>> > return min/avg/max from the oldest window. Example
>> >
>> > t=0 |t=1 |t=2 |t=3 |t=4
>> > wnd0: [0,1) |wnd0: [1,3) | |wnd0: [3,5) |
>> > wnd1: [0,2) | |wnd1: [2,4) | |
>> >
>> > Values are returned from:
>> >
>> > wnd0---------|wnd1---------|wnd0---------|wnd1---------|
>
> This is neat.
Alternatively, you can make it probabilistically correct:
t=0 |t=0.66 |t=1.33 |t=2 |t=2.66
|wnd0: [0.66,2) | |wnd0: [2,3.33) |
wnd1: [0,0.66) | |wnd1: [1.33,2.66) | |
Return from:
wnd1-----------|wnd1-------------|wnd0---------------|wnd1-------------|wnd0
So you always have 2/3 seconds worth of data, and on average exactly 1 second
worth of data.
The problem is the delay in getting data, which can be big for the minute-
and hour-based statistics. Suppose you have a spike that lasts 10 seconds,
it might not show in the minute-based statistics for as much as 30 seconds
after it ends (the window switches every 40 seconds).
For min/max you could return min(min0, min1) and max(max0, max1). Only the
average has this problem.
Exponential smoothing doesn't have this problem. IIRC uptime uses that.
Paolo
next prev parent reply other threads:[~2014-09-08 15:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-08 12:18 [Qemu-devel] [PATCH v2 0/3] Add the infrastructure that will be used to compute I/O accouting averages Benoît Canet
2014-09-08 12:18 ` [Qemu-devel] [PATCH v2 1/3] throttle: Make NANOSECONDS_PER_SECOND an integer Benoît Canet
2014-09-08 14:46 ` Eric Blake
2014-09-15 10:01 ` Markus Armbruster
2014-09-08 12:18 ` [Qemu-devel] [PATCH v2 2/3] timers: Move NANOSECONDS_PER_SECONDS to timer.h for future reuse Benoît Canet
2014-09-08 14:56 ` Eric Blake
2014-09-08 12:18 ` [Qemu-devel] [PATCH v2 3/3] util: Add an utility infrastructure used to compute an average on a time slice Benoît Canet
2014-09-08 14:29 ` Paolo Bonzini
2014-09-08 14:49 ` Benoît Canet
2014-09-08 15:09 ` Paolo Bonzini [this message]
2014-09-08 15:25 ` Benoît Canet
2014-09-15 11:13 ` Markus Armbruster
2014-09-15 11:41 ` Benoît Canet
2014-09-15 11:44 ` Benoît Canet
2014-09-24 13:26 ` Benoît Canet
2014-09-15 10:23 ` Markus Armbruster
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=540DC6B2.8060704@redhat.com \
--to=pbonzini@redhat.com \
--cc=benoit.canet@irqsave.net \
--cc=benoit.canet@nodalink.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).