Skip to content

Instantly share code, notes, and snippets.

@khailey-zz
Created July 19, 2012 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khailey-zz/3140074 to your computer and use it in GitHub Desktop.
Save khailey-zz/3140074 to your computer and use it in GitHub Desktop.
visualizing data from fio in R
colors <- c(
"#00007F", # 50u 1 blue
"#0000BB", # 100u 5
"#0000F7", # 250u
"#00ACFF", # 500u 6
"#00E8FF", # 1ms 7
"#25FFD9", # 2ms 8
"#61FF9D", # 4ms 9
"#9DFF61", # 10ms 10
#"#D9FF25", # 10ms 11
"#FFE800", # 20ms 12 yellow
"#FFAC00", # 50ms 13 orange
"#FF7000", # 100ms 14 dark orang
"#FF3400", # 250ms 15 red 1
"#F70000", # 500ms 16 red 2
"#BB0000", # 1s 17 dark red 1
"#7F0000", # 2s 18 dark red 2
"#4F0000") # 5s 18 dark red 2
m <- NULL
m <- matrix(c(
"write", 1, "1K", 2.567, 0.375, 0.2, 48, 1.1, 2629 , 0, 0,55,30,11, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
, "write", 1, "8K", 20.888, 0.369, 0.2, 581, 5.1, 2673 , 0, 0, 6,92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
, "write", 1,"128K", 25.398, 4.916, 0.8, 840, 26.8, 203 , 0, 0, 0, 0,43,19, 3,26, 4, 1, 0, 0, 0, 0, 0, 0
, "write", 4, "1K", 4.599, 0.834, 0.2, 574, 5.9, 4709 , 0, 0, 4,44,38,10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
, "write", 4, "8K", 14.488, 2.151, 0.2, 413, 9.0, 1854 , 0, 0, 0,32,48, 3, 0,11, 2, 0, 0, 0, 0, 0, 0, 0
, "write", 4,"128K", 14.852, 33.650, 0.6, 968, 127.6, 118 , 0, 0, 0, 0, 0,22,32,12,18, 7, 0, 0, 0, 3, 0, 0
, "write", 16, "1K", 8.199, 1.897, 0.2, 319, 9.2, 8396 , 0, 0, 0, 4,21,62,10, 0, 0, 0, 0, 0, 0, 0, 0, 0
, "write", 16, "8K", 26.959, 4.611, 0.3, 1000, 37.7, 3450 , 0, 0, 0, 0,11,67, 3,10, 3, 1, 0, 0, 0, 0, 0, 0
, "write", 16,"128K", 25.836, 77.210, 1.0, 2471, 292.5, 206 , 0, 0, 0, 0, 0, 0, 9,45,11, 5, 7,14, 2, 0, 0, 1
, "write", 16, "1M", 25.836, 77.210, 1.0, 2471, 292.5, 206 , 10,40,10,40,10,40, 9,45,11, 5,47,14,42,10,40,11
),nrow=25)
tm <- t(m)
m <-tm
colnames <- c("name","users","bs","MB","lat","min","max","std","iops",
"us50","us100","us250","us500","ms1","ms2","ms4","ms10","ms20","ms50","ms100","ms250","ms500","s1","s2","s5")
colnames(m)=colnames
m <- data.frame(m)
rr <- subset(m,m['users'] == 16)
rr <- subset(rr,rr['name'] == "write")
#rr <- subset(m,m['bs'] == "1K")
#rr <- subset(rr,rr['name'] == "write")
hist <- cbind(rr['us50'],rr['us100'], rr['us250'],rr['us500'],rr['ms1'],
rr['ms2'],rr['ms4'],rr['ms10'],rr['ms20'],rr['ms50'],
rr['ms100'],rr['ms250'],rr['ms500'],rr['s1'],rr['s2'],rr['s5'])
th <- t(hist)
thn <- apply(th, 1,as.numeric)
thn <- t(thn)
thnp <- thn/100
lat <- as.numeric(t(rr['lat']))
users <- as.numeric(t(rr['users']))
bs <- as.character(t(rr['bs']))
min <- as.numeric(t(rr['min']))
max <- as.numeric(t(rr['max']))
std <- as.numeric(t(rr['std']))
MB <- as.numeric(t(rr['MB']))
x <- (1:length(lat))
nf <- layout(matrix(c(2,1),2,1,byrow = TRUE), widths = 13,
heights = c(10, 3), respect = TRUE)
par(mar=c(2, 4, 1, 4))
layout.show(nf)
par("pin")
par(new = FALSE)
MBps <- t(matrix(MB))
MBbars <- t(t(thnp)*MB)
colnames(MBbars) =bs
colnames(MBps) =bs
op <- barplot(MBbars,col=colors,ylab="MB/s",border=NA,space=2)
text(op, 0,MB,adj=c(0,0),cex=.75)
par(mar=c(0, 4, 1, 4))
xmaxwidth <- length(lat)+1
xminwidth <- .5
barcol <- "grey90"
pts <- 1:nrow(th)
ylims <- c(.025,5000)
for (i in 1:ncol(th)){
xmin <- -i + xminwidth
xmax <- -i + xmaxwidth
print(c(i,xmin,xmax))
ser <- as.numeric(th[, i])
ser <- ser/100
col=ifelse(ser==0,"white","grey")
bp <- barplot(ser, horiz = TRUE, axes = FALSE,
xlim = c(xmin, xmax), ylim = c(0,nrow(th)),
border = NA, col = colors, space = 0, yaxt = "n")
par(new = TRUE)
}
par(new = TRUE)
# average latency
plot(x, lat, type = "p", xaxs = "i", lty = 1, col = "black", lwd = 5, bty = "l", ylab = "ms", xlab="size",
xlim = c(xminwidth,xmaxwidth), ylim = ylims, log = "y", yaxt = "n" , xaxt ="n")
par(new = TRUE)
# average latency
plot(x, lat, type = "l", xaxs = "i", lty = 1, col = "black", lwd = 1, bty = "l",
xlim = c(xminwidth,xmaxwidth), ylim = ylims, ylab = "" , xlab="",log = "y", yaxt = "n" , xaxt ="n")
text(x,lat,round(lat,1),adj=c(1,2))
# max latency
par(new = TRUE)
plot(x, max, type = "l", xaxs = "i", lty = 2, col = "red", lwd = 1, bty = "l",
xlim = c(xminwidth,xmaxwidth), ylim = ylims, ylab = "" , log = "y", xlab="",yaxt = "n" , xaxt ="n")
#text(x,max,round(max,1),adj=c(-1,-1))
# min latency
par(new = TRUE)
plot(x, pmax(min,0.1), type = "l", xaxs = "i", lty = 2, col = "green", lwd = 1, bty = "l",
xlim = c(xminwidth,xmaxwidth), ylim = ylims, ylab = "" , log = "y", yaxt = "n" , xlab="",xaxt ="n")
#text(x,min,round(min,1),adj=c(-1,-1))
ypts <- c(.05,.100,.250,.500,1,2,4,10,20,50,100,200,500,1000,2000,5000)
ylbs=c("us50","us100","us250","us500","ms1","ms2","ms4","ms10","ms20","ms50","ms100","ms200","ms500","s1","s2","s5" )
axis(4,at=ypts, labels=ylbs,las=1,cex.axis=.75,lty=0,lwd=0)
ypts <- c(.05,.250,.500,2,4,20,50,200,500,2000)
ylbs=c(".05",".25",".5","2","4","20","50","200","500","s2" )
ypts <- c(0.100, 1, 10, 100, 1000, 5000);
ylbs <- c("100u" ,"1m", "10m", "100m", "1s","5s");
axis(2,at=ypts, labels=ylbs)
for ( i in c(10) ) {
segments(0, i, xmaxwidth, i, col="orange", lwd=1,lty=2)
}
for ( i in c(.05,.100,.250,.500,1,2,4,10,20,50,100,200,500,1000,2000,5000) ) {
segments(0, i, xmaxwidth, i, lwd=1,lty=2, col= "lightpink")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment