[libvirt] [libvirt-test-api][PATCH 2/3] improve the way we get the standard deviation

jiahu jiahu at redhat.com
Mon May 18 02:40:24 UTC 2015


On 05/18/2015 09:28 AM, Luyao Huang wrote:
> Signed-off-by: Luyao Huang <lhuang at redhat.com>
> ---
>   utils/utils.py | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/utils/utils.py b/utils/utils.py
> index 954b2bf..a6e6965 100644
> --- a/utils/utils.py
> +++ b/utils/utils.py
> @@ -906,9 +906,10 @@ def get_standard_deviation(cb1, cb2, opaque1, opaque2, number = 1000):
>       """
>       D = 0
>       for i in range(number):
> -        a = cb1(opaque1)
> +        a1 = cb1(opaque1)
>           b = cb2(opaque2)
> -        D += (int(a) - int(b))**2
> +        a2 = cb1(opaque1)
> +        D += ((int(a1) + int(a2))/2 - int(b))**2
>       return math.sqrt(D/number)
>   
ACK, this will spend a double time, whatever, we need a more accurate 
return.
>   def param_to_tuple_nolength(paramlist):




More information about the libvir-list mailing list