stats.r 1.25 KB
Newer Older
Philipp Meyer's avatar
Philipp Meyer committed
1
2
3
4
5
6
#!/usr/bin/Rscript

library("data.table")
library("Hmisc")

#folders <- c("LeaderElectionCR79", "LeaderElectionDKR82")
7
8
#folders <- c("LeaderElectionCR79")
folders <- c("Snapshot")
Philipp Meyer's avatar
Philipp Meyer committed
9
10
11
12
13
14
15
16
17
18
19

for (folder in folders) {
    infile <- paste(folder, "benchmark.out", sep="/")
    outfile <- paste(folder, "benchmark-agg.out", sep="/")
    timePlotFile <- paste(folder, "benchmark-time.pdf", sep="/")
    memoryPlotFile <- paste(folder, "benchmark-memory.pdf", sep="/")

    dataframe <- read.table(infile, header=TRUE)

    datatable <- data.table(dataframe)

20
21
    data <- datatable[,list(time=mean(user+system),memory=mean(memory/1024)),by=n]
    #data <- datatable[,list(time=mean(user+system),err_time=sd(user+system),memory=mean(memory/1024),err_memory=sd(memory)),by=n]
Philipp Meyer's avatar
Philipp Meyer committed
22
23
24
25
26
27
28
29
30
31
32
33
34

    write.table(data, file=outfile, row.names=FALSE)

    pdf(timePlotFile)
    plot(data$n,data$time,type="p",xlab="n",ylab="time (s)",main="Benchmark time consumption")
#with(data=data, expr=errbar(n, time, time+err_time, time-err_time, add=T, pch=1, cap=.1))
    dev.off()

    pdf(memoryPlotFile)
    plot(data$n,data$memory,type="p",xlab="n",ylab="memory (KiB)",main="Benchmark memory consumption")
#with(data=data, expr=errbar(n, memory, memory+err_memory, memory-err_memory, add=T, pch=1, cap=.1))
    dev.off()
}