Compare commits
2
Commits
2c622b482b
...
7abdc4d032
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7abdc4d032
|
||
|
|
bf94e83738
|
Binary file not shown.
Binary file not shown.
+45
-24
@@ -4,7 +4,17 @@ library(readr)
|
|||||||
library(stringr)
|
library(stringr)
|
||||||
library(tidyr)
|
library(tidyr)
|
||||||
|
|
||||||
# Usage: Rscript marker_composition.r exp_abspath1 ... resultsdata_file
|
# Usage: Rscript combined_fault_probability.r exp_abspath1 ... 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
|
||||||
|
# say more about execution length than about susceptibility.
|
||||||
|
#
|
||||||
|
# Each segment is P[outcome] for a uniformly random single-bit flip in the
|
||||||
|
# traced fault space, so a bar's height is P[anything goes wrong].
|
||||||
|
#
|
||||||
|
# Replaces combined_fault_composition.r, which divided by the marker total and
|
||||||
|
# was therefore this chart with every bar rescaled to 100%.
|
||||||
|
|
||||||
args <- commandArgs(trailingOnly = TRUE)
|
args <- commandArgs(trailingOnly = TRUE)
|
||||||
if (length(args) < 2) {
|
if (length(args) < 2) {
|
||||||
@@ -32,12 +42,15 @@ extract_info <- function(path) {
|
|||||||
warning(paste("Could not parse:", dir_name))
|
warning(paste("Could not parse:", dir_name))
|
||||||
return(NULL)
|
return(NULL)
|
||||||
}
|
}
|
||||||
list(base_name = match[1, 2], variant = match[1, 3], path = path)
|
|
||||||
|
# "tacle-kernel-bsort" -> "bsort", otherwise it doesn't fit
|
||||||
|
base_name <- sub("^tacle-[^-]+-", "", match[1, 2])
|
||||||
|
|
||||||
|
list(base_name = base_name, variant = match[1, 3], path = path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Load data
|
# Load data
|
||||||
all_data <- data.frame()
|
all_data <- data.frame()
|
||||||
weight_data <- data.frame()
|
|
||||||
|
|
||||||
for (arg in exp_args) {
|
for (arg in exp_args) {
|
||||||
info <- extract_info(arg)
|
info <- extract_info(arg)
|
||||||
@@ -56,37 +69,48 @@ for (arg in exp_args) {
|
|||||||
all_data <- bind_rows(all_data, df)
|
all_data <- bind_rows(all_data, df)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO: Finally put all the bullshit before this in some shared space
|
||||||
|
|
||||||
if (nrow(all_data) == 0) {
|
if (nrow(all_data) == 0) {
|
||||||
stop("No data loaded")
|
stop("No data loaded")
|
||||||
}
|
}
|
||||||
|
|
||||||
# Skip OK_MARKERs, sum GROUP1 + TRAP.
|
marker_order <- c(
|
||||||
all_data <- all_data |>
|
"OK_MARKER",
|
||||||
filter(resulttype != "OK_MARKER") |>
|
"DETECTED_MARKER",
|
||||||
mutate(
|
"GROUP1_MARKER",
|
||||||
resulttype = ifelse(resulttype == "GROUP1_MARKER", "TRAP", resulttype)
|
"TRAP",
|
||||||
) |>
|
"TIMEOUT",
|
||||||
group_by(base_name, variant, benchmark, resulttype) |>
|
"WRITE_TEXTSEGMENT",
|
||||||
summarise(faults = sum(faults), .groups = "drop")
|
"ACCESS_OUTERSPACE",
|
||||||
|
"FAIL_MARKER"
|
||||||
|
)
|
||||||
|
|
||||||
out_suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
# Don't merge GROUP1_MARKER into TRAP for this chart
|
||||||
|
# Also keep the OK_MARKERs, so the "sum to 100%" is accurate
|
||||||
# Calculate percentages
|
probability <- all_data |>
|
||||||
composition <- all_data |>
|
|
||||||
group_by(base_name, variant, benchmark) |>
|
group_by(base_name, variant, benchmark) |>
|
||||||
mutate(frac = faults / sum(faults)) |>
|
mutate(frac = faults / sum(faults, na.rm = TRUE)) |>
|
||||||
ungroup()
|
ungroup()
|
||||||
|
|
||||||
|
# Don't print alphabetically
|
||||||
|
probability$resulttype <- factor(probability$resulttype, levels = marker_order)
|
||||||
|
probability$variant <- factor(
|
||||||
|
probability$variant,
|
||||||
|
levels = c("c", "aot", "interp")
|
||||||
|
)
|
||||||
|
|
||||||
plot <- ggplot(
|
plot <- ggplot(
|
||||||
composition |> filter(variant %in% c("aot", "interp")),
|
probability,
|
||||||
aes(x = variant, y = frac, fill = resulttype)
|
aes(x = variant, y = frac, fill = resulttype)
|
||||||
) +
|
) +
|
||||||
geom_col() +
|
geom_col() +
|
||||||
facet_grid(benchmark ~ base_name) +
|
facet_grid(benchmark ~ base_name) +
|
||||||
|
scale_y_continuous(labels = scales::percent) +
|
||||||
labs(
|
labs(
|
||||||
title = "Marker Composition (AOT vs Interp)",
|
title = "Fault Probability per Fault Space",
|
||||||
x = NULL,
|
x = NULL,
|
||||||
y = "Percentage of Faults",
|
y = "Probability of Failure",
|
||||||
fill = "Fault Type"
|
fill = "Fault Type"
|
||||||
) +
|
) +
|
||||||
theme_minimal() +
|
theme_minimal() +
|
||||||
@@ -95,9 +119,6 @@ plot <- ggplot(
|
|||||||
axis.text.x = element_text(angle = 45, hjust = 1)
|
axis.text.x = element_text(angle = 45, hjust = 1)
|
||||||
)
|
)
|
||||||
|
|
||||||
filename <- paste0(
|
out_suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
||||||
"injections/fault_composition",
|
filename <- paste0("injections/fault_probability", out_suffix, ".svg")
|
||||||
out_suffix,
|
|
||||||
".svg"
|
|
||||||
)
|
|
||||||
ggsave(filename, plot = plot, width = 13, height = 8)
|
ggsave(filename, plot = plot, width = 13, height = 8)
|
||||||
+4
-4
@@ -653,15 +653,15 @@ my %handlers = (
|
|||||||
|
|
||||||
# Sucks to put those here but I can't write them inside the R scripts
|
# Sucks to put those here but I can't write them inside the R scripts
|
||||||
my %chart_descriptions = (
|
my %chart_descriptions = (
|
||||||
combined_fault_composition =>
|
|
||||||
'stacked fault type percentages/composition (resultsdata.csv).',
|
|
||||||
|
|
||||||
combined_fault_count_comparison =>
|
combined_fault_count_comparison =>
|
||||||
'faults per benchmark, c/aot/interp side by side (resultsdata.csv).',
|
'faults per benchmark, c/aot/interp side by side (resultsdata.csv).',
|
||||||
|
|
||||||
combined_fault_count_correlation =>
|
combined_fault_count_correlation =>
|
||||||
'correlation of raw aot vs. interp fault counts (resultsdata.csv).',
|
'correlation of raw aot vs. interp fault counts (resultsdata.csv).',
|
||||||
|
|
||||||
|
combined_fault_probability =>
|
||||||
|
'marker probability per fault space (resultsdata.csv [+ traceweight.csv]).',
|
||||||
|
|
||||||
combined_fault_rates_per_instruction =>
|
combined_fault_rates_per_instruction =>
|
||||||
'faults normalised by instruction count (faults.csv + mnemonics.csv).',
|
'faults normalised by instruction count (faults.csv + mnemonics.csv).',
|
||||||
|
|
||||||
@@ -698,7 +698,7 @@ my %handlers = (
|
|||||||
} @selected_charts;
|
} @selected_charts;
|
||||||
my @resultsdata_charts =
|
my @resultsdata_charts =
|
||||||
grep {
|
grep {
|
||||||
/_result|_fault_count_comparison|_ratio_comparison|_fault_count_correlation|_fault_composition/
|
/_result|_fault_count_comparison|_ratio_comparison|_fault_count_correlation|_fault_probability/
|
||||||
} @selected_charts;
|
} @selected_charts;
|
||||||
|
|
||||||
# Select if faults.csv or a filtered variant should be used
|
# Select if faults.csv or a filtered variant should be used
|
||||||
|
|||||||
Reference in New Issue
Block a user