From 2f61b479eb0f1331cc097dfadbdf9d3797295bc6 Mon Sep 17 00:00:00 2001 From: Stormwind Date: Sun, 26 Apr 2015 19:08:34 +0200 Subject: [PATCH] Remove static setting of total amount of cores --- lib/rubella/weighting/expotential.rb | 4 +--- lib/rubella/weighting/per_value.rb | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/rubella/weighting/expotential.rb b/lib/rubella/weighting/expotential.rb index 65dd44d..5ed3c01 100644 --- a/lib/rubella/weighting/expotential.rb +++ b/lib/rubella/weighting/expotential.rb @@ -20,16 +20,14 @@ module Rubella # prepare data data_list = Array.new() bucket_no = 0 - total_amount = nil input.each do |cores| - total_amount = cores.length if total_amount.nil? # 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 - core = (amount.to_f*bucket_no**0.8)/total_amount + core = (amount.to_f*bucket_no**0.8)/cores.length bucket_no = bucket_no + 1 core diff --git a/lib/rubella/weighting/per_value.rb b/lib/rubella/weighting/per_value.rb index 2d5a8d6..09b33ae 100644 --- a/lib/rubella/weighting/per_value.rb +++ b/lib/rubella/weighting/per_value.rb @@ -19,16 +19,14 @@ module Rubella def parse input # prepare data data_list = Array.new() - total_amount = nil input.each do |cores| - total_amount = cores.length if total_amount.nil? # 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 - amount.to_f/total_amount + amount.to_f/cores.length end end