From 56262e2b35892962ab7f2dd019b4e44ef14514f2 Mon Sep 17 00:00:00 2001 From: Gabriela Cervantes Date: Wed, 26 Sep 2018 07:11:03 -0500 Subject: [PATCH] metrics: Fix percentage difference row Fix the percentage difference calculation for the metrics report generation. Fixes #709 Signed-off-by: Gabriela Cervantes --- metrics/report/report_dockerfile/memory-footprint.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/metrics/report/report_dockerfile/memory-footprint.R b/metrics/report/report_dockerfile/memory-footprint.R index fd16a3260c..c6bea661b5 100755 --- a/metrics/report/report_dockerfile/memory-footprint.R +++ b/metrics/report/report_dockerfile/memory-footprint.R @@ -82,9 +82,13 @@ if (length(resultdirs) == 2) { # This is a touch hard wired - but we *know* we only have two # datasets... diff=c("diff") - val = ((as.double(rstats[1,2]) / as.double(rstats[2,2])) * 100) - 100 + diference = abs(as.double(rstats[1,2]) - as.double(rstats[2,2])) + average = (as.double(rstats[1,2]) + as.double(rstats[2,2])) / 2 + val = 100 * (diference/average) diff[2] = round(val, digits=2) - val = ((as.double(rstats[1,3]) / as.double(rstats[2,3])) * 100) - 100 + diference = abs(as.double(rstats[1,3]) - as.double(rstats[2,3])) + average = (as.double(rstats[1,3]) + as.double(rstats[2,3])) / 2 + val = 100 * (diference/average) diff[3] = round(val, digits=2) rstats=rbind(rstats, diff)