require(grDevices)
library(ggplot2)

readData = function (file) {
    read.table(file, header = F, sep = " ", col.names = c("tick", "duration", "heap", "total"))
}

png(
  '/tmp/graph.png'
)

ggplot() +
ggtitle("Benchmarking RailwayJS performance") + 
ylab("Memory usage (mb)") +
xlab("Request number") +
theme(legend.title=element_blank()) +
geom_line(aes(tick, heap, colour="Usage"), readData("/tmp/data1")) +
geom_line(aes(tick, total, colour="Total"), readData("/tmp/data1"))

dev.off()

