# License: CDDL 1.0 # # Copyright 2014 Jens Elkner. # Invoke as 'R CMD BATCH --slave show.R' in the directory, which contains the # iostat -xrn output w<-1024 h<-768 hw<-600 hh<-450 f<-120 ft<-"out.tiff" process<-function(d) { # "c8t4d0" fname<-paste(d, ".io", sep="") if (! file.exists(fname)) { return(paste("Skipping", fname)) } line<-paste(rep("=",70), collapse="") # Set the 1st fields of header lines to NA to be able to filter them out raw<-read.csv(fname, header=F, dec=".", sep=",", skip=2, na.strings=c("extended device statistics", "r/s")) raw<-subset(raw, !is.na(V1) , select = V1:V10, drop=T) data<-subset(raw, as.numeric(as.character(V6)) >= 1, drop=T) dt<-format(as.POSIXlt(nrow(data), origin = "1970-01-01", tz="GMT"), "%H:%M:%S") title<-paste(d, "-", dt); #plot(data[,5], type="p", xlab="time [s]", ylab="KiB/s", pch=".") out<-file(paste(d, "-summary.txt", sep=""), "wt") sink(out, type="output", split = FALSE) cat(title, "", "Data", line, sep="\n") print(summary(data)) sink() # create timeseries for kw/s ts_kws<-ts(as.double(as.character(data$V4))/1024.0, start=1, frequency=f) # create seasonal series from timeseries ss_kws<-stl(ts_kws, s.window="periodic") # ss_kws$time.series[,1] .. seasonal component # ss_kws$time.series[,2] .. trend component # ss_kws$time.series[,3] .. remainder component # see attributes(ss_kws$time.series) # save as tiff - the only R supported px based format w/o loosing info tiff(filename = ft, width=w, height=h, units="px") # plot ss. One could rename "data","seasonal","trend","remainder" labels # on y-axis by adding soething like 'labels=c("l1", "l2", "l3", "l4")' pars = list(xaxt="n", mar = c(0, 6, 0, 6), oma = c(6, 0, 4, 0), tck = -0.01, mfrow = c(4, 1)) plot(ss_kws, main=paste(title, "- throughput [MiB/s]"), set.pars=pars) v.pretty<-pretty(0:nrow(data)/f) axis(1, at=v.pretty, labels=v.pretty*f/60) dev.off() system(paste("convert ", ft, " ", d, "-throughput.gif", sep="")) tiff(filename = ft, width=hw, height=hh, units="px") hist(as.double(as.character(data$V4))/1024.0, main=title, xlab="throughput [MiB/s]", breaks=20) dev.off() system(paste("convert ", ft, " ", d, "-throughput-hist.gif", sep="")) # Zusammenfassung sink(out, type="output", split = FALSE) cat("", "Throughput [MiB/s]", line, sep="\n") print(summary(ss_kws$time.series)) sink() # das gleiche für time/IOP speed<-(as.double(as.character(data$V8))/as.double(as.character(data$V6))) ts_speed<-ts(speed, start=1, frequency=f) ss_speed<-stl(ts_speed, s.window="periodic") tiff(filename = ft, width=w, height=h, units="px") plot(ss_speed, main=paste(title, "- latency [ms]"), set.pars=pars) v.pretty<-pretty(0:nrow(data)/f) axis(1, at=v.pretty, labels=v.pretty*f/60) dev.off() system(paste("convert ", ft, " ", d, "-latency.gif", sep="")) tiff(filename = ft, width=hw, height=hh, units="px") hist(speed, main=title, xlab="latency [ms]", breaks=20) dev.off() system(paste("convert ", ft, " ", d, "-latency-hist.gif", sep="")) sink(out, type="output", split = FALSE) cat("", "Latency [ms]", line, sep="\n") print(summary(ss_speed$time.series)) sink() close(out) unlink(ft) } for (i in 3:8) { for (k in 0:7) { fn<-paste("c", i, "t", k, "d0", sep="") print(fn) process(fn) } } # tsf<-HoltWinters(ts_speed, beta=FALSE, gamma=FALSE) # plot(tsf) # plot(tsf$fitted)