-
Notifications
You must be signed in to change notification settings - Fork 0
/
scaling.r
40 lines (34 loc) · 1017 Bytes
/
scaling.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
source("monitor.r")
GetScale <- function(sysDataInfo, firstID, firstRowsIDs, secondID) {
# Calculates number of equal configurations, measured on two machines
#
# Args:
# sysDataInfo: data info of the configurable system
# firstID: first machine ID
# secondID: second machine ID
Monitor()
# Prepare data frames for comparison
a <- tbl_df(sysDataInfo$machinesData[[firstID]][firstRowsIDs, ])
b <- tbl_df(sysDataInfo$machinesData[[secondID]])
# cat("\nData frames for comparison\n")
Monitor(a)
Monitor(b)
# Find same configurations
features <- sysDataInfo$features
af <- a[, features]
b <- left_join(af, b, by = features)
# cat("\nData frames with the same configurations\n")
Monitor(af)
Monitor(b)
# Summarise performance
aSum <- summarise(a, s = sum(PERF))
bSum <- summarise(b, s = sum(PERF))
# Calculate scale
scale <- bSum / aSum
scale <- scale[1,1]
# cat("\nCalculating scale:\n")
Monitor(aSum)
Monitor(bSum)
Monitor(scale)
return(scale)
}