test-2.R (745B)
1 #!/usr/bin/env Rscript 2 3 args <- commandArgs(trailingOnly=TRUE) 4 if (length(args) < 2) { 5 stop("USAGE: ./script DIR OUTFILE") 6 } 7 8 source(file.path("R", "common.R")) 9 10 log1 <- load_overhead_from_log_file(args[[1]]) 11 outfile <- args[[2]] 12 logscale <- FALSE 13 if (length(args) >= 3) { 14 logscale <- args[[3]] 15 } 16 17 pdf( 18 file=outfile, 19 width=3, 20 height=2, 21 pointsize=7 22 ) 23 24 log1 <- log1[, sort(colnames(log1))] 25 26 x1 <- as.numeric(colnames(log1)) 27 y1 <- colMeans(log1, na.rm=TRUE) * 1e-6 28 xlabels <- as.numeric(colnames(log1)) 29 30 plot_args <- list( 31 x1, 32 y1, 33 lty="solid", 34 type="l", 35 xlab="No. of nodes", 36 ylab="Overhead, ms", 37 axes=FALSE 38 ) 39 40 if (logscale != FALSE) { 41 plot_args$log <- logscale 42 } 43 44 do.call(plot, plot_args) 45 axis(1, at=x1, labels=xlabels) 46 axis(2) 47 box()