Fix bug in weighting
Now 100 counts to the last bucket. Before it was excluded from being shown...
This commit is contained in:
parent
ebd5b88861
commit
a30db71066
|
@ -25,7 +25,12 @@ module Rubella
|
|||
# every 10 load percent one heatpoint
|
||||
i = 0
|
||||
data_list << Array.new(buckets) do
|
||||
amount = cores.select { |core| core >= i and core < (i+@steps)}.length
|
||||
current_cores = cores.select do |core|
|
||||
core >= i and
|
||||
((core < (i+@steps)) or (core <= (i+@steps) and i+@steps == 100))
|
||||
end
|
||||
|
||||
amount = current_cores.length
|
||||
i = i + @steps
|
||||
core = (amount.to_f*bucket_no**0.8)/cores.length
|
||||
bucket_no = bucket_no + 1
|
||||
|
|
|
@ -32,7 +32,10 @@ module Rubella
|
|||
i = 0
|
||||
data_list << Array.new(buckets) do
|
||||
# Select all current cores
|
||||
selected_cores = cores.select { |core| core >= i and core < (i+@steps)}
|
||||
selected_cores = cores.select do |core|
|
||||
core >= i and
|
||||
((core < (i+@steps)) or (core <= (i+@steps) and i+@steps == 100))
|
||||
end
|
||||
i = i + @steps
|
||||
|
||||
# add the load of the resulting cores and multiply it with the overall value
|
||||
|
|
|
@ -24,8 +24,12 @@ module Rubella
|
|||
# every 10 load percent one heatpoint
|
||||
i = 0
|
||||
data_list << Array.new(buckets) do
|
||||
amount = cores.select { |core| core >= i and core < (i+@steps)}.length
|
||||
i = i + @steps
|
||||
current_cores = cores.select do |core|
|
||||
core >= i and
|
||||
((core < (i+@steps)) or (core <= (i+@steps) and i+@steps == 100))
|
||||
end
|
||||
amount = current_cores.length
|
||||
i = i + @steps
|
||||
amount.to_f/cores.length
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue