R routines for printing some statistics
[monitor.git] / statistics / node_history_may0809.r
1
2 source("functions.r");
3
4 # data collected from M2 pickle files
5 dnc <- read.csv('daily-available-node-count.csv', sep=',', header=TRUE)
6
7 dnc2<-add_timestamp(dnc)
8
9 tstamp_08 <-unclass(as.POSIXct("2008-05-07", origin="1970-01-01"))[1]
10 dnc2 <- dnc2[which( dnc2$start >  tstamp_08 ),]
11
12
13 dates <-seq(as.Date('2008-05-07'), as.Date('2009-05-07'), 'week')
14 months <- format(dates, "%b")
15 hbreaks<-unclass(as.POSIXct(dates))
16
17 x_start<-unclass(as.POSIXct("2008-05-07", origin="1970-01-01"))[1]
18 x_end  <-unclass(as.POSIXct("2009-06-1", origin="1970-01-01"))[1]
19
20 start_image("daily-node-count.png")
21 plot(dnc2$start[which(!is.na(dnc2$available))], dnc2$registered[which(!is.na(dnc2$available))], 
22     type='l', col='blue', ylim=c(0,900), xlim=c(x_start, x_end),
23     xlab="Date", ylab="Node Count", axes=F)
24 lines(dnc2$start[which(!is.na(dnc2$available))], dnc2$available[which(!is.na(dnc2$available))], type='l', col='red', ylim=c(0,900))
25 axis(2)
26 axis(1, labels=months, at=hbreaks)
27
28
29 tstamp_0610 <-abline_at_date("2008-06-10", col='grey20', lty=2)
30 # dates takes from reboot_image() output for API events.
31 tstamp_0815 <-abline_at_date("2008-08-15", col='grey20', lty=2)
32 tstamp_0905 <-abline_at_date("2008-09-05", col='grey70')
33 tstamp_0924 <-abline_at_date("2008-09-24", col='grey20', lty=2)
34 tstamp_1015 <-abline_at_date("2008-10-15", col='grey20', lty=2)
35 tstamp_1105 <-abline_at_date("2008-11-05", col='white', lty=2)
36 tstamp_1214 <-abline_at_date("2008-12-14", col='grey70')
37 tstamp_0223 <-abline_at_date("2009-02-23", col='grey70')
38 tstamp_0313 <-abline_at_date("2009-03-13", col='grey70')
39
40
41 text(x=c(tstamp_0610+(tstamp_0815-tstamp_0610)/2,
42          tstamp_0815+(tstamp_0905-tstamp_0815)/2,
43          tstamp_0924+(tstamp_1015-tstamp_0924)/2, 
44          tstamp_1015+(tstamp_1105-tstamp_1015)/2, 
45          tstamp_1214+(tstamp_0223-tstamp_1214)/2, 
46          tstamp_0223+(tstamp_0313-tstamp_0223)/2), 
47      y=c(0),
48      labels=c("Kernel bug", 'fix1', 'fix2', 'fix3', 'Notice bug', 'fix4')) #, 'fix 2', 'fix 3', 'fix 4'))
49
50 legend(unclass(as.POSIXct("2009-03-13", origin="1970-01-01"))[1], 200,
51         cex=0.7,
52         legend=c("Registered", "Available", 'Kernel Update', 'MyOps Event'),
53         pch=c('-', '-', '-', '-'),
54         col=c('blue', 'red', 'grey20', 'grey70'),
55         lty=c(1, 1, 2, 1), merge=T)
56
57 end_image()
58