diff --git a/lib/rubella/weighting/expotential.rb b/lib/rubella/weighting/expotential.rb index 5ed3c01..f0c1c08 100644 --- a/lib/rubella/weighting/expotential.rb +++ b/lib/rubella/weighting/expotential.rb @@ -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 diff --git a/lib/rubella/weighting/per_overall_load.rb b/lib/rubella/weighting/per_overall_load.rb index a60687b..b0d5622 100644 --- a/lib/rubella/weighting/per_overall_load.rb +++ b/lib/rubella/weighting/per_overall_load.rb @@ -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 diff --git a/lib/rubella/weighting/per_value.rb b/lib/rubella/weighting/per_value.rb index 09b33ae..a100c02 100644 --- a/lib/rubella/weighting/per_value.rb +++ b/lib/rubella/weighting/per_value.rb @@ -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