add myops_restoration
[monitor.git] / statistics / node_history_ttr.r
index 6e7b770..f608c4d 100644 (file)
@@ -7,8 +7,9 @@ nsh_nopcu <- read.csv('node_status_history_nopcu.csv', sep=',', header=TRUE)
 
 nsh_m1 <- read.csv('node_status_history_m1.csv', sep=',', header=TRUE)
 # system("stats-m1/harvest_nodehistory_m1.py > ./node_status_history_m1_nopcu.csv")
-nsh_m1_nopcu <- read.csv('node_status_history_m1_nopcu.csv', sep=',', header=TRUE)
-nsh_m1_nopcu_may <- read.csv('node_status_history_m1_nopcu_may08sep08.csv', sep=',', header=TRUE)
+nsh_m1_nopcu_total <- read.csv('node_status_history_m1_nopcu_total.csv', sep=',', header=TRUE)
+nsh_m1_nopcu_notice <- read.csv('node_status_history_m1_nopcu.csv', sep=',', header=TRUE)
+nsh_m1_nopcu_kernel <- read.csv('node_status_history_m1_nopcu_may08sep08.csv', sep=',', header=TRUE)
 
 node_hist_image <- function (t, year, from, to, max=0, type="week", title="")
 {
@@ -111,48 +112,82 @@ node_hist_dist <- function (t, year, from, to, max=0, type="week", title="")
     return (dist);
 }
 
-nsh_image <- node_hist_image(nsh, '2009', '2009-06-01', '2010-02-28', 0, 'day')
-nsh_image_m1 <- node_hist_image(nsh_m1, '2009', '2008-10-01', '2009-03-28', 0, 'day')
+# Image Stuff
+#nsh_image <- node_hist_image(nsh, '2009', '2009-06-01', '2010-02-28', 0, 'day')
+#nsh_image_m1 <- node_hist_image(nsh_m1, '2009', '2008-10-01', '2009-03-28', 0, 'day')
 
+#nsh_short <- nsh[which(nsh$start > unclass(as.POSIXct("2009-06-01", origin="1970-01-01"))[1]),]
+#nsh_short <- nsh_short[which(nsh_short$start < unclass(as.POSIXct("2009-10-31", origin="1970-01-01"))[1]),]
 
-nsh_short <- nsh[which(nsh$start > unclass(as.POSIXct("2009-06-01", origin="1970-01-01"))[1]),]
-nsh_short <- nsh_short[which(nsh_short$start < unclass(as.POSIXct("2009-10-31", origin="1970-01-01"))[1]),]
+#
+#nsh_short <- nsh_nopcu
+#nsh_dist <- node_hist_dist(nsh_short, '2009', '2009-06-01', '2010-02-28', 0, 'day')
+#d<- ecdf(nsh_dist/(60*60*24))
 
+#nsh_m1_short <- nsh_m1[which(nsh_m1$start > unclass(as.POSIXct("2008-10-01", origin="1970-01-01"))[1]),]
+
+# M1 -- 
+# TOTAL
+t_0815 <- unclass(as.POSIXct("2008-08-15", origin="1970-01-01"))[1]
+t_0905 <- unclass(as.POSIXct("2008-09-05", origin="1970-01-01"))[1]
+
+t_0924 <- unclass(as.POSIXct("2008-09-24", origin="1970-01-01"))[1]
+t_1015 <- unclass(as.POSIXct("2008-10-15", origin="1970-01-01"))[1]
+
+t_0223 <- unclass(as.POSIXct("2009-02-23", origin="1970-01-01"))[1]
+t_0313 <- unclass(as.POSIXct("2009-03-13", origin="1970-01-01"))[1]
+
+#nsh_m1_short <- nsh_m1_nopcu_total[which( 
+#        (nsh_m1_nopcu_total$start > t_0815 & nsh_m1_nopcu_total$start <= t_0905) |
+#        (nsh_m1_nopcu_total$start > t_0924 & nsh_m1_nopcu_total$start <= t_1015) |
+#        (nsh_m1_nopcu_total$start > t_0223 & nsh_m1_nopcu_total$start <= t_0313)  ),]
+#
+#nsh_m1_short <- nsh_m1_nopcu_total[which( 
+#        (nsh_m1_nopcu_total$start > t_0815 & nsh_m1_nopcu_total$start <= t_0905) |
+#        (nsh_m1_nopcu_total$start > t_0924 & nsh_m1_nopcu_total$start <= t_1015) ),]
+
+nsh_m1_short <- nsh_m1_nopcu_total[which( 
+        (nsh_m1_nopcu_total$start > t_0815 & nsh_m1_nopcu_total$start <= t_0313) ),]
+nsh_dist_m1 <- node_hist_dist(nsh_m1_short, '2008', '2008-05-01', '2009-05-22', 0, 'day')
+d_m1_total<- ecdf(nsh_dist_m1/(60*60*24))
 
-nsh_short <- nsh_nopcu
-nsh_dist <- node_hist_dist(nsh_short, '2009', '2009-06-01', '2010-02-28', 0, 'day')
-d<- ecdf(nsh_dist/(60*60*24))
 
-#nsh_m1_short <- nsh_m1[which(nsh_m1$start > unclass(as.POSIXct("2008-10-01", origin="1970-01-01"))[1]),]
-nsh_m1_short <- nsh_m1_nopcu
 # NOTE: something happened betweeen 10-2 and 10-3
+# NOTICE BUG
 t_1015 <- unclass(as.POSIXct("2008-10-15", origin="1970-01-01"))[1]
 t_0224 <- unclass(as.POSIXct("2009-02-24", origin="1970-01-01"))[1]
-nsh_m1_short <- nsh_m1_nopcu[which(nsh_m1_nopcu$start > t_1015 & nsh_m1_nopcu$start <= t_0224),]
-
-nsh_m1_short <- nsh_m1_nopcu
+nsh_m1_short <- nsh_m1_nopcu_notice[which(nsh_m1_nopcu_notice$start > t_1015 & nsh_m1_nopcu_notice$start <= t_0224),]
 nsh_dist_m1 <- node_hist_dist(nsh_m1_short, '2008', '2008-10-01', '2009-03-22', 0, 'day')
-d_m1<- ecdf(nsh_dist_m1/(60*60*24))
+d_m1_notice_bug <- ecdf(nsh_dist_m1/(60*60*24))
 
 
+# KERNEL BUG
 t_0530 <- unclass(as.POSIXct("2008-05-30", origin="1970-01-01"))[1]
 t_0815 <- unclass(as.POSIXct("2008-08-15", origin="1970-01-01"))[1]
-nsh_m1_short <- nsh_m1_nopcu_may[which(nsh_m1_nopcu_may$start > t_0530 & nsh_m1_nopcu_may$start <= t_0815),]
+nsh_m1_short <- nsh_m1_nopcu_kernel[which(nsh_m1_nopcu_kernel$start > t_0530 & nsh_m1_nopcu_kernel$start <= t_0815),]
 nsh_dist_m1 <- node_hist_dist(nsh_m1_short, '2008', '2008-05-10', '2008-08-15', 0, 'day')
-d_m1_may <- ecdf(nsh_dist_m1/(60*60*24))
+d_m1_kernel_bug <- ecdf(nsh_dist_m1/(60*60*24))
 
 
 # d<-ecdf(nsh_dist[which(nsh_dist/(60*60*24) < 90 )]/(60*60*24)), 
 # 180 ~= 6 months.
 par(mfrow=c(1,1))
 par(mai=c(.9,.9,.1,.1))
-start_image("node_history_ttr_nopcu.png")
-plot(d, xlim=c(0,180), ylim=c(0,1), axes=F, xlab="Days to Resolve", ylab="Percentile",
-   col.hor='red', col.vert='red', pch='.', col.points='red', main="")
-plot(d_m1, xlim=c(0,180), ylim=c(0,1), xlab="Days to Resolve", ylab="Percentile",
-   col.hor='blue', col.vert='blue', pch='.', col.points='blue', add=TRUE)
-plot(d_m1_may, xlim=c(0,180), ylim=c(0,1), xlab="Days to Resolve", ylab="Percentile",
-   col.hor='green', col.vert='green', pch='.', col.points='green', add=TRUE)
+#start_image("node_history_ttr_nopcu.png")
+#plot(d, xlim=c(0,180), ylim=c(0,1), axes=F, xlab="Days to Resolve", ylab="Percentile",
+#   col.hor='red', col.vert='red', pch='.', col.points='red', main="")
+
+plot(d_m1_total, xlim=c(0,180), ylim=c(0,1), axes=F, xlab="Days to Resolve", 
+    ylab="Percentile", col.hor='red', col.vert='red', pch='.', 
+    col.points='red', main="")
+
+plot(d_m1_notice_bug, xlim=c(0,180), ylim=c(0,1), xlab="Days to Resolve", 
+    ylab="Percentile", col.hor='blue', col.vert='blue', pch='.', 
+    col.points='blue', add=TRUE)
+
+plot(d_m1_kernel_bug, xlim=c(0,180), ylim=c(0,1), xlab="Days to Resolve", 
+    ylab="Percentile", col.hor='green', col.vert='green', pch='.', 
+    col.points='green', add=TRUE)
 
 weeks <- c(0,7,14,21,28,60,90,120,150,180)
 axis(1, labels=weeks, at=weeks)
@@ -166,8 +201,9 @@ abline(v=c(91), col='grey80', lty=2)
 
 legend(100, 0.1,
        cex=0.7,
-       legend=c("Typical MyOps -- July2009-Feb2010", "Notice Bug -- Oct2008-Mar2009", "Kernel Bug -- May2008-Sept2008"),
+       legend=c("Typical MyOps -- fix1 through fix4", "Notice Bug", "Kernel Bug"),
        pch=c('-', '-', '-'),
        col=c('red', 'blue', 'green'),
        lty=c(1, 1, 1), merge=T)
+
 end_image()