-
Notifications
You must be signed in to change notification settings - Fork 0
/
OCAT - Combined - Input.r
220 lines (175 loc) · 6.31 KB
/
OCAT - Combined - Input.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
library(readr)
library(ggplot2)
library(moments)
game = "!GAME!"
cGPU = !GPU!
SUBSET = "!QUA!"
gameF = gsub(":", "-", game)
gameF = unlist(strsplit(gameF, split=" [(]"))[1]
theme_set(theme_grey(base_size = 16))
DPI = 120
ggdevice = "png"
useSHORT = TRUE
testAPI = FALSE
listFPS = NULL
# for adding to the FPS Percentile list
diffLim = NULL
QUAN = c(0.01, 0.99)
FtimeLimit = 1000/15
yratesEXT = NULL
gWIDTH = 8
gHEIGH = 9
ogHEIGH = gHEIGH
app.BREAK = TRUE
# switch for if line breaks should be used in the labels
# can be changed prior to graphs being created for selective application
facWID = 25
# control for width for text wrapping in the Location facet label
# default value for label_wrap_gen is 25
testQUA = FALSE
textOUT = TRUE
HTMLOUT = TRUE
graphs = TRUE
graphs_all = FALSE
textFRAM = TRUE
graphFRAM = TRUE
textDISP = FALSE
graphDISP = FALSE
textREND = FALSE
graphREND = FALSE
textDRIV = FALSE
graphDRIV = FALSE
textAPI = FALSE
textLOC = FALSE
# will generate TXT and HTML, if HTML is enabled, files for each API/Location
textDiff = FALSE
graphDiff = FALSE
# cannot be DIFF because of naming conflict in Output
if (interactive()) {
setwd("!PATH!")
} else {
pdf(NULL)
}
# checks if the script is being run in the GUI or not
# prevents rplots.pdf from being generated
relPath = paste0(unlist(strsplit(getwd(), "OCAT Data"))[1], "OCAT Data")
txtFIND = function(TXT, rel.Path = relPath) {
if (file.exists(TXT)) {
return(readLines(TXT, warn = FALSE))
} else {
locFILE = paste0(rel.Path, "/", TXT)
if (file.exists(locFILE)) return(readLines(locFILE, warn = FALSE))
}
return(NULL)
}
listGPU = c(
"RX 580",
"RX Vega 64",
"GTX 770",
"GTX 980",
"GTX 1070",
"GTX 1080",
"RTX 2060",
"RTX 2080"
)
listQUA = txtFIND("Qualities.txt")
listLOC = txtFIND("Locations.txt")
shortLOC = txtFIND("Locations Short.txt")
levsLOC = listLOC
if (useSHORT & !is.null(shortLOC)) levsLOC = shortLOC
listAPI = txtFIND("APIs.txt")
shortAPI = txtFIND("APIs Short.txt")
levsAPI = listAPI
if (useSHORT & !is.null(shortAPI)) levsAPI = shortAPI
if (file.exists(paste0(game, " - All.csv.bz2"))) {
resultsFull = read_csv(paste0(game, " - All.csv.bz2"), guess_max = 10, lazy = TRUE)
reusltsFull = resultsFull[resultsFull$Quality == SUBSET, ]
} else {
if (file.exists(paste0("@Combined - ", SUBSET, ".csv.bz2"))) {
resultsFull = read_csv(paste0("@Combined - ", SUBSET, ".csv.bz2"), guess_max = 10, lazy = TRUE)
} else {
resultsFull = read_csv(paste0("@Combined - ", SUBSET, ".csv"), guess_max = 10, lazy = TRUE)
}
}
resultsFull$GPU = ordered(resultsFull$GPU, levels = listGPU)
resultsFull$Quality = ordered(resultsFull$Quality)
if (!is.null(listQUA)) resultsFull$Quality = ordered(resultsFull$Quality, levels = listQUA)
resultsFull$Location = ordered(resultsFull$Location)
if (!is.null(listLOC)) resultsFull$Location = ordered(resultsFull$Location, levels = listLOC)
resultsFull$API = ordered(resultsFull$API)
if (!is.null(listAPI)) resultsFull$API = ordered(resultsFull$API, levels = listAPI)
lockBinding("resultsFull", .GlobalEnv)
# locks the variable in the Global Environment, preventing it from being altered
results = resultsFull
# protects the original data, after having been formatted
# not so necessary, as all edits to it occur within function environments
multiGPU = is.null(cGPU)
labsGPU = labs(caption = cGPU)
if (multiGPU) labsGPU = labs()
if (!testAPI) testAPI = (length(unique(results$API)) >= 2)
GROUPS = list(GPU = results$GPU, API = results$API, Quality = results$Quality, Location = results$Location)
if (!testAPI) GROUPS$API = NULL
if (!testQUA) GROUPS$Quality = NULL
# this way I can start with a full GROUPS and then remove the unnecesary components
# this is easier than trying to build it up
diff.CONS = function(DATA, DIR = "Forward", lag = 1) {
if (DIR == "Forward") return(c(diff(DATA, lag = lag), rep(0, lag)))
if (DIR == "Backward") return(c(rep(0, lag), diff(DATA, lag = lag)))
}
if (textDiff | graphDiff) {
results$MsDifferencePresents = unlist(by(results$MsBetweenPresents, GROUPS, diff.CONS))
results$MsDifferenceDisplayChange = unlist(by(results$MsBetweenDisplayChange, GROUPS, diff.CONS))
}
DESC = function(ITEM = NULL) {
descs = list(GPU = unique(as.character(results$GPU)), API = unique(as.character(results$API)), Location = unique(as.character(results$Location)), Quality = unique(as.character(results$Quality)))
if (length(descs$GPU) > 1) descs$GPU = NULL
if (length(descs$API) > 1) descs$API = NULL
try( if (is.na(descs$API)) descs$API = NULL, silent = TRUE)
if (length(descs$Location) > 1) descs$Location = NULL
if (length(descs$Quality) > 1) descs$Quality = NULL
gameQ = game
if (!is.null(descs$API)) gameQ = paste0(gameQ, " - ", descs$API)
if (!is.null(descs$Quality)) gameQ = paste0(gameQ, " - ", descs$Quality, " Quality")
gameGAQF = paste0(gameF, " - ", paste0(descs, collapse = " - ") )
gameGAQ = paste0(game, " - ", paste0(descs, collapse = " - ") )
if (!is.null(descs$Quality)) gameGAQ = paste0(gameGAQ, " Quality")
if (!is.null(ITEM)) {
gameGAQF = paste0(gameGAQF, " - ", ITEM)
gameGAQ = paste0(gameGAQ, " - ", ITEM)
}
return(c(gameGAQF, gameGAQ, gameQ))
}
gameGAQF = DESC()[1] ; gameGAQ = DESC()[2] ; gameQ = DESC()[3]
INDIV = function(COL, SUBS, useSHORT = useSHORT, gWIDTH = gWIDTH, gHEIGH = gHEIGH) {
if (COL != "GPU") dir.create(paste0("@", COL))
for (ITEM in SUBS) {
# COL <<- COL
# SUBS <<- SUBS
# ITEM <<- ITEM
# helpful for troubleshooting
message(paste0("\n", ITEM))
results = resultsFull[resultsFull[, COL] == ITEM, ]
if (nrow(results) == 0) next
if (COL == "GPU" & length(unique(results$API)) == 1) next
if (COL != "GPU") {
FOLD = paste0("@", COL, "/", ITEM)
dir.create(FOLD)
}
gameGAQF = DESC(ITEM)[1] ; gameGAQ = DESC(ITEM)[2] ; gameQ = DESC(ITEM)[3]
if (COL == "GPU") {
gameGAQF = paste0(ITEM, "/", gameGAQF)
} else {
gameGAQF = paste0(FOLD, "/", gameGAQF)
}
perGPU = FALSE
source("@Combined - Output.r", local = TRUE)
}
}
perGPU = TRUE # used for creating stats files in each GPU in their folders
if (!multiGPU) perGPU = FALSE
source("@Combined - Output.r")
if (graphs_all) {
# INDIV("GPU", listGPU, useSHORT = TRUE, gWIDTH = gWIDTH * 1.25, gHEIGH = gHEIGH * 2)
# INDIV("Location", listLOC, useSHORT = FALSE, gWIDTH = gWIDTH * 1.25, gHEIGH = gHEIGH * 1)
# INDIV("API", listAPI, useSHORT = TRUE, gWIDTH = gWIDTH * 1.25, gHEIGH = gHEIGH * 1)
}