3 # To use this to graph some benchmarks, install R (http://www.r-project.org/)
4 # and ggplot (http://ggplot2.org/).
6 # Once installed, you can generate some CSV output with a command like this:
8 # $ OUTPUT_FORMAT=csv node benchmark/http/client-request-body.js > data.csv
9 # $ ./benchmark/plot_csv.R data.csv data.png bytes type
11 # Where the 3rd argument to this script is the graph's X coordinate, the 4th is
12 # how the output is grouped, and the Y coordinate defaults to result.
17 # get info from arguments
18 args <- commandArgs(TRUE)
20 csvFilename <- args[1]
21 graphFilename <- args[2]
23 xCoordinate <- args[3]
27 data <- read.csv(file = csvFilename, head = TRUE)
30 plot <- ggplot(data = data, aes_string(x = xCoordinate, y = 'result', col = groupBy)) +
31 geom_point(size = 5) +
32 ggtitle(data$filename)
34 png(filename = graphFilename, width = 560, height = 480, units = 'px')
38 cat(paste('Saved to', graphFilename, '\n'))