4 # system("parse_rt_data.py > rt_data.csv");
5 # ./bmevents.py events.1-18-10 BootUpdateNode > bm_reboot_2010-01-18.csv
6 # ./bmevents.py events.10-08-09 BootUpdateNode > bm_reboot_2009-10-08.csv
7 # ./bmevents.py events.29.12.08.dump BootUpdateNode > bm_reboot_2008-12-29.csv
8 # ./bmevents.py events.8-25-09.dump BootUpdateNode > bm_reboot_2009-08-25.csv
10 bm <- read.csv('bm_reboot.csv', sep=',', header=TRUE)
11 bm_api <- read.csv('bm_reboot_2008-12-29.csv', sep=',', header=TRUE)
15 tstamp_78 <-unclass(as.POSIXct("2008-01-01", origin="1960-01-01"))[1]
16 tstamp_89 <-unclass(as.POSIXct("2009-01-01", origin="1960-01-01"))[1]
18 bm_7 <- bm2[which( bm2$start < tstamp_78 ),]
19 bm_8 <- bm2[which( bm2$start >= tstamp_78 & bm2$start < tstamp_89 ),]
20 bm_9 <- bm2[which( bm2$start >= tstamp_89 ),]
22 tstamp <-unclass(as.POSIXct("2008-01-01", origin="1960-01-01"))
23 bm_67 <- bm2[which( bm2$start < tstamp[1] ),]
24 bm_89 <- bm2[which( bm2$start >= tstamp[1] ),]
27 #start_image("bm_reboot.png")
30 par(mai=c(.5,.4,.5,.4))
31 #year_hist(bm_9, "2009", "2009/06/21", "2010/2/10", 500, 'day', "Daily Reboot Rates")
32 #rows <- year_hist_unique(bm_9, "2009", "2009/06/21", "2010/2/10", 100, 'day', "Unique Daily Reboots")
37 rows_blocks <- year_hist_unique_recent(bm_9, "2009", "2009/06/21", "2010/2/10", 100, c(1,3,7,14,30), 'day', "Unique Daily Reboots")
40 blocks <- c(0,1,3,7,14,30)
41 for ( b in blocks ) { x<- c(x, paste("X", b, sep="")) }
44 par(mai=c(1,.7,.5,.4))
45 start_image("bm_reboot_color.png", width=900)
47 barplot(t(rows_blocks[x]), border=NA, col=c('purple', 'blue', 'green', 'red', 'pink', 'orange', 'yellow'), ylim=c(0,100), main="How Recently Node were Rebooted", xlab="Days from June-2009 to Jan-2010", space=0, legend=c("Only today", "Also within 1 day", "Also within 3 days", "Also within 7 days", "Also within 14 days", "Also within 30 days"), ylab="Frequency")
50 #barplot(rows_blocks$X0, border=NA, col=c('purple', 'blue', 'green', 'red', 'pink', 'orange', 'yellow'), ylim=c(0,100))
53 #par(mai=c(.1,.7,.1,.1))
54 #barplot(rows_blocks$X0, border=NA, col=c('purple'), ylim=c(0,100))
55 #barplot(rows_blocks$X1, border=NA, col=c('blue'), ylim=c(0,100))
56 #barplot(rows_blocks$X3, border=NA, col=c('green'), ylim=c(0,100))
57 #barplot(rows_blocks$X7, border=NA, col=c('red'), ylim=c(0,100))
58 #barplot(rows_blocks$X14, border=NA, col=c('pink'), ylim=c(0,100))
59 #barplot(rows_blocks$X30, border=NA, col=c('orange'), ylim=c(0,100))
61 shapiro.test(rows_blocks$X0[ rows_blocks$X0 < 50 ])
62 shapiro.test(rows_blocks$X1[ rows_blocks$X1 < 50 ])
63 shapiro.test(rows_blocks$X3[ rows_blocks$X3 < 50 ])
64 shapiro.test(rows_blocks$X7[ rows_blocks$X7 < 50 ])
65 shapiro.test(rows_blocks$X14[ rows_blocks$X14 < 50 ])
66 shapiro.test(rows_blocks$X30[ rows_blocks$X30 < 50 ])
70 #image <- reboot_image(t_9, "2009", "2009/06/21", "2010/2/10", 0, 'day')
73 start_image("st_bm_reboots.png", width=400, height=600)
74 image <- reboot_image(bm_9, "2009", "2009/06/21", "2010/2/10", 0, 'day', title="BootManager Reboots for all Nodes")
77 start_image("st_api_event_reboots.png", width=800, height=600)
78 image2 <- reboot_image(bm_api, "2009", "2008/06/21", "2010/2/10", 0, 'day', title= "API Reboot Events for all Nodes")
81 reboot_frequency <- function ( img )
86 for ( i in seq(1:d[1]) )
94 reboot_events <- function ( img )
99 for ( i in seq(1:d[2]) )
107 time_to_reboot <- function (img, first=0, last=0)
112 for ( i in seq(1:d[1]) )
114 if (last == 0 ) { last <- length(img[i,]) }
115 r <- img[i,first:last]
118 while ( start_i < length(r) && r[start_i] != 1 )
120 start_i <- start_i + 1
124 while ( start_i < length(r) )
126 if ( r[start_i] == 1 && start_i != end_i)
128 f <- c(f, start_i-end_i)
129 while ( start_i < length(r) && r[start_i] == 1 ) { start_i <- start_i + 1 }
132 start_i <- start_i + 1
138 find_95 <- function (cdf, low=0, high=1000)
140 # find the lowest point past the 95th percentile.
141 while ( high - low > 1)
144 c_mid <- cdf(low+floor((high-low)/2))
147 c_min <- min(min(abs(0.95-c_low), abs(0.95-c_mid)), abs(0.95-c_high))
149 if ( c_mid > 0.95 ) {
150 high <- high - floor((high-low)/2)
151 print (sprintf("adjust high: %s\n", high));
152 } else if ( c_mid <= 0.95 ) {
153 low <- low + floor((high-low)/2)
154 print (sprintf("adjust low: %s\n", low));
158 #if ( c_min == abs(0.95-c_mid) ) {
159 # # is it in top half or bottom half?
160 # print (sprintf("middle\n"));
161 # if ( abs(0.95-c_low) < abs(0.95-c_high) ) {
162 # low <- low + floor((high-low)/2)
163 # print (sprintf("adjust low: %s\n", low));
164 # } else { #if ( c_min == abs(0.95-c_high) ) {
165 # high <- high - floor((high-low)/2)
166 # print (sprintf("adjust high: %s\n", high));
169 # if ( c_min == abs(0.95-c_low) ) {
170 # high <- high - floor((high-low)/2)
171 # print (sprintf("adjust high: %s\n", high));
172 # } else { #if ( c_min == abs(0.95-c_high) ) {
173 # low <- low + floor((high-low)/2)
174 # print (sprintf("adjust low: %s\n", low));
182 ttr1 <- time_to_reboot(image,9,122)
183 ttr2 <- time_to_reboot(image,131,223)
185 ttr8 <- time_to_reboot(image2,0,193)
186 ttr9 <- time_to_reboot(image2,402)
188 x1 <- ecdf(c(ttr1, ttr2))
189 x2 <- ecdf(c(ttr8,ttr9))
190 start_image("reboot_ttr_cdf.png")
191 plot(x1, col.vert='red', col.hor="red", col.points="red", pch='*', xlab="Days to Reboot", ylab="Percentile", verticals=TRUE, xlim=c(0,170), main="CDF of Days to Reboot for BM & API Events")
192 plot(x2, col.vert='blue', col.hor="blue", col.points="blue", pch=20, verticals=TRUE, add=TRUE)
193 legend(130, 0.15, legend=c("BM Uploads", "API Events"), col=c('red', 'blue'), pch=c(42, 20))
197 abline(v=v1, col="pink")
198 abline(v=v2, col="light blue")
199 axis(1, labels=c(v1,v2), at=c(v1,v2))
201 abline(v=7, col="grey")
202 abline(v=14, col="grey")
203 abline(v=21, col="grey")
204 abline(v=28, col="grey")
205 abline(v=42, col="grey")
206 abline(v=56, col="grey")
209 e <- reboot_events(image)
210 e2 <- reboot_events(image2)
214 start_image("reboot_days_cdf.png")
215 plot(x1, col.vert='red', col.hor="red", col.points="red", pch='*', xlab="Reboots in a Single Day", ylab="Percentile", verticals=TRUE, xlim=c(0,100), main="CDF of Reboots per Day for BM & API Events")
216 plot(x2, col.vert='blue', col.hor="blue", col.points="blue", pch=20, verticals=TRUE, add=TRUE)
217 legend(75, 0.15, legend=c("BM Uploads", "API Events"), col=c('red', 'blue'), pch=c(42, 20))
221 abline(v=v1, col="pink")
222 abline(v=v2, col="light blue")
223 axis(1, labels=c(v1,v2), at=c(v1,v2))
228 f <- reboot_frequency(image)
229 f2 <- reboot_frequency(image2)
233 start_image("reboot_node_cdf.png")
235 par(mai=c(.9,.8,.5,.4))
236 plot(x1, col.vert='red', col.hor="red", col.points="red", pch='*', xlab="Reboots per Node", ylab="Percentile", verticals=TRUE, xlim=c(0,100), main="CDF of Reboot per Node for BM & API Events")
237 plot(x2, col.vert='blue', col.hor="blue", col.points="blue", pch=20, verticals=TRUE, add=TRUE)
238 legend(75, 0.15, legend=c("BM Uploads", "API Events"), col=c('red', 'blue'), pch=c(42, 20))
242 abline(v=v1, col="pink")
243 abline(v=v2, col="light blue")
244 axis(1, labels=c(v1,v2), at=c(v1,v2))
250 par(mai=c(.7,.7,.7,.7))