# Throughput and Response time curves using R

I started using ‘R’, the statistical language, recently but its power is sorely missed in the IT industry especially in the project management and Capacity planning fields. In fact rigorous data quantification and analysis is given the short shrift by us in our software management activities like calculation of schedule variance and trends.

‘R’ in combination with PDQ helps us visualize the throughput and response time data. We should also be able to predict future performance by changing the service demands assuming that a faster disk or CPU is added. But that is a slightly more involved exercise.

This simple script shows response time graphs of multiple devices in the same graph.

The second graph shows throughput curves. We just have to use GetThruput instead of GetResponse.

```library(pdq)

# PDQ globals
think<-20

cpu<-"cpunode"
disk1<-"disknode1"
disk2<-"disknode2"
disk3<-"disknode3"

cpudemand<-0.092
disk1demand<-0.079
disk2demand<-0.108
disk3demand<-0.142

# R plot vectors
xc<-0
yc<-0

Init("")

CreateNode(cpu, CEN, FCFS)

Solve(EXACT)

xc[n]<-as.double(n)
}
plot(xc, yc, type="l", ylim=c(0,60), xlim=c(0,450), lwd=1, xlab="Vusers", ylab="seconds",col="violet")

text(370,13,paste("cpu-",as.numeric(cpudemand)))

# R plot vectors
xc1<-0
yc1<-0

Init("")

CreateNode(disk1, CEN, FCFS)

Solve(EXACT)

xc1[n]<-as.double(n)
}
lines(xc1, yc1,lwd=1,col="blue")
text(400,10,paste("Disk 1-",as.numeric(disk1demand)))

# R plot vectors
xc2<-0
yc2<-0

Init("")

CreateNode(disk2, CEN, FCFS)

Solve(EXACT)

xc2[n]<-as.double(n)
}
lines(xc2, yc2,lwd=1,col="green")
text(330,17,paste("Disk 2-",as.numeric(disk2demand)))

# R plot vectors
xc3<-0
yc3<-0

Init("")

CreateNode(disk3, CEN, FCFS)

Solve(EXACT)

xc3[n]<-as.double(n)  