Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-10-21 08:01:43 +0400
committerRyan Dahl <ry@tinyclouds.org>2010-10-21 08:28:49 +0400
commit33e45bbe46305cdba03c06b6ac6e122c82e86dda (patch)
tree9e5f06aaf38c8e4e428eeca522ed189161a0274f /benchmark
parent6570cd99e51adb082d0e0076a1205cd867f4ce41 (diff)
Add incomplete R plot file
Diffstat (limited to 'benchmark')
-rwxr-xr-xbenchmark/plot.R86
1 files changed, 86 insertions, 0 deletions
diff --git a/benchmark/plot.R b/benchmark/plot.R
new file mode 100755
index 00000000000..34599770e7a
--- /dev/null
+++ b/benchmark/plot.R
@@ -0,0 +1,86 @@
+#!/usr/bin/env Rscript
+
+# To use this script you'll need to install R: http://www.r-project.org/
+# and a library for R called ggplot2
+# Which can be done by starting R and typing install.packages("ggplot2")
+# like this:
+#
+# shell% R
+# R version 2.11.0 beta (2010-04-12 r51689)
+# > install.packages("ggplot2")
+# (follow prompt)
+#
+# Then you can try this script by providing a full path to .data file
+# outputed from 'make bench'
+#
+# > cd ~/src/node
+# > make bench
+# ...
+# > ./benchmark/plot.R .benchmark_reports/ab-hello-world-buffer-1024/ff456b38862de3fd0118c6ac6b3f46edb1fbb87f/20101013162056.data
+#
+# This will generate a PNG file which you can view
+#
+#
+# Hopefully these steps will be automated in the future.
+
+
+
+library(ggplot2)
+
+args <- commandArgs(TRUE)
+
+ab.load <- function (filename, name) {
+ raw <- data.frame(read.csv(filename, sep="\t", header=T), server=name)
+ raw <- data.frame(raw, time=raw$seconds-min(raw$seconds))
+ raw <- data.frame(raw, time_s=raw$time/1000000)
+ raw
+}
+
+#ab.tsPoint <- function (d) {
+# qplot(time_s, ttime, data=d, facets=server~.,
+# geom="point", alpha=I(1/15), ylab="response time (ms)",
+# xlab="time (s)", main="c=30, res=26kb",
+# ylim=c(0,100))
+#}
+#
+#ab.tsLine <- function (d) {
+# qplot(time_s, ttime, data=d, facets=server~.,
+# geom="line", ylab="response time (ms)",
+# xlab="time (s)", main="c=30, res=26kb",
+# ylim=c(0,100))
+#}
+
+
+filename <- args[0:1]
+data <- ab.load(filename, "node")
+
+
+# histogram
+
+#hist_png_filename <- gsub(".data", "_hist.png", filename)
+hist_png_filename <- "hist.png"
+
+png(filename = hist_png_filename, width = 480, height = 380, units = "px")
+
+qplot(ttime, data=data, geom="histogram",
+ main="xxx",
+ binwidth=1, xlab="response time (ms)",
+ xlim=c(0,50))
+
+print(hist_png_filename)
+
+
+
+# time series
+
+#ts_png_filename <- gsub(".data", "_ts.png", filename)
+ts_png_filename = "ts.png"
+
+png(filename = ts_png_filename, width = 480, height = 380, units = "px")
+
+qplot(time, ttime, data=data, facets=server~.,
+ geom="point", alpha=I(1/15), ylab="response time (ms)",
+ xlab="time (s)", main="xxx",
+ ylim=c(0,100))
+
+print(ts_png_filename)