|
| 1 | +library(ggplot2) |
| 2 | +library(sm) |
| 3 | +library(vioplot) |
| 4 | +library(scales) |
| 5 | +library(survival) |
| 6 | +library(MASS) |
| 7 | +library(fitdistrplus) |
| 8 | + |
| 9 | +# Violin plot using ggplot2 |
| 10 | + |
| 11 | +input_rmd_issues <- read.csv("./results/data_for_RQ3.csv") |
| 12 | +Issues=input_rmd_issues$ISSUE_TYPE |
| 13 | +NoOfDays=input_rmd_issues$ISSUE_SURVIVED_TIME/86400 |
| 14 | +par(las=2,bty="l") |
| 15 | +myPlot <- ggplot(input_rmd_issues, aes(Issues, NoOfDays)) + |
| 16 | +geom_violin(fill="#B2BEB5")+ |
| 17 | +labs(x="Issue Types", y = "Days")+ |
| 18 | +geom_boxplot(width=0.1)+ |
| 19 | +theme_classic() + theme(axis.text=element_text(size=12), axis.title=element_text(size=16,face="bold")) |
| 20 | +pdf(paste("./plots/", "violinplotSurvivalTime_RQ3", ".pdf", sep=""), width=11) |
| 21 | +print(myPlot) |
| 22 | +dev.off() |
| 23 | + |
| 24 | +install.packages("raster") |
| 25 | +library(raster) |
| 26 | + |
| 27 | +x <- c("DrawAllocation","FloatMath","HandlerLeak","Recycle","UseSparseArrays","UseValueOf","ViewHolder") |
| 28 | +for (i in 1:length(x)) |
| 29 | +{ |
| 30 | + details <- input_rmd_issues$ISSUE_SURVIVED_TIME[input_rmd_issues$ISSUE_TYPE == x[i]] / 86400 |
| 31 | + print(paste("Statistic for issue type", x[i])) |
| 32 | + Minn <- min(details) |
| 33 | + Maxx <- max(details) |
| 34 | + Mediann <- median(details) |
| 35 | + Meann <- mean(details) |
| 36 | + SDD <- sd(details) |
| 37 | + CVV <- cv(details) |
| 38 | + print(paste("Minimum is", Minn)) |
| 39 | + print(paste("Maximum is", Maxx)) |
| 40 | + print(paste("Median is", Mediann)) |
| 41 | + print(paste("Mean is", Meann)) |
| 42 | + print(paste("Standard Deviation is", SDD)) |
| 43 | + print(paste("Coefficient of variant is", CVV)) |
| 44 | +} |
| 45 | + |
| 46 | + |
| 47 | +# box plot for Survival Time |
| 48 | + |
| 49 | +input_file <- read.csv("./data_for_RQ3.csv") |
| 50 | +Issues <- input_file$ISSUE_TYPE |
| 51 | +Days <- input_file$ISSUE_SURVIVED_TIME/86400 |
| 52 | +par(las=2,bty="l") |
| 53 | +boxplot(Days~Issues, data=input_file) |
| 54 | +toPlot <- boxplot(Days~Issues, data=input_file) |
| 55 | +toPlot$out <- NULL |
| 56 | +toPlot$group <- NULL |
| 57 | +bxp(toPlot) |
| 58 | +pdf(paste("./", "boxplotSurvivalTime_RQ3", ".pdf", sep=""), width=11) |
| 59 | +dev.off() |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +# KS Test For All Fitting Distribution |
| 66 | + |
| 67 | +input_rmd_issues <- read.csv('./results/data_for_RQ3.csv') |
| 68 | +issues <- list("FloatMath", "UseSparseArrays", "UseValueOf", "HandlerLeak", "ViewHolder", "Recycle", "DrawAllocation") |
| 69 | +for (i in 1:length(issues)) |
| 70 | +{ |
| 71 | + print(paste0("Name of Performance issues: ", issues[[i]])) |
| 72 | + tmstmp <- input_rmd_issues$Time[input_rmd_issues$ISSUE_TYPE == issues[[i]]] / 86400 |
| 73 | + distribution <- list("norm", "exp", "weibull", "gamma", "lnorm", "cauchy") |
| 74 | + for (j in 1:length(distribution)) |
| 75 | + { |
| 76 | + print(paste0("Name of Distribution: ", distribution[[j]])) |
| 77 | + tit_ecdf <- paste(issues[[i]], distribution[[j]], "ECDF-Plot", sep = "-") |
| 78 | + tit_all <- paste(issues[[i]], distribution[[j]], "All-Plots", sep = "-") |
| 79 | + #pdf(paste("C:/Users/Teerath Das/Desktop/written/newpdfs/hags/", tit, ".pdf", sep=""), width=11, height=7) |
| 80 | + #png(paste('C:/Users/Teerath Das/Desktop/written/newpdfs/hags/', tit_all, ".png", sep=""), width=500, height=500) |
| 81 | + if (distribution[j] == "norm") |
| 82 | + { |
| 83 | + fumle <- fitdist(tmstmp, distr = distribution[[j]], method="mle",lower=c(0, 0)) |
| 84 | + fum <- ks.test(tmstmp, "pnorm", fumle$estimate["mean"], fumle$estimate["sd"]) |
| 85 | + print(fum) |
| 86 | + } |
| 87 | + |
| 88 | + if (distribution[j] == "exp") |
| 89 | + { |
| 90 | + fumle <- fitdist(tmstmp, distr = distribution[[j]], method="mle") |
| 91 | + fum <- ks.test(tmstmp, "pexp", fumle$estimate["rate"]) |
| 92 | + print(fum) |
| 93 | + } |
| 94 | + |
| 95 | + if (distribution[j] == "lnorm") |
| 96 | + { |
| 97 | + fumle <- fitdist(tmstmp, distr = distribution[[j]], method="mle") |
| 98 | + fum <- ks.test(tmstmp, "plnorm", fumle$estimate["meanlog"], fumle$estimate["sdlog"]) |
| 99 | + print(fum) |
| 100 | + } |
| 101 | + |
| 102 | + if (distribution[j] == "cauchy") |
| 103 | + { |
| 104 | + fumle <- fitdist(tmstmp, distr = distribution[[j]], method="mle",lower=c(0, 0)) |
| 105 | + fum <- ks.test(tmstmp, "pcauchy", fumle$estimate["location"], fumle$estimate["scale"]) |
| 106 | + print(fum) |
| 107 | + } |
| 108 | + |
| 109 | + if (distribution[j] == "gamma") |
| 110 | + { |
| 111 | + fumle <- fitdist(tmstmp, distr = distribution[[j]], method="mle",lower=c(0, 0)) |
| 112 | + fum <- ks.test(tmstmp, "pgamma", fumle$estimate["shape"], fumle$estimate["rate"]) |
| 113 | + print(fum) |
| 114 | + } |
| 115 | + |
| 116 | + if (distribution[j] == "weibull") |
| 117 | + { |
| 118 | + fumle <- fitdist(tmstmp, distr = distribution[[j]], method="mle",lower=c(0, 0)) |
| 119 | + fum <- ks.test(tmstmp, "pweibull", fumle$estimate["shape"], fumle$estimate["scale"]) |
| 120 | + print(fum) |
| 121 | + |
| 122 | + } |
| 123 | + } |
| 124 | +} |
| 125 | + |
| 126 | +# Dunn's post-hoc analysis for comparing duration distributions |
| 127 | + |
| 128 | +install.packages("dunn.test") |
| 129 | +library(dunn.test) |
| 130 | +data2 <- read.csv('./results/data_for_RQ3.csv') |
| 131 | +dunn.test(data2$Time, g=data2$ISSUE_TYPE, kw=TRUE, method="holm") |
| 132 | + |
| 133 | + |
| 134 | +# Calculating the CDF for all the distributions. |
| 135 | + |
| 136 | +input_rmd_issues <- read.csv('./results/data_for_RQ3.csv') |
| 137 | +issues <- list("FloatMath", "UseSparseArrays", "UseValueOf", "HandlerLeak", "ViewHolder", "Recycle", "DrawAllocation") |
| 138 | +for (i in 1:length(issues)) |
| 139 | +{ |
| 140 | + print(paste0("Name of Performance issues: ", issues[[i]])) |
| 141 | + tmstmp <- input_rmd_issues$Time[input_rmd_issues$ISSUE_TYPE == issues[[i]]] / 86400 |
| 142 | + distribution <- list("norm", "exp", "weibull", "gamma", "lnorm", "cauchy") |
| 143 | + for (j in 1:length(distribution)) |
| 144 | + { |
| 145 | + print(paste0("Name of Distribution: ", distribution[[j]])) |
| 146 | + title_ecdf <- paste(issues[[i]], distribution[[j]], "ECDF-Plot", sep = "-") |
| 147 | + title_all <- paste(issues[[i]], distribution[[j]], "All-Plots", sep = "-") |
| 148 | + #pdf(paste("C:/Users/Teerath Das/Desktop/written/newpdfs/hags/", tit, ".pdf", sep=""), width=11, height=7) |
| 149 | + pdf(paste('./Distribution_Plots_RQ3/', title_all, ".pdf", sep=""), width=11, height=7) |
| 150 | + if (distribution[j] == "exp" | distribution[j] == "lnorm") |
| 151 | + { |
| 152 | + pdf(paste("./Distribution_Plots_RQ3/", title_ecdf, ".pdf", sep=""), width=11, height=7) |
| 153 | + fumle <- fitdist(tmstmp, distr = distribution[[j]], method="mle") |
| 154 | + cdfcomp(list(fumle),addlegend = FALSE, datacol = "red", fitcol = "blue", main=distribution[[j]], xlab="Decays (days)", ylab="CDF", do.points=F, lwd = 2, cex.axis = 1.8, cex.lab=1.5, cex.main=1.5) |
| 155 | + #plot(fumle) |
| 156 | + dev.off() |
| 157 | + } |
| 158 | + else |
| 159 | + { |
| 160 | + pdf(paste("./Distribution_Plots_RQ3/", title_ecdf, ".pdf", sep=""), width=11, height=7) |
| 161 | + fumle <- fitdist(tmstmp, distr = distribution[[j]], method="mle",lower=c(0, 0)) |
| 162 | + cdfcomp(list(fumle),addlegend = FALSE, datacol = "red", fitcol = "blue", main=distribution[[j]], xlab="Decays (days)", ylab="CDF", do.points=F, lwd = 2, cex.axis = 1.8, cex.lab=1.5, cex.main=1.5) |
| 163 | + #plot(fumle) |
| 164 | + dev.off() |
| 165 | + } |
| 166 | + plot(fumle) |
| 167 | + dev.off() |
| 168 | + } |
| 169 | +} |
| 170 | + |
| 171 | + |
| 172 | +#library(MASS) |
| 173 | +#data2 <- read.csv('C:/Users/Teerath Das/Desktop/written/data_for_RQ3.csv') |
| 174 | +#pdf(paste("./Distribution_Plots_RQ3/", "sim", ".pdf", sep=""), width=11) |
| 175 | +#ft <- subset(data2, data2$ISSUE_TYPE == "FloatMath") |
| 176 | +#tms <- ft$Time/86400 |
| 177 | +#fit.params <- fitdistr(tms, "gamma") |
| 178 | +#ggplot(ft, aes(tms)) + stat_ecdf(geom = "step", colour = "red", size = 1) + |
| 179 | +# geom_line(aes(x=ft$Time/86400, y=pgamma(ft$Time/86400,fit.params$estimate["shape"], fit.params$estimate["rate"])), color="blue", size = 1) + scale_x_discrete(limit = c(0, 200, 400, 600, 800, 1000, 1200, 1400)) + theme(axis.text.x = element_text(angle = 90, hjust = 1)) + labs(x = "Days", y = "CDF") + ggtitle("Gamma") + theme_classic() |
| 180 | +#dev.off() |
| 181 | + |
| 182 | +#DrawAllocation_gamma |
| 183 | +#fit.params <- fitdistr(tms, "gamma") |
| 184 | +#p <- ggplot(ft, aes(tms)) + stat_ecdf(geom = "step", colour = "red", size = 1) + |
| 185 | +# geom_line(aes(x=ft$Time/86400, y=pgamma(ft$Time/86400,fit.params$estimate["shape"], fit.params$estimate["rate"])), color="blue", size = 1) + scale_x_discrete(limit = c(0, 200, 400, 600, 800, 1000, 1200, 1400)) + labs(x = "Days", y = "CDF") + ggtitle("Gamma") + theme_bw() + theme(axis.text=element_text(size=12), axis.title=element_text(size=14,face="bold"), plot.title = element_text(hjust = 0.5, , size=14,face="bold")) |
| 186 | +#ggsave(plot = p, width = 7, dpi = 400, filename = "./Distribution_Plots_RQ3/drawallocation_gamma.pdf") |
| 187 | + |
| 188 | +#FloatMah_weibull |
| 189 | +#fit.params <- fitdistr(tms, "weibull", lower=c(0, 0)) |
| 190 | +#p <- ggplot(ft, aes(tms)) + stat_ecdf(geom = "step", colour = "red", size = 1) + |
| 191 | +# geom_line(aes(x=ft$Time/86400, y=pweibull(ft$Time/86400,fit.params$estimate["shape"], fit.params$estimate["scale"])), color="blue", size = 1) + scale_x_discrete(limit = c(0, 200, 400, 600, 800, 1000, 1200)) + labs(x = "Days", y = "CDF") + ggtitle("Weibull") + theme_bw() + theme(axis.text=element_text(size=12), axis.title=element_text(size=14,face="bold"), plot.title = element_text(hjust = 0.5, , size=14,face="bold")) |
| 192 | +#ggsave(plot = p, width = 7, dpi = 400, filename = "C:/Users/Teerath Das/Desktop/written/newpdfs/float_weibull.pdf") |
| 193 | + |
| 194 | + |
| 195 | +#HandlerLeak_Weibull |
| 196 | +#fit.params <- fitdistr(tms, "weibull", lower=c(0, 0)) |
| 197 | +#p <- ggplot(ft, aes(tms)) + stat_ecdf(geom = "step", colour = "red", size = 1) + |
| 198 | +# geom_line(aes(x=ft$Time/86400, y=pweibull(ft$Time/86400,fit.params$estimate["shape"], fit.params$estimate["scale"])), color="blue", size = 1) + scale_x_discrete(limit = c(0, 200, 400, 600, 800, 1000, 1200)) + labs(x = "Days", y = "CDF") + ggtitle("Weibull") + theme_bw() + theme(axis.text=element_text(size=12), axis.title=element_text(size=14,face="bold"), plot.title = element_text(hjust = 0.5, , size=14,face="bold")) |
| 199 | +#ggsave(plot = p, width = 7, dpi = 400, filename = "./Distribution_Plots_RQ3/handlerleak_weibull.pdf") |
| 200 | + |
| 201 | +#Recycle_weibull |
| 202 | +#fit.params <- fitdistr(tms, "weibull", lower=c(0, 0)) |
| 203 | +#p <- ggplot(ft, aes(tms)) + stat_ecdf(geom = "step", colour = "red", size = 1) + |
| 204 | +# geom_line(aes(x=ft$Time/86400, y=pweibull(ft$Time/86400,fit.params$estimate["shape"], fit.params$estimate["scale"])), color="blue", size = 1) + scale_x_discrete(limit = c(0, 200, 400, 600, 800, 1000, 1200)) + labs(x = "Days", y = "CDF") + ggtitle("Weibull") + theme_bw() + theme(axis.text=element_text(size=12), axis.title=element_text(size=14,face="bold"), plot.title = element_text(hjust = 0.5, , size=14,face="bold")) |
| 205 | +#ggsave(plot = p, width = 7, dpi = 400, filename = "./Distribution_Plots_RQ3/recycle_weibull.pdf") |
| 206 | + |
| 207 | + |
| 208 | +#ViewHolder_weibull |
| 209 | +#fit.params <- fitdistr(tms, "weibull", lower=c(0, 0)) |
| 210 | +#p <- ggplot(ft, aes(tms)) + stat_ecdf(geom = "step", colour = "red", size = 1) + |
| 211 | +# geom_line(aes(x=ft$Time/86400, y=pweibull(ft$Time/86400,fit.params$estimate["shape"], fit.params$estimate["scale"])), color="blue", size = 1) + scale_x_discrete(limit = c(0, 200, 400, 600, 800, 1000, 1200)) + labs(x = "Days", y = "CDF") + ggtitle("Weibull") + theme_bw() + theme(axis.text=element_text(size=12), axis.title=element_text(size=14,face="bold"), plot.title = element_text(hjust = 0.5, , size=14,face="bold")) |
| 212 | +#ggsave(plot = p, width = 7, dpi = 400, filename = "./Distribution_Plots_RQ3/viewholder_weibull.pdf") |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | + |
0 commit comments