[Ovirt-devel] re: got it!
Mohammed Morsi
mmorsi at redhat.com
Tue Jul 29 19:24:50 UTC 2008
mark wagner wrote:
>
>
> Steve Linabery wrote:
>> Pursuant to my previous email with same subject line...
>>
>> Here's a bit of follow-up information.
>>
>> The
>> 0.upto(@pool.hosts.total_memory) { |x| if x %
>> 1024 == 0
>> scale.push((x / 1024).to_s) # divide by 1024 to
>> convert to MB
>> end
>> }
>
> Would seem to be easier and quicker to do something like the following
> pseudo code
>
> ticks = pool.hosts.total_memory / 1024
> 0.upto(@ticks)
> { |x|
> scale.push(x.to_s)
> end
> }
>
> Not saying its that its the correct or even the best solution, just
> that it
> would seem to be faster... You are going through the loop 1024 times
> less and
> only doing one divide ( in this case the divide probably gets turned
> into 10
> right shifts) instead of pool.hosts.total_memory divides and comparisons.
Ya that looks like a better algorithm to do what was intended.
>
>>
>> block eventually completes, after several minutes, before which the
>> request times out.
>>
> Sounds like you need a faster computer....
>
>> On my setup, @pool.hosts.total_memory is 522555392.
> Is that in KB or bytes ?
> The comment in the code indicated that it was dividing by 1024 to get MB.
> Do you have 522 GB of memory in your pool?
I believe memory is stored in KB.
>
> -mark
>>
>
>
>> There's no infinite loop.
>>
>> --Steve
>>
>> _______________________________________________
>> Ovirt-devel mailing list
>> Ovirt-devel at redhat.com
>> https://www.redhat.com/mailman/listinfo/ovirt-devel
>
> _______________________________________________
> Ovirt-devel mailing list
> Ovirt-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/ovirt-devel
More information about the ovirt-devel
mailing list