Signed-off-by: Zhang Yuhang zhangyuhang25@huawei.com --- lib/compare_matrixes.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/compare_matrixes.rb b/lib/compare_matrixes.rb index 4b23cbb..c22724b 100644 --- a/lib/compare_matrixes.rb +++ b/lib/compare_matrixes.rb @@ -53,14 +53,18 @@ def latency?(field) end
# Core +def get_length_sum_average_sorted(value_list) + length = value_list.length + sum = value_list.sum + average = sum / length.to_f + sorted = value_list.sort + return length, sum, average, sorted +end
def get_values(value_list, success) # get values(type: Hash) that include :average, :runs, :stddev_percent, ... # - sum = value_list.sum - length = value_list.length - average = sum / length - sorted = value_list.sort + length, sum, average, sorted = get_length_sum_average_sorted(value_list) if success stddev_percent = nil if length > 1 && average != 0