Update charts to account for new datafile/charts folders
This commit is contained in:
@@ -3,26 +3,34 @@ library(dplyr)
|
||||
library(readr)
|
||||
library(stringr)
|
||||
|
||||
# Usage: Rscript combined_comparison.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Usage: Rscript combined_fault_count_comparison.r exp1 exp2 ... queries_dir charts_dir [resultsdata_file]
|
||||
# One coordinate system per base experiment (facet); c/aot/interp variants
|
||||
# share each facet, coloured by variant.
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 1) {
|
||||
stop("Need at least 1 experiment")
|
||||
}
|
||||
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"resultsdata.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
tail_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
if (length(tail_args) < 3) {
|
||||
stop(paste(
|
||||
"Usage: combined_fault_count_comparison.r",
|
||||
"<exp1> <exp2> ... <queries_dir> <charts_dir> [resultsdata_file]"
|
||||
))
|
||||
}
|
||||
|
||||
charts_dir <- tail_args[length(tail_args)]
|
||||
queries_dir <- tail_args[length(tail_args) - 1]
|
||||
exp_args <- tail_args[-c(length(tail_args) - 1, length(tail_args))]
|
||||
|
||||
extract_info <- function(path) {
|
||||
dir_name <- basename(path)
|
||||
match <- str_match(
|
||||
@@ -44,7 +52,7 @@ for (arg in exp_args) {
|
||||
next
|
||||
}
|
||||
|
||||
csv_file <- file.path(info$path, csv_suffix)
|
||||
csv_file <- file.path(queries_dir, paste0(arg, "_", csv_suffix))
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
@@ -98,6 +106,10 @@ plot <- ggplot(
|
||||
)
|
||||
|
||||
suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/fault_count_comparison", suffix, ".svg")
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
outfile <- file.path(
|
||||
charts_dir,
|
||||
paste0("fault_count_comparison", suffix, ".svg")
|
||||
)
|
||||
ggsave(outfile, plot = plot, width = 12, height = 6)
|
||||
print(paste("Saved", outfile))
|
||||
|
||||
@@ -4,25 +4,33 @@ library(readr)
|
||||
library(stringr)
|
||||
library(tidyr)
|
||||
|
||||
# Usage: Rscript combined_fault_correlation.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Usage: Rscript combined_fault_count_correlation.r exp1 exp2 ... queries_dir charts_dir [resultsdata_file]
|
||||
# Plots correlation between raw aot and interp fault counts (no C baseline).
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 2) {
|
||||
stop("Need at least 2 experiments")
|
||||
}
|
||||
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"resultsdata.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
tail_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
if (length(tail_args) < 4) {
|
||||
stop(paste(
|
||||
"Usage: combined_fault_count_correlation.r",
|
||||
"<exp1> <exp2> ... <queries_dir> <charts_dir> [resultsdata_file]"
|
||||
))
|
||||
}
|
||||
|
||||
charts_dir <- tail_args[length(tail_args)]
|
||||
queries_dir <- tail_args[length(tail_args) - 1]
|
||||
exp_args <- tail_args[-c(length(tail_args) - 1, length(tail_args))]
|
||||
|
||||
extract_info <- function(path) {
|
||||
dir_name <- basename(path)
|
||||
match <- str_match(
|
||||
@@ -44,7 +52,7 @@ for (arg in exp_args) {
|
||||
next
|
||||
}
|
||||
|
||||
csv_file <- file.path(info$path, csv_suffix)
|
||||
csv_file <- file.path(queries_dir, paste0(arg, "_", csv_suffix))
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
@@ -123,6 +131,10 @@ plot <- ggplot(
|
||||
)
|
||||
|
||||
suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/fault_count_correlation", suffix, ".svg")
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
outfile <- file.path(
|
||||
charts_dir,
|
||||
paste0("fault_count_correlation", suffix, ".svg")
|
||||
)
|
||||
ggsave(outfile, plot = plot, width = 10, height = 8)
|
||||
print(paste("Saved", outfile))
|
||||
|
||||
@@ -4,7 +4,7 @@ library(readr)
|
||||
library(stringr)
|
||||
library(tidyr)
|
||||
|
||||
# Usage: Rscript combined_fault_probability.r exp_abspath1 ... resultsdata_file
|
||||
# Usage: Rscript combined_fault_probability.r exp1 exp2 ... queries_dir charts_dir [resultsdata_file]
|
||||
#
|
||||
# Divides by the faultspace area instead of by a marker total, which makes the
|
||||
# running modes comparable: raw counts scale with how long WAMR runs, so they
|
||||
@@ -17,21 +17,29 @@ library(tidyr)
|
||||
# was therefore this chart with every bar rescaled to 100%.
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 2) {
|
||||
stop("Need at least 2 experiments")
|
||||
}
|
||||
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"resultsdata.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
tail_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
if (length(tail_args) < 4) {
|
||||
stop(paste(
|
||||
"Usage: combined_fault_probability.r",
|
||||
"<exp1> <exp2> ... <queries_dir> <charts_dir> [resultsdata_file]"
|
||||
))
|
||||
}
|
||||
|
||||
charts_dir <- tail_args[length(tail_args)]
|
||||
queries_dir <- tail_args[length(tail_args) - 1]
|
||||
exp_args <- tail_args[-c(length(tail_args) - 1, length(tail_args))]
|
||||
|
||||
extract_info <- function(path) {
|
||||
dir_name <- basename(path)
|
||||
match <- str_match(
|
||||
@@ -58,7 +66,7 @@ for (arg in exp_args) {
|
||||
next
|
||||
}
|
||||
|
||||
csv_file <- file.path(info$path, csv_suffix)
|
||||
csv_file <- file.path(queries_dir, paste0(arg, "_", csv_suffix))
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
@@ -120,5 +128,9 @@ plot <- ggplot(
|
||||
)
|
||||
|
||||
out_suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
||||
filename <- paste0("injections/fault_probability", out_suffix, ".svg")
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
filename <- file.path(
|
||||
charts_dir,
|
||||
paste0("fault_probability", out_suffix, ".svg")
|
||||
)
|
||||
ggsave(filename, plot = plot, width = 13, height = 8)
|
||||
|
||||
@@ -4,24 +4,32 @@ library(readr)
|
||||
library(stringr)
|
||||
library(tidyr)
|
||||
|
||||
# Usage: Rscript combined_fault_probability_merged.r exp_abspath1 ... resultsdata_file
|
||||
# Usage: Rscript combined_fault_probability_merged.r exp1 exp2 ... queries_dir charts_dir [resultsdata_file]
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 2) {
|
||||
stop("Need at least 2 experiments")
|
||||
}
|
||||
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"resultsdata.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
tail_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
if (length(tail_args) < 4) {
|
||||
stop(paste(
|
||||
"Usage: combined_fault_probability_merged.r",
|
||||
"<exp1> <exp2> ... <queries_dir> <charts_dir> [resultsdata_file]"
|
||||
))
|
||||
}
|
||||
|
||||
charts_dir <- tail_args[length(tail_args)]
|
||||
queries_dir <- tail_args[length(tail_args) - 1]
|
||||
exp_args <- tail_args[-c(length(tail_args) - 1, length(tail_args))]
|
||||
|
||||
extract_info <- function(path) {
|
||||
dir_name <- basename(path)
|
||||
match <- str_match(
|
||||
@@ -48,7 +56,7 @@ for (arg in exp_args) {
|
||||
next
|
||||
}
|
||||
|
||||
csv_file <- file.path(info$path, csv_suffix)
|
||||
csv_file <- file.path(queries_dir, paste0(arg, "_", csv_suffix))
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
@@ -113,5 +121,9 @@ plot <- ggplot(
|
||||
)
|
||||
|
||||
out_suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
||||
filename <- paste0("injections/fault_probability_merged", out_suffix, ".svg")
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
filename <- file.path(
|
||||
charts_dir,
|
||||
paste0("fault_probability_merged", out_suffix, ".svg")
|
||||
)
|
||||
ggsave(filename, plot = plot, width = 13, height = 8)
|
||||
|
||||
@@ -3,30 +3,38 @@ library(dplyr)
|
||||
library(readr)
|
||||
library(stringr)
|
||||
|
||||
# Usage: Rscript combined_fault_rates.r exp_abspath1 exp_abspath2 ... [faults_file]
|
||||
# Usage: Rscript combined_fault_rates_per_instruction.r exp1 exp2 ... queries_dir charts_dir [faults_file]
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 1) {
|
||||
stop("Need at least 1 experiment")
|
||||
}
|
||||
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"faults.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
tail_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
if (length(tail_args) < 3) {
|
||||
stop(paste(
|
||||
"Usage: combined_fault_rates_per_instruction.r",
|
||||
"<exp1> <exp2> ... <queries_dir> <charts_dir> [faults_file]"
|
||||
))
|
||||
}
|
||||
|
||||
charts_dir <- tail_args[length(tail_args)]
|
||||
queries_dir <- tail_args[length(tail_args) - 1]
|
||||
exp_args <- tail_args[-c(length(tail_args) - 1, length(tail_args))]
|
||||
|
||||
# Faults / instruction count, per experiment
|
||||
rates <- data.frame()
|
||||
|
||||
for (arg in exp_args) {
|
||||
faults_file <- file.path(arg, csv_suffix)
|
||||
mnem_file <- file.path(arg, "mnemonics.csv")
|
||||
faults_file <- file.path(queries_dir, paste0(arg, "_", csv_suffix))
|
||||
mnem_file <- file.path(queries_dir, paste0(arg, "_mnemonics.csv"))
|
||||
|
||||
if (!file.exists(faults_file)) {
|
||||
warning(paste("Missing:", faults_file))
|
||||
@@ -110,6 +118,10 @@ plot <- ggplot(
|
||||
)
|
||||
|
||||
suffix <- gsub("^faults|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/fault_rates_per_instruction", suffix, ".svg")
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
outfile <- file.path(
|
||||
charts_dir,
|
||||
paste0("fault_rates_per_instruction", suffix, ".svg")
|
||||
)
|
||||
ggsave(outfile, plot = plot, width = 12, height = 6)
|
||||
print(paste("Saved", outfile))
|
||||
|
||||
@@ -2,12 +2,9 @@ library(ggplot2)
|
||||
library(dplyr)
|
||||
library(readr)
|
||||
|
||||
# Usage: Rscript combined_instr_fault_correlation.r exp_abspath1 exp_abspath2 ... [faults_file]
|
||||
# Usage: Rscript combined_instr_fault_correlation.r exp1 exp2 ... queries_dir charts_dir [faults_file]
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 1) {
|
||||
stop("Need at least 1 experiment")
|
||||
}
|
||||
|
||||
# TODO: I should probably stop duplicating this each time
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
@@ -15,12 +12,23 @@ csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
} else {
|
||||
"faults.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
tail_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
if (length(tail_args) < 3) {
|
||||
stop(paste(
|
||||
"Usage: combined_instr_fault_correlation.r",
|
||||
"<exp1> <exp2> ... <queries_dir> <charts_dir> [faults_file]"
|
||||
))
|
||||
}
|
||||
|
||||
charts_dir <- tail_args[length(tail_args)]
|
||||
queries_dir <- tail_args[length(tail_args) - 1]
|
||||
exp_args <- tail_args[-c(length(tail_args) - 1, length(tail_args))]
|
||||
|
||||
# Don't use counts from faults.csv, as that would correlate completely
|
||||
# because only mnemonics with faults are listed there
|
||||
# NOTE: Doesn't match selected filters for faults.csv
|
||||
@@ -31,8 +39,8 @@ faults_data <- data.frame()
|
||||
|
||||
# TODO: I should probably stop duplicating this each time
|
||||
for (arg in exp_args) {
|
||||
mnem_path <- file.path(arg, mnemonics_file)
|
||||
faults_path <- file.path(arg, csv_suffix)
|
||||
mnem_path <- file.path(queries_dir, paste0(arg, "_", mnemonics_file))
|
||||
faults_path <- file.path(queries_dir, paste0(arg, "_", csv_suffix))
|
||||
|
||||
if (!file.exists(mnem_path)) {
|
||||
warning(paste("Missing:", mnem_path))
|
||||
@@ -129,6 +137,10 @@ plot <- ggplot(
|
||||
)
|
||||
|
||||
suffix <- gsub("^faults|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/instr_fault_correlation", suffix, ".svg")
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
outfile <- file.path(
|
||||
charts_dir,
|
||||
paste0("instr_fault_correlation", suffix, ".svg")
|
||||
)
|
||||
ggsave(outfile, plot = plot, width = 10, height = 8)
|
||||
print(paste("Saved", outfile))
|
||||
|
||||
@@ -3,25 +3,33 @@ library(dplyr)
|
||||
library(readr)
|
||||
library(stringr)
|
||||
|
||||
# Usage: Rscript ratio_comparison.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Usage: Rscript combined_ratio_comparison.r exp1 exp2 ... queries_dir charts_dir [resultsdata_file]
|
||||
# Plots every benchmark separately
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 2) {
|
||||
stop("Need at least 2 experiments")
|
||||
}
|
||||
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"resultsdata.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
tail_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
if (length(tail_args) < 4) {
|
||||
stop(paste(
|
||||
"Usage: combined_ratio_comparison.r",
|
||||
"<exp1> <exp2> ... <queries_dir> <charts_dir> [resultsdata_file]"
|
||||
))
|
||||
}
|
||||
|
||||
charts_dir <- tail_args[length(tail_args)]
|
||||
queries_dir <- tail_args[length(tail_args) - 1]
|
||||
exp_args <- tail_args[-c(length(tail_args) - 1, length(tail_args))]
|
||||
|
||||
extract_info <- function(path) {
|
||||
dir_name <- basename(path)
|
||||
match <- str_match(
|
||||
@@ -43,7 +51,7 @@ for (arg in exp_args) {
|
||||
next
|
||||
}
|
||||
|
||||
csv_file <- file.path(info$path, csv_suffix)
|
||||
csv_file <- file.path(queries_dir, paste0(arg, "_", csv_suffix))
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
@@ -99,6 +107,7 @@ plot <- ggplot(
|
||||
)
|
||||
|
||||
suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/ratio_comparison", suffix, ".svg")
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
outfile <- file.path(charts_dir, paste0("ratio_comparison", suffix, ".svg"))
|
||||
ggsave(outfile, plot = plot, width = 12, height = 8)
|
||||
print(paste("Saved", outfile))
|
||||
|
||||
@@ -3,25 +3,33 @@ library(dplyr)
|
||||
library(readr)
|
||||
library(stringr)
|
||||
|
||||
# Usage: Rscript ratio_comparison_merged_trap.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Usage: Rscript combined_ratio_comparison_merged.r exp1 exp2 ... queries_dir charts_dir [resultsdata_file]
|
||||
# Sums all benchmarks, merges GROUP1_MARKER into TRAP
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 2) {
|
||||
stop("Need at least 2 experiments")
|
||||
}
|
||||
|
||||
csv_suffix <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"resultsdata.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
tail_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
if (length(tail_args) < 4) {
|
||||
stop(paste(
|
||||
"Usage: combined_ratio_comparison_merged.r",
|
||||
"<exp1> <exp2> ... <queries_dir> <charts_dir> [resultsdata_file]"
|
||||
))
|
||||
}
|
||||
|
||||
charts_dir <- tail_args[length(tail_args)]
|
||||
queries_dir <- tail_args[length(tail_args) - 1]
|
||||
exp_args <- tail_args[-c(length(tail_args) - 1, length(tail_args))]
|
||||
|
||||
extract_info <- function(path) {
|
||||
dir_name <- basename(path)
|
||||
match <- str_match(
|
||||
@@ -43,7 +51,7 @@ for (arg in exp_args) {
|
||||
next
|
||||
}
|
||||
|
||||
csv_file <- file.path(info$path, csv_suffix)
|
||||
csv_file <- file.path(queries_dir, paste0(arg, "_", csv_suffix))
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
@@ -102,7 +110,11 @@ plot <- ggplot(
|
||||
)
|
||||
|
||||
suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/ratio_comparison_merged_trap", suffix, ".svg")
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
outfile <- file.path(
|
||||
charts_dir,
|
||||
paste0("ratio_comparison_merged_trap", suffix, ".svg")
|
||||
)
|
||||
ggsave(
|
||||
outfile,
|
||||
plot = plot,
|
||||
|
||||
@@ -1,21 +1,28 @@
|
||||
library(ggplot2)
|
||||
library(ggalluvial)
|
||||
|
||||
# Usage: Rscript combined_comparion.r exp_abspath1 exp_abspath2 ...
|
||||
# Usage: Rscript combined_sankey.r exp1 exp2 queries_dir charts_dir [faults_file]
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
argc <- length(args)
|
||||
|
||||
if (argc < 2 || argc > 3) {
|
||||
print("Expecting two or three arguments: exp1 exp2 [faults_file]")
|
||||
if (argc < 4 || argc > 5) {
|
||||
print(paste(
|
||||
"Expecting four or five arguments:",
|
||||
"exp1 exp2 queries_dir charts_dir [faults_file]"
|
||||
))
|
||||
stop()
|
||||
}
|
||||
|
||||
faults_file <- if (argc == 3) args[3] else "faults.csv"
|
||||
faults_file <- if (argc == 5) args[5] else "faults.csv"
|
||||
suffix <- gsub("^faults|\\.csv$", "", faults_file)
|
||||
|
||||
for (experiment in args[1:2]) {
|
||||
datafile <- file.path(experiment, faults_file)
|
||||
experiments <- args[1:2]
|
||||
queries_dir <- args[3]
|
||||
charts_dir <- args[4]
|
||||
|
||||
for (experiment in experiments) {
|
||||
datafile <- file.path(queries_dir, paste0(experiment, "_", faults_file))
|
||||
if (!file.exists(datafile)) {
|
||||
print(paste("Input file", datafile, "is missing"))
|
||||
stop()
|
||||
@@ -33,13 +40,13 @@ resulttype_labels <- c(
|
||||
)
|
||||
|
||||
# Read data
|
||||
datafile1 <- file.path(args[1], faults_file)
|
||||
datafile1 <- file.path(queries_dir, paste0(experiments[1], "_", faults_file))
|
||||
data1 <- readr::read_csv(datafile1)
|
||||
data1$fault_address <- strtoi(data1$fault_address)
|
||||
data1$resulttype <- resulttype_labels[data1$resulttype]
|
||||
# tibble::glimpse(data1)
|
||||
|
||||
datafile2 <- file.path(args[2], faults_file)
|
||||
datafile2 <- file.path(queries_dir, paste0(experiments[2], "_", faults_file))
|
||||
data2 <- readr::read_csv(datafile2)
|
||||
data2$fault_address <- strtoi(data2$fault_address)
|
||||
data2$resulttype <- resulttype_labels[data2$resulttype]
|
||||
@@ -77,7 +84,8 @@ plot <- ggplot(
|
||||
theme(legend.position = "none")
|
||||
|
||||
# TODO: Name the file according to the benchmarks
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
ggsave(
|
||||
paste0(args[2], "/../sankey", suffix, ".svg"),
|
||||
file.path(charts_dir, paste0("sankey", suffix, ".svg")),
|
||||
plot = plot,
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@ library(dplyr) # filter, mutate
|
||||
library(tidyr) # complete
|
||||
library(scales)
|
||||
|
||||
# Usage: Rscript single_heatmap.r exp_abspath
|
||||
# Usage: Rscript single_heatmap.r exp_name queries_dir charts_dir archive_dir [faults_file]
|
||||
|
||||
# =============================================================================
|
||||
# CONFIG
|
||||
@@ -127,19 +127,27 @@ n_occupied_rows <- function(addr_ints, rw) {
|
||||
# =============================================================================
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 1) {
|
||||
stop("Usage: Rscript single_heatmap.r <experiment_dir>")
|
||||
if (length(args) < 4) {
|
||||
stop(paste(
|
||||
"Usage: Rscript single_heatmap.r",
|
||||
"<experiment> <queries_dir> <charts_dir> <archive_dir> [faults_file]"
|
||||
))
|
||||
}
|
||||
|
||||
experiment <- args[1]
|
||||
faults_file <- if (length(args) >= 2) args[2] else "faults.csv"
|
||||
queries_dir <- args[2]
|
||||
charts_dir <- args[3]
|
||||
archive_dir <- args[4]
|
||||
faults_file <- if (length(args) >= 5) args[5] else "faults.csv"
|
||||
suffix <- gsub("^faults|\\.csv$", "", faults_file)
|
||||
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
|
||||
# =============================================================================
|
||||
# INPUT DATA (read once)
|
||||
# =============================================================================
|
||||
|
||||
datafile <- file.path(experiment, faults_file)
|
||||
datafile <- file.path(queries_dir, paste0(experiment, "_", faults_file))
|
||||
if (!file.exists(datafile)) {
|
||||
stop(paste("Input file not found:", datafile))
|
||||
}
|
||||
@@ -161,7 +169,7 @@ raw <- read_csv(
|
||||
# Names vector: sym_addr["_text_start"] = 0x10001a
|
||||
sym_addr <- setNames(integer(0), character(0))
|
||||
|
||||
elf_file <- file.path(experiment, "system.elf")
|
||||
elf_file <- file.path(archive_dir, experiment, "system.elf")
|
||||
|
||||
if (!file.exists(elf_file)) {
|
||||
message("system.elf not found")
|
||||
@@ -483,9 +491,10 @@ make_heatmap <- function(target_resulttype, target_benchmark) {
|
||||
fig_h <- total_slots * tile_size + 2.5
|
||||
|
||||
outfile <- file.path(
|
||||
experiment,
|
||||
charts_dir,
|
||||
paste0(
|
||||
"heatmap_",
|
||||
experiment,
|
||||
"_heatmap_",
|
||||
target_resulttype,
|
||||
"_",
|
||||
target_benchmark,
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
library(ggplot2)
|
||||
|
||||
# Usage: Rscript single_result.r exp_abspath [resultsdata_file]
|
||||
# Usage: Rscript single_result.r exp_name queries_dir charts_dir [resultsdata_file]
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
experiment <- args[1]
|
||||
resultsdata_file <- if (length(args) >= 2) args[2] else "resultsdata.csv"
|
||||
queries_dir <- args[2]
|
||||
charts_dir <- args[3]
|
||||
resultsdata_file <-
|
||||
if (length(args) >= 4) args[4] else "resultsdata.csv"
|
||||
suffix <- gsub("^resultsdata|\\.csv$", "", resultsdata_file)
|
||||
datafile <- file.path(experiment, resultsdata_file)
|
||||
datafile <- file.path(queries_dir, paste0(experiment, "_", resultsdata_file))
|
||||
|
||||
if (!file.exists(datafile)) {
|
||||
print(paste("Input file", datafile, "is missing"))
|
||||
@@ -22,7 +25,8 @@ plot <- ggplot(data, aes(x = benchmark, y = faults, fill = resulttype)) +
|
||||
labs(x = "Benchmark", y = "Faults", fill = "Result Type") +
|
||||
theme_minimal()
|
||||
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
ggsave(
|
||||
paste0(experiment, "/single_result", suffix, ".svg"),
|
||||
file.path(charts_dir, paste0(experiment, "_single_result", suffix, ".svg")),
|
||||
plot = plot,
|
||||
)
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
library(ggplot2)
|
||||
|
||||
# Usage: Rscript single_scatter.r exp_abspath
|
||||
# Usage: Rscript single_scatter.r exp_name queries_dir charts_dir [faults_file]
|
||||
|
||||
# TODO: Allow filtering resulttypes (or at least exclude OK_MARKER)
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
experiment <- args[1]
|
||||
faults_file <- if (length(args) >= 2) args[2] else "faults.csv"
|
||||
queries_dir <- args[2]
|
||||
charts_dir <- args[3]
|
||||
faults_file <- if (length(args) >= 4) args[4] else "faults.csv"
|
||||
suffix <- gsub("^faults|\\.csv$", "", faults_file)
|
||||
datafile <- file.path(experiment, faults_file)
|
||||
datafile <- file.path(queries_dir, paste0(experiment, "_", faults_file))
|
||||
|
||||
if (!file.exists(datafile)) {
|
||||
print(paste("Input file", datafile, "is missing"))
|
||||
@@ -28,7 +30,8 @@ plot <- ggplot(data, aes(x = fault_address, y = faults)) +
|
||||
labs(x = "Address", y = "Faults", color = "Type") +
|
||||
theme_minimal()
|
||||
|
||||
dir.create(charts_dir, showWarnings = FALSE, recursive = TRUE)
|
||||
ggsave(
|
||||
paste0(experiment, "/scatter", suffix, ".svg"),
|
||||
file.path(charts_dir, paste0(experiment, "_scatter", suffix, ".svg")),
|
||||
plot = plot,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user