Group fault rates / instruction plot per experiment
This commit is contained in:
Binary file not shown.
@@ -1,6 +1,7 @@
|
|||||||
library(ggplot2)
|
library(ggplot2)
|
||||||
library(dplyr)
|
library(dplyr)
|
||||||
library(readr)
|
library(readr)
|
||||||
|
library(stringr)
|
||||||
|
|
||||||
# Usage: Rscript combined_fault_rates.r exp_abspath1 exp_abspath2 ... [faults_file]
|
# Usage: Rscript combined_fault_rates.r exp_abspath1 exp_abspath2 ... [faults_file]
|
||||||
|
|
||||||
@@ -51,10 +52,23 @@ for (arg in exp_args) {
|
|||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
|
||||||
|
match <- str_match(
|
||||||
|
basename(arg),
|
||||||
|
"^\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}_(.+?)_(c|aot|interp)_"
|
||||||
|
)
|
||||||
|
if (is.na(match[1, 1])) {
|
||||||
|
base_name <- basename(arg)
|
||||||
|
variant <- "unknown"
|
||||||
|
} else {
|
||||||
|
base_name <- match[1, 2]
|
||||||
|
variant <- match[1, 3]
|
||||||
|
}
|
||||||
|
|
||||||
rates <- bind_rows(
|
rates <- bind_rows(
|
||||||
rates,
|
rates,
|
||||||
data.frame(
|
data.frame(
|
||||||
experiment = basename(arg),
|
base_name = base_name,
|
||||||
|
variant = variant,
|
||||||
fault_rate = total_faults / total_instrs
|
fault_rate = total_faults / total_instrs
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -64,25 +78,34 @@ if (nrow(rates) == 0) {
|
|||||||
stop("No data loaded")
|
stop("No data loaded")
|
||||||
}
|
}
|
||||||
|
|
||||||
# Order by fault rate
|
# Order base_names by their max fault rate
|
||||||
|
base_order <- rates |>
|
||||||
|
group_by(base_name) |>
|
||||||
|
summarise(max_rate = max(fault_rate), .groups = "drop") |>
|
||||||
|
arrange(desc(max_rate)) |>
|
||||||
|
pull(base_name)
|
||||||
|
|
||||||
rates <- rates |>
|
rates <- rates |>
|
||||||
arrange(desc(fault_rate)) |>
|
mutate(
|
||||||
mutate(experiment = factor(experiment, levels = experiment))
|
base_name = factor(base_name, levels = base_order),
|
||||||
|
variant = factor(variant, levels = c("c", "aot", "interp", "unknown"))
|
||||||
|
)
|
||||||
|
|
||||||
plot <- ggplot(
|
plot <- ggplot(
|
||||||
rates,
|
rates,
|
||||||
aes(x = experiment, y = fault_rate, fill = experiment)
|
aes(x = base_name, y = fault_rate, fill = variant)
|
||||||
) +
|
) +
|
||||||
geom_col() +
|
geom_col(position = position_dodge(preserve = "single")) +
|
||||||
|
scale_y_log10() +
|
||||||
labs(
|
labs(
|
||||||
title = "Fault Rate per Instruction",
|
title = "Fault Rate per Instruction",
|
||||||
x = "Experiment",
|
x = "Experiment",
|
||||||
y = "Faults / Instruction Count"
|
y = "Faults / Instruction Count",
|
||||||
|
fill = "Variant"
|
||||||
) +
|
) +
|
||||||
theme_minimal() +
|
theme_minimal() +
|
||||||
theme(
|
theme(
|
||||||
axis.text.x = element_text(angle = 90, hjust = 1),
|
axis.text.x = element_text(angle = 90, hjust = 1),
|
||||||
legend.position = "none",
|
|
||||||
plot.title = element_text(size = 14, face = "bold")
|
plot.title = element_text(size = 14, face = "bold")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user