0
0
Fork 0

Fix bug in weighting

Now 100 counts to the last bucket.
Before it was excluded from being shown...
This commit is contained in:
Stormwind 2015-05-05 21:26:54 +02:00
parent ebd5b88861
commit a30db71066
3 changed files with 16 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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