commit de73ca1bfaedeba52b50342e5fed351fc8f54fdd
parent 12ebc6385bb8205c19e17f16c6ddbd7d21654135
Author: Ivan Gankevich <igankevich@ya.ru>
Date: Fri, 24 Mar 2017 12:20:36 +0300
Simplify script names.
Diffstat:
5 files changed, 83 insertions(+), 78 deletions(-)
diff --git a/Makefile b/Makefile
@@ -16,11 +16,11 @@ build/test-2-virt.pdf
-quiet \
-f main.tex
-build/test-1-phys.pdf: R/graph-overhead.R R/common.R
- ./R/graph-overhead.R data/test-1-phys $@
+build/test-1-phys.pdf: R/test-1.R R/common.R
+ ./R/test-1.R data/test-1-phys $@
-build/test-1-virt.pdf: R/graph-overhead.R R/common.R
- ./R/graph-overhead.R data/test-1-virt $@
+build/test-1-virt.pdf: R/test-1.R R/common.R
+ ./R/test-1.R data/test-1-virt $@
build/test-2-phys.pdf: R/test-2.R R/common.R \
data/test-2-phys/run-*/*
diff --git a/R/graph-overhead-virt.R b/R/graph-overhead-virt.R
@@ -1,42 +0,0 @@
-#!/usr/bin/env Rscript
-
-args <- commandArgs(trailingOnly=TRUE)
-if (length(args) < 2) {
- stop("USAGE: ./script DIR OUTFILE")
-}
-
-source(file.path("R", "common.R"))
-
-log1 <- load_overhead_from_log_file(args[[1]])
-outfile <- args[[2]]
-
-print(log1)
-
-pdf(
- file=outfile,
- width=3,
- height=2,
- pointsize=7
-)
-
-x1 <- subord.colRange(log1)
-y1 <- colMeans(log1) * 1e-6
-xlabels <- as.numeric(colnames(log1))
-ylabels <- pretty(range(y1))
-
-print(x1)
-print(y1)
-
-plot.new()
-plot.window(
- xlim=range(x1),
- ylim=range(y1)
-)
-axis(1, at=x1, labels=xlabels)
-axis(2, at=ylabels, labels=sprintf("%.f", ylabels))
-box()
-lines(x1, y1, lty="solid")
-#lines(x1, y1, lty="solid")
-#lines(x2, y2, lty="dashed")
-title(xlab="No. of nodes", ylab="Overhead, ms")
-
diff --git a/R/graph-overhead.R b/R/graph-overhead.R
@@ -1,32 +0,0 @@
-#!/usr/bin/env Rscript
-
-args <- commandArgs(trailingOnly=TRUE)
-if (length(args) < 2) {
- stop("./script INDIR OUTFILE")
-}
-
-source(file.path("R", "common.R"))
-
-prefix <- args[[1]]
-outfile <- args[[2]]
-runtime <- load_log_file_as_data_frame(prefix)
-print(runtime)
-x <- c(1:ncol(runtime))
-y <- colMeans(runtime) * 1e-3
-
-pdf(
- file=outfile,
- width=3,
- height=2,
- pointsize=7
-)
-plot(
- x,
- y,
- xlab="Surviving node no.",
- ylab="Running time, s",
- axes=FALSE
-)
-axis(1, at=x, labels=x)
-axis(2)
-box()
diff --git a/R/test-1.R b/R/test-1.R
@@ -0,0 +1,32 @@
+#!/usr/bin/env Rscript
+
+args <- commandArgs(trailingOnly=TRUE)
+if (length(args) < 2) {
+ stop("./script INDIR OUTFILE")
+}
+
+source(file.path("R", "common.R"))
+
+prefix <- args[[1]]
+outfile <- args[[2]]
+runtime <- load_log_file_as_data_frame(prefix)
+print(runtime)
+x <- c(1:ncol(runtime))
+y <- colMeans(runtime) * 1e-3
+
+pdf(
+ file=outfile,
+ width=3,
+ height=2,
+ pointsize=7
+)
+plot(
+ x,
+ y,
+ xlab="Surviving node no.",
+ ylab="Running time, s",
+ axes=FALSE
+)
+axis(1, at=x, labels=x)
+axis(2)
+box()
diff --git a/R/test-2.R b/R/test-2.R
@@ -0,0 +1,47 @@
+#!/usr/bin/env Rscript
+
+args <- commandArgs(trailingOnly=TRUE)
+if (length(args) < 2) {
+ stop("USAGE: ./script DIR OUTFILE")
+}
+
+source(file.path("R", "common.R"))
+
+log1 <- load_overhead_from_log_file(args[[1]])
+outfile <- args[[2]]
+logscale <- FALSE
+if (length(args) >= 3) {
+ logscale <- args[[3]]
+}
+
+pdf(
+ file=outfile,
+ width=3,
+ height=2,
+ pointsize=7
+)
+
+log1 <- log1[, sort(colnames(log1))]
+
+x1 <- as.numeric(colnames(log1))
+y1 <- colMeans(log1, na.rm=TRUE) * 1e-6
+xlabels <- as.numeric(colnames(log1))
+
+plot_args <- list(
+ x1,
+ y1,
+ lty="solid",
+ type="l",
+ xlab="No. of nodes",
+ ylab="Overhead, ms",
+ axes=FALSE
+)
+
+if (logscale != FALSE) {
+ plot_args$log <- logscale
+}
+
+do.call(plot, plot_args)
+axis(1, at=x1, labels=xlabels)
+axis(2)
+box()