3 # To use this script you'll need to install R: http://www.r-project.org/
4 # and a library for R called ggplot2
5 # Which can be done by starting R and typing install.packages("ggplot2")
9 # R version 2.11.0 beta (2010-04-12 r51689)
10 # > install.packages("ggplot2")
13 # Then you can try this script by providing a full path to .data file
14 # outputed from 'make bench'
19 # > ./benchmark/plot.R .benchmark_reports/ab-hello-world-buffer-1024/ff456b38862de3fd0118c6ac6b3f46edb1fbb87f/20101013162056.data
21 # This will generate a PNG file which you can view
24 # Hopefully these steps will be automated in the future.
30 args <- commandArgs(TRUE)
32 ab.load <- function (filename, name) {
33 raw <- data.frame(read.csv(filename, sep="\t", header=T), server=name)
34 raw <- data.frame(raw, time=raw$seconds-min(raw$seconds))
35 raw <- data.frame(raw, time_s=raw$time/1000000)
39 #ab.tsPoint <- function (d) {
40 # qplot(time_s, ttime, data=d, facets=server~.,
41 # geom="point", alpha=I(1/15), ylab="response time (ms)",
42 # xlab="time (s)", main="c=30, res=26kb",
46 #ab.tsLine <- function (d) {
47 # qplot(time_s, ttime, data=d, facets=server~.,
48 # geom="line", ylab="response time (ms)",
49 # xlab="time (s)", main="c=30, res=26kb",
55 data <- ab.load(filename, "node")
60 #hist_png_filename <- gsub(".data", "_hist.png", filename)
61 hist_png_filename <- "hist.png"
63 png(filename = hist_png_filename, width = 480, height = 380, units = "px")
65 qplot(ttime, data=data, geom="histogram",
67 binwidth=1, xlab="response time (ms)",
70 print(hist_png_filename)
76 #ts_png_filename <- gsub(".data", "_ts.png", filename)
77 ts_png_filename = "ts.png"
79 png(filename = ts_png_filename, width = 480, height = 380, units = "px")
81 qplot(time, ttime, data=data, facets=server~.,
82 geom="point", alpha=I(1/15), ylab="response time (ms)",
83 xlab="time (s)", main="xxx",
86 print(ts_png_filename)