Skip to content

Commit

Permalink
metrics: Fix percentage difference row
Browse files Browse the repository at this point in the history
Fix the percentage difference calculation for the metrics report generation.

Fixes kata-containers#709

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
  • Loading branch information
GabyCT committed Sep 28, 2018
1 parent d72794e commit 20cef91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion metrics/report/report_dockerfile/lifecycle-time.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ if (length(resultdirs) == 2) {
# This is a touch hard wired - but we *know* we only have two
# datasets...
for( i in 1:5) {
val = ((as.double(rstats[1,i]) / as.double(rstats[2,i])) * 100) - 100
difference = as.double(rstats[2,i]) - as.double(rstats[1,i])
val = 100 * (difference/as.double(rstats[1,i]))
diff[i] = paste(round(val, digits=2), "%", sep=" ")
}

Expand Down
6 changes: 4 additions & 2 deletions metrics/report/report_dockerfile/memory-footprint.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ 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
difference = (as.double(rstats[2,2]) - as.double(rstats[1,2]))
val = 100 * (difference/as.double(rstats[1,2]))
diff[2] = round(val, digits=2)
val = ((as.double(rstats[1,3]) / as.double(rstats[2,3])) * 100) - 100
difference = (as.double(rstats[2,3]) - as.double(rstats[1,3]))
val = 100 * (difference/as.double(rstats[1,3]))
diff[3] = round(val, digits=2)
rstats=rbind(rstats, diff)

Expand Down

0 comments on commit 20cef91

Please sign in to comment.