LGTM, thanks

On Thu, 28 Jan 2016 at 12:00 'Klaus Aehlig' via ganeti-devel <
[email protected]> wrote:

> When determining which observations to take for computing the node load,
> only keep those that happened after the beginning of the current window,
> not those that happened after a window size after the beginning of the
> epoch. While there, also make sure the buffer size is interpreted as
> seconds, not as microseconds.
>
> Signed-off-by: Klaus Aehlig <[email protected]>
> ---
>  src/Ganeti/DataCollectors/CPUload.hs | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/Ganeti/DataCollectors/CPUload.hs
> b/src/Ganeti/DataCollectors/CPUload.hs
> index 1fe2fd7..ca9376c 100644
> --- a/src/Ganeti/DataCollectors/CPUload.hs
> +++ b/src/Ganeti/DataCollectors/CPUload.hs
> @@ -45,6 +45,7 @@ module Ganeti.DataCollectors.CPUload
>
>  import Control.Arrow (first)
>  import qualified Control.Exception as E
> +import Control.Monad (liftM)
>  import Data.Attoparsec.Text.Lazy as A
>  import Data.Maybe (fromMaybe)
>  import Data.Text.Lazy (pack, unpack)
> @@ -71,8 +72,8 @@ bufferSize :: Int
>  bufferSize = C.cpuavgloadBufferSize
>
>  -- | The window size of the values that will export the average load.
> -windowSize :: Integer
> -windowSize = toInteger C.cpuavgloadWindowSize
> +windowSizeInUSec :: Integer
> +windowSizeInUSec = 1000000 * toInteger C.cpuavgloadWindowSize
>
>  -- | The default setting for the maximum amount of not parsed character to
>  -- print in case of error.
> @@ -187,7 +188,8 @@ computeAverage s w ticks =
>  buildJsonReport :: Buffer -> IO J.JSValue
>  buildJsonReport v = do
>    ticks <- getSysVar ClockTick
> -  let res = computeAverage v windowSize ticks
> +  now <- liftM clockTimeToUSec getClockTime
> +  let res = computeAverage v (now - windowSizeInUSec) ticks
>        showError s = J.showJSON $ GJ.containerFromList [("error", s)]
>    return $ BT.genericResult showError (J.showJSON . formatData) res
>
> --
> 2.7.0.rc3.207.g0ac5344
>
> --

Helga Velroyen
Software Engineer
[email protected]

Google Germany GmbH
Erika-Mann-Strasse 33
80636 München

Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Wenn Sie nicht der richtige Adressat sind,
leiten Sie diese bitte nicht weiter, informieren Sie den Absender und
löschen Sie die E-Mail und alle Anhänge. Vielen Dank.

This e-mail is confidential. If you are not the right addressee please do
not forward it, please inform the sender, and please erase this e-mail
including any attachments. Thanks.

Reply via email to