-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresult-visualizations.R
231 lines (198 loc) · 9.49 KB
/
result-visualizations.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
221
222
223
224
225
226
227
228
229
230
231
##---------------------------------------------------------------##
## Load libraries and import data ##
##---------------------------------------------------------------##
# Load libraries
library(ggplot2)
# Import data
sc1_steady_before_data <- read.csv("scenario-1/steady-log-pre.csv")
sc1_steady_after_data <- read.csv("scenario-1/steady-log-post.csv")
sc1_overload_data <- read.csv("scenario-1/overload-log.csv")
sc2_steady_before_data <- read.csv("scenario-2/steady-log-pre.csv")
sc2_steady_after_data <- read.csv("scenario-2/steady-log-post.csv")
sc3_steady_before_data <- read.csv("scenario-3/steady-log-pre.csv")
sc3_steady_after_data <- read.csv("scenario-3/steady-log-post.csv")
sc4_steady_before_data <- read.csv("scenario-4/steady-log-pre.csv")
sc4_steady_after_data <- read.csv("scenario-4/steady-log-post.csv")
sc5_steady_before_data <- read.csv("scenario-5/steady-log-pre.csv")
sc5_steady_after_data <- read.csv("scenario-5/steady-log-post.csv")
##---------------------------------------------------------------##
## Descriptive Statistics ##
##---------------------------------------------------------------##
# Create summary for all datasets
summary(sc1_steady_before_data)
summary(sc1_steady_after_data)
summary(sc1_overload_data)
summary(sc2_steady_before_data)
summary(sc2_steady_after_data)
summary(sc3_steady_before_data)
summary(sc3_steady_after_data)
summary(sc4_steady_before_data)
summary(sc4_steady_after_data)
summary(sc5_steady_before_data)
summary(sc5_steady_after_data)
##---------------------------------------------------------------##
## Generate Graphs ##
##---------------------------------------------------------------##
# Creates a success scatter plot and saves it to PDF
create_and_save_success_scatter_plot <- function(data, scenario_num, data_label, ylim_lower, ylim_upper) {
plot_label <- paste("Successful Requests over Time - Scenario", scenario_num, data_label)
x_label <- "Time (in sec)"
y_label <- "Number of Succesful Requests"
# Create Plot
scatter_plot <- ggplot(data=data, aes(x=Target.Time, Successful.Transactions)) +
geom_point() +
geom_rug(col="steelblue",alpha=0.1, size=1.5) +
xlab(x_label) +
ylab(y_label) +
labs(title = plot_label) +
ylim(ylim_lower, ylim_upper)
save_plot(scatter_plot, plot_label)
}
# Creates a fails scatter plot and saves it to PDF
create_and_save_fails_scatter_plot <- function(data, scenario_num, data_label, ylim_lower, ylim_upper) {
plot_label <- paste("Failed Requests over Time - Scenario", scenario_num, data_label)
x_label <- "Time (in sec)"
y_label <- "Number of Failed Requests"
# Create Plot
scatter_plot <- ggplot(data=data, aes(x=Target.Time, Failed.Transactions)) +
geom_point() +
geom_rug(col="steelblue",alpha=0.1, size=1.5) +
xlab(x_label) +
ylab(y_label) +
labs(title = plot_label) +
ylim(ylim_lower, ylim_upper)
save_plot(scatter_plot, plot_label)
}
# Creates a response time scatter plot and saves it to PDF
create_and_save_response_time_scatter_plot <- function(data, scenario_num, data_label, ylim_lower, ylim_upper) {
plot_label <- paste("Avg. Response Time over Time - Scenario", scenario_num, data_label)
x_label <- "Time (in sec)"
y_label <- "Avg. Response Time (in sec)"
# Create Plot
scatter_plot <- ggplot(data=data, aes(x=Target.Time, Avg.Response.Time)) +
geom_point() +
geom_rug(col="steelblue",alpha=0.1, size=1.5) +
xlab(x_label) +
ylab(y_label) +
labs(title = plot_label) +
ylim(ylim_lower, ylim_upper)
save_plot(scatter_plot, plot_label)
}
# Saves the given plot as PDF
save_plot <- function(scatter_plot, plot_label) {
path = paste("./scenario-", scenario_num, "/", sep="")
dir.create(path, showWarnings = FALSE) # Create directory if it doesn't exist
ggsave(
paste(plot_label, ".pdf", sep = ""),
plot = scatter_plot,
path = path,
width = 8,
height = 6,
units = "in"
)
}
# Scenario 1
scenario_num <- 1
# Set y axis the same to allow comparison of graphs
response_ylim_lower <- 0
response_ylim_upper <- 3
success_ylim_lower <- 0
success_ylim_upper <- 20
fails_ylim_lower <- 0
fails_ylim_upper <- 5
# Create graphs for scenario 1
data_label <- "(Steady State Before)"
data <- sc1_steady_before_data
create_and_save_response_time_scatter_plot(data, scenario_num, data_label, response_ylim_lower, response_ylim_upper)
create_and_save_success_scatter_plot(data, scenario_num, data_label, success_ylim_lower, success_ylim_upper)
create_and_save_fails_scatter_plot(data, scenario_num, data_label, fails_ylim_lower, fails_ylim_upper)
data_label <- "(Steady State After)"
data <- sc1_steady_after_data
create_and_save_response_time_scatter_plot(data, scenario_num, data_label, response_ylim_lower, response_ylim_upper)
create_and_save_success_scatter_plot(data, scenario_num, data_label, success_ylim_lower, success_ylim_upper)
create_and_save_fails_scatter_plot(data, scenario_num, data_label, fails_ylim_lower, fails_ylim_upper)
data_label <- "(Overload)"
data <- sc1_overload_data
create_and_save_response_time_scatter_plot(data, scenario_num, data_label, response_ylim_lower, response_ylim_upper)
create_and_save_success_scatter_plot(data, scenario_num, data_label, success_ylim_lower, 1300)
create_and_save_fails_scatter_plot(data, scenario_num, data_label, fails_ylim_lower, fails_ylim_upper)
# Scenario 2
scenario_num <- 2
# Set y axis the same to allow comparison of graphs
response_ylim_lower <- 0
response_ylim_upper <- 4
success_ylim_lower <- 0
success_ylim_upper <- 20
fails_ylim_lower <- 0
fails_ylim_upper <- 5
# Create graphs for scenario 2
data_label <- "(Steady State Before)"
data <- sc2_steady_before_data
create_and_save_response_time_scatter_plot(data, scenario_num, data_label, response_ylim_lower, response_ylim_upper)
create_and_save_success_scatter_plot(data, scenario_num, data_label, success_ylim_lower, success_ylim_upper)
create_and_save_fails_scatter_plot(data, scenario_num, data_label, fails_ylim_lower, fails_ylim_upper)
data_label <- "(Steady State After)"
data <- sc2_steady_after_data
create_and_save_response_time_scatter_plot(data, scenario_num, data_label, response_ylim_lower, response_ylim_upper)
create_and_save_success_scatter_plot(data, scenario_num, data_label, success_ylim_lower, success_ylim_upper)
create_and_save_fails_scatter_plot(data, scenario_num, data_label, fails_ylim_lower, fails_ylim_upper)
# Scenario 3
scenario_num <- 3
# Set y axis the same to allow comparison of graphs
response_ylim_lower <- 0
response_ylim_upper <- 3
success_ylim_lower <- 0
success_ylim_upper <- 20
fails_ylim_lower <- 0
fails_ylim_upper <- 5
# Create graphs for scenario 3
data_label <- "(Steady State Before)"
data <- sc3_steady_before_data
create_and_save_response_time_scatter_plot(data, scenario_num, data_label, response_ylim_lower, response_ylim_upper)
create_and_save_success_scatter_plot(data, scenario_num, data_label, success_ylim_lower, success_ylim_upper)
create_and_save_fails_scatter_plot(data, scenario_num, data_label, fails_ylim_lower, fails_ylim_upper)
data_label <- "(Steady State After)"
data <- sc3_steady_after_data
create_and_save_response_time_scatter_plot(data, scenario_num, data_label, response_ylim_lower, response_ylim_upper)
create_and_save_success_scatter_plot(data, scenario_num, data_label, success_ylim_lower, success_ylim_upper)
create_and_save_fails_scatter_plot(data, scenario_num, data_label, fails_ylim_lower, fails_ylim_upper)
# Scenario 4
scenario_num <- 4
# Set y axis the same to allow comparison of graphs
response_ylim_lower <- 0
response_ylim_upper <- 3
success_ylim_lower <- 0
success_ylim_upper <- 20
fails_ylim_lower <- 0
fails_ylim_upper <- 20
# Create graphs for scenario 4
data_label <- "(Steady State Before)"
data <- sc4_steady_before_data
create_and_save_response_time_scatter_plot(data, scenario_num, data_label, response_ylim_lower, response_ylim_upper)
create_and_save_success_scatter_plot(data, scenario_num, data_label, success_ylim_lower, success_ylim_upper)
create_and_save_fails_scatter_plot(data, scenario_num, data_label, fails_ylim_lower, fails_ylim_upper)
data_label <- "(Steady State After)"
data <- sc4_steady_after_data
create_and_save_response_time_scatter_plot(data, scenario_num, data_label, response_ylim_lower, response_ylim_upper)
create_and_save_success_scatter_plot(data, scenario_num, data_label, success_ylim_lower, success_ylim_upper)
create_and_save_fails_scatter_plot(data, scenario_num, data_label, fails_ylim_lower, fails_ylim_upper)
# Scenario 5
scenario_num <- 5
# Set y axis the same to allow comparison of graphs
response_ylim_lower <- 0
response_ylim_upper <- 50
success_ylim_lower <- 0
success_ylim_upper <- 80
fails_ylim_lower <- 0
fails_ylim_upper <- 5
# Create graphs for scenario 5
data_label <- "(Steady State Before)"
data <- sc5_steady_before_data
create_and_save_response_time_scatter_plot(data, scenario_num, data_label, response_ylim_lower, response_ylim_upper)
create_and_save_success_scatter_plot(data, scenario_num, data_label, success_ylim_lower, success_ylim_upper)
create_and_save_fails_scatter_plot(data, scenario_num, data_label, fails_ylim_lower, fails_ylim_upper)
data_label <- "(Steady State After)"
data <- sc5_steady_after_data
create_and_save_response_time_scatter_plot(data, scenario_num, data_label, response_ylim_lower, response_ylim_upper)
create_and_save_success_scatter_plot(data, scenario_num, data_label, success_ylim_lower, success_ylim_upper)
create_and_save_fails_scatter_plot(data, scenario_num, data_label, fails_ylim_lower, fails_ylim_upper)