Compare commits
15
Commits
fec9b32df1
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86e6037e59
|
||
|
|
aad3b85d8f
|
||
|
|
df83623101
|
||
|
|
7a3d1610ba
|
||
|
|
167c3a1290
|
||
|
|
8c9cc08de0
|
||
|
|
47e0cf129e
|
||
|
|
2d624c725c
|
||
|
|
edaf9bd8ba
|
||
|
|
98ecd11d2b
|
||
|
|
4e8bf01da9
|
||
|
|
a6e68ef800
|
||
|
|
9baf6605ed
|
||
|
|
822b59d70e
|
||
|
|
f9e2d6994a
|
@@ -6,3 +6,4 @@
|
||||
/db.conf
|
||||
/fail/bin/resultbrowser/app/__pycache__
|
||||
/fail/bin/VisualFAIL/CONFIGURATION.php
|
||||
/qemu.log
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<PROJECT>
|
||||
<PROJECT_DATA_XML_NAME NAME="DISPLAY_DATA">
|
||||
<SAVE_STATE>
|
||||
<ARRAY NAME="EXPANDED_PATHS" TYPE="string">
|
||||
<A VALUE="06-09_13-57-11_sum0_c_fail:" />
|
||||
</ARRAY>
|
||||
<STATE NAME="SHOW_TABLE" TYPE="boolean" VALUE="false" />
|
||||
</SAVE_STATE>
|
||||
</PROJECT_DATA_XML_NAME>
|
||||
<TOOL_MANAGER ACTIVE_WORKSPACE="Workspace">
|
||||
<WORKSPACE NAME="Workspace" ACTIVE="true" />
|
||||
</TOOL_MANAGER>
|
||||
</PROJECT>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<PROJECT>
|
||||
<PROJECT_DATA_XML_NAME NAME="DISPLAY_DATA">
|
||||
<SAVE_STATE>
|
||||
<ARRAY NAME="EXPANDED_PATHS" TYPE="string">
|
||||
<A VALUE="06-09_22-34-26_sum0_aot_fail:" />
|
||||
</ARRAY>
|
||||
<STATE NAME="SHOW_TABLE" TYPE="boolean" VALUE="false" />
|
||||
</SAVE_STATE>
|
||||
</PROJECT_DATA_XML_NAME>
|
||||
<TOOL_MANAGER ACTIVE_WORKSPACE="Workspace">
|
||||
<WORKSPACE NAME="Workspace" ACTIVE="true" />
|
||||
</TOOL_MANAGER>
|
||||
</PROJECT>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<PROJECT>
|
||||
<PROJECT_DATA_XML_NAME NAME="DISPLAY_DATA">
|
||||
<SAVE_STATE>
|
||||
<ARRAY NAME="EXPANDED_PATHS" TYPE="string">
|
||||
<A VALUE="06-10_21-32-23_sum0_interp_fail:" />
|
||||
</ARRAY>
|
||||
<STATE NAME="SHOW_TABLE" TYPE="boolean" VALUE="false" />
|
||||
</SAVE_STATE>
|
||||
</PROJECT_DATA_XML_NAME>
|
||||
<TOOL_MANAGER ACTIVE_WORKSPACE="Workspace">
|
||||
<WORKSPACE NAME="Workspace" ACTIVE="true" />
|
||||
</TOOL_MANAGER>
|
||||
</PROJECT>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+8
-4
@@ -202,7 +202,6 @@ local $ENV{WAMR_USE_LINEAR_POOL_IN_TEXT} =
|
||||
# ========================================================================================= #
|
||||
|
||||
# NOTE: The runner will prefix "-Wf," to each flag
|
||||
# TODO: Exclude --wamr-exceptions from C builds automatically
|
||||
my %catch_flag_map = (
|
||||
"--catch-outer" => "--catch-outerspace",
|
||||
"--catch-text" => "--catch-write-textsegment",
|
||||
@@ -219,12 +218,17 @@ if ( grep { $_ eq "fail" } @selected_targets ) {
|
||||
# Build everything
|
||||
# ========================================================================================= #
|
||||
|
||||
# TODO: linux-baremetal target is broken
|
||||
system( "mkdir", "-p", "$local_builds_dir" );
|
||||
foreach my $experiment (@selected_experiments) {
|
||||
foreach my $target (@selected_targets) {
|
||||
foreach my $mode (@selected_modes) {
|
||||
|
||||
# Remove --wamr-exceptions for C builds, it is WAMR-specific
|
||||
my @build_catch_flags =
|
||||
$mode eq "c"
|
||||
? grep { $_ ne "--wamr-exceptions" } @selected_catch_flags
|
||||
: @selected_catch_flags;
|
||||
|
||||
my $allocator_info = "";
|
||||
if ( $mode eq "aot" || $mode eq "interp" ) {
|
||||
$allocator_info =
|
||||
@@ -268,7 +272,7 @@ foreach my $experiment (@selected_experiments) {
|
||||
&& $selected_linear_pool_variant eq $linear_pool_variants[0] )
|
||||
? "wamr_linear_pool"
|
||||
: "";
|
||||
my $flags_info = join " ", @selected_catch_flags;
|
||||
my $flags_info = join " ", @build_catch_flags;
|
||||
|
||||
my $info_str = join " ",
|
||||
grep { length } (
|
||||
@@ -289,7 +293,7 @@ foreach my $experiment (@selected_experiments) {
|
||||
"$local_root/build-$experiment/runner_flags";
|
||||
open( my $fhandle, '>', $runner_flags_path )
|
||||
or die "Cannot write $runner_flags_path: $!";
|
||||
print $fhandle "$catch_flag_map{$_}\n" for @selected_catch_flags;
|
||||
print $fhandle "$catch_flag_map{$_}\n" for @build_catch_flags;
|
||||
close($fhandle);
|
||||
|
||||
system( "mv", "$local_root/build.log",
|
||||
|
||||
+36
-10
@@ -1,8 +1,11 @@
|
||||
library(ggplot2)
|
||||
library(dplyr)
|
||||
library(readr)
|
||||
library(stringr)
|
||||
|
||||
# Usage: Rscript combined_comparison.r exp_abspath1 exp_abspath2 ... [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) {
|
||||
@@ -20,17 +23,36 @@ exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args
|
||||
}
|
||||
|
||||
extract_info <- function(path) {
|
||||
dir_name <- basename(path)
|
||||
match <- str_match(
|
||||
dir_name,
|
||||
"^\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}_(.+?)_(c|aot|interp)_"
|
||||
)
|
||||
if (is.na(match[1, 1])) {
|
||||
warning(paste("Could not parse:", dir_name))
|
||||
return(NULL)
|
||||
}
|
||||
list(base_name = match[1, 2], variant = match[1, 3], path = path)
|
||||
}
|
||||
|
||||
all_data <- data.frame()
|
||||
|
||||
for (arg in exp_args) {
|
||||
csv_file <- file.path(arg, csv_suffix)
|
||||
info <- extract_info(arg)
|
||||
if (is.null(info)) {
|
||||
next
|
||||
}
|
||||
|
||||
csv_file <- file.path(info$path, csv_suffix)
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
}
|
||||
|
||||
df <- read_csv(csv_file, col_types = cols())
|
||||
df$experiment <- basename(arg)
|
||||
df$base_name <- info$base_name
|
||||
df$variant <- info$variant
|
||||
all_data <- bind_rows(all_data, df)
|
||||
}
|
||||
|
||||
@@ -39,7 +61,7 @@ if (nrow(all_data) == 0) {
|
||||
}
|
||||
|
||||
totals <- all_data |>
|
||||
group_by(experiment, resulttype) |>
|
||||
group_by(base_name, variant, resulttype) |>
|
||||
summarise(faults = sum(faults, na.rm = TRUE), .groups = "drop") |>
|
||||
ungroup()
|
||||
|
||||
@@ -57,21 +79,25 @@ totals$resulttype <- factor(totals$resulttype, levels = marker_order)
|
||||
|
||||
plot <- ggplot(
|
||||
totals,
|
||||
aes(x = resulttype, y = faults, colour = experiment, group = experiment)
|
||||
aes(x = resulttype, y = faults, colour = variant, group = variant)
|
||||
) +
|
||||
geom_point(size = 2) +
|
||||
geom_line() +
|
||||
facet_wrap(~base_name) +
|
||||
scale_y_log10() +
|
||||
labs(
|
||||
x = "Marker",
|
||||
y = "Faults",
|
||||
title = "Combined Comparison",
|
||||
color = "Experiment"
|
||||
x = "Fault Type",
|
||||
y = "Fault Count",
|
||||
title = "Fault Count Comparison",
|
||||
color = "Variant"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(axis.text.x = element_text(angle = 45, hjust = 1))
|
||||
theme(
|
||||
axis.text.x = element_text(angle = 90, hjust = 1),
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/combined_comparison", suffix, ".svg")
|
||||
outfile <- paste0("injections/fault_count_comparison", suffix, ".svg")
|
||||
ggsave(outfile, plot = plot, width = 12, height = 6)
|
||||
print(paste("Saved", outfile))
|
||||
+38
-32
@@ -4,8 +4,8 @@ library(readr)
|
||||
library(stringr)
|
||||
library(tidyr)
|
||||
|
||||
# Usage: Rscript ratio_correlation.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Plots correlation between aot/c and interp/c ratios
|
||||
# Usage: Rscript combined_fault_correlation.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Plots correlation between raw aot and interp fault counts (no C baseline).
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 2) {
|
||||
@@ -69,48 +69,52 @@ all_data <- all_data |>
|
||||
group_by(base_name, variant, benchmark, resulttype) |>
|
||||
summarise(faults = sum(faults), .groups = "drop")
|
||||
|
||||
baseline <- all_data |> filter(variant == "c")
|
||||
comparisons <- all_data |> filter(variant != "c")
|
||||
# Only aot/interp matter; C is not used as a baseline here.
|
||||
counts <- all_data |> filter(variant %in% c("aot", "interp"))
|
||||
|
||||
ratios <- comparisons |>
|
||||
left_join(
|
||||
baseline |> select(base_name, benchmark, resulttype, faults),
|
||||
by = c("base_name", "benchmark", "resulttype"),
|
||||
suffix = c("", "_baseline")
|
||||
) |>
|
||||
filter(!is.na(faults_baseline), faults_baseline > 0) |>
|
||||
mutate(ratio = faults / faults_baseline)
|
||||
|
||||
if (nrow(ratios) == 0) {
|
||||
stop("No ratios computed (missing baseline or zero values)")
|
||||
}
|
||||
|
||||
# Pivot to get aot and interp ratios side by side
|
||||
ratio_wide <- ratios |>
|
||||
select(base_name, benchmark, resulttype, variant, ratio) |>
|
||||
pivot_wider(names_from = variant, values_from = ratio) |>
|
||||
# Pivot to get aot and interp fault counts side by side
|
||||
counts_wide <- counts |>
|
||||
select(base_name, benchmark, resulttype, variant, faults) |>
|
||||
pivot_wider(names_from = variant, values_from = faults) |>
|
||||
filter(!is.na(aot), !is.na(interp))
|
||||
|
||||
if (nrow(ratio_wide) == 0) {
|
||||
stop("No paired aot/interp ratios found")
|
||||
if (nrow(counts_wide) == 0) {
|
||||
stop("No paired aot/interp fault counts found")
|
||||
}
|
||||
|
||||
# Compute correlation
|
||||
cor_result <- cor(ratio_wide$aot, ratio_wide$interp, method = "pearson")
|
||||
cat(sprintf("Pearson correlation: %.4f\n", cor_result))
|
||||
cor_raw <- cor(counts_wide$aot, counts_wide$interp, method = "pearson")
|
||||
cor_log <- cor(
|
||||
log10(counts_wide$aot),
|
||||
log10(counts_wide$interp),
|
||||
method = "pearson"
|
||||
)
|
||||
cat(sprintf("Pearson correlation (raw): %.4f\n", cor_raw))
|
||||
cat(sprintf("Pearson correlation (log10): %.4f\n", cor_log))
|
||||
|
||||
# Create plot
|
||||
plot <- ggplot(
|
||||
ratio_wide,
|
||||
counts_wide,
|
||||
aes(x = aot, y = interp, color = base_name, shape = resulttype)
|
||||
) +
|
||||
# geom_abline(
|
||||
# slope = 1,
|
||||
# intercept = 0,
|
||||
# colour = "grey70",
|
||||
# linetype = "dotted"
|
||||
# ) +
|
||||
geom_point(size = 3, alpha = 0.7) +
|
||||
scale_x_log10(name = "AOT / C Ratio") +
|
||||
scale_y_log10(name = "Interpreter / C Ratio") +
|
||||
scale_x_log10(name = "AOT Fault Count") +
|
||||
scale_y_log10(name = "Interpreter Fault Count") +
|
||||
labs(
|
||||
title = sprintf("Ratio Correlation (r = %.4f)", cor_result),
|
||||
# title = sprintf(
|
||||
# "Fault Count Correlation (r_raw = %.4f, r_log = %.4f)",
|
||||
# cor_raw,
|
||||
# cor_log
|
||||
# ),
|
||||
title = "Fault Count Correlation",
|
||||
color = "Experiment",
|
||||
shape = "Marker"
|
||||
shape = "Fault Type"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(
|
||||
@@ -118,5 +122,7 @@ plot <- ggplot(
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
ggsave("injections/ratio_correlation.svg", plot = plot, width = 10, height = 8)
|
||||
print("Saved ratio_correlation.svg")
|
||||
suffix <- gsub("^resultsdata|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/fault_count_correlation", suffix, ".svg")
|
||||
ggsave(outfile, plot = plot, width = 10, height = 8)
|
||||
print(paste("Saved", outfile))
|
||||
@@ -0,0 +1,115 @@
|
||||
library(ggplot2)
|
||||
library(dplyr)
|
||||
library(readr)
|
||||
library(stringr)
|
||||
|
||||
# Usage: Rscript combined_fault_rates.r exp_abspath1 exp_abspath2 ... [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)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
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")
|
||||
|
||||
if (!file.exists(faults_file)) {
|
||||
warning(paste("Missing:", faults_file))
|
||||
next
|
||||
}
|
||||
if (!file.exists(mnem_file)) {
|
||||
warning(paste("Missing:", mnem_file))
|
||||
next
|
||||
}
|
||||
|
||||
df <- read_csv(faults_file, col_types = cols())
|
||||
mdf <- read_csv(mnem_file, col_types = cols())
|
||||
|
||||
total_faults <- df |>
|
||||
filter(resulttype != "OK_MARKER") |>
|
||||
summarise(faults = sum(faults, na.rm = TRUE)) |>
|
||||
pull(faults)
|
||||
|
||||
total_instrs <- sum(mdf$count, na.rm = TRUE)
|
||||
|
||||
if (is.na(total_instrs) || total_instrs == 0) {
|
||||
warning(paste("Zero instruction count for", arg))
|
||||
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,
|
||||
data.frame(
|
||||
base_name = base_name,
|
||||
variant = variant,
|
||||
fault_rate = total_faults / total_instrs
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
if (nrow(rates) == 0) {
|
||||
stop("No data loaded")
|
||||
}
|
||||
|
||||
# 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 |>
|
||||
mutate(
|
||||
base_name = factor(base_name, levels = base_order),
|
||||
variant = factor(variant, levels = c("c", "aot", "interp", "unknown"))
|
||||
)
|
||||
|
||||
plot <- ggplot(
|
||||
rates,
|
||||
aes(x = base_name, y = fault_rate, fill = variant)
|
||||
) +
|
||||
geom_col(position = position_dodge(preserve = "single")) +
|
||||
scale_y_log10() +
|
||||
labs(
|
||||
title = "Fault Rate per Instruction",
|
||||
x = "Experiment",
|
||||
y = "Faults / Instruction Count",
|
||||
fill = "Variant"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(
|
||||
axis.text.x = element_text(angle = 90, hjust = 1),
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
suffix <- gsub("^faults|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/fault_rates_per_instruction", suffix, ".svg")
|
||||
ggsave(outfile, plot = plot, width = 12, height = 6)
|
||||
print(paste("Saved", outfile))
|
||||
@@ -0,0 +1,133 @@
|
||||
library(ggplot2)
|
||||
library(dplyr)
|
||||
library(readr)
|
||||
|
||||
# Usage: Rscript combined_instr_fault_correlation.r exp_abspath1 exp_abspath2 ... [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)])) {
|
||||
args[length(args)]
|
||||
} else {
|
||||
"faults.csv"
|
||||
}
|
||||
exp_args <- if (grepl("\\.csv$", args[length(args)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
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
|
||||
mnemonics_file <- "mnemonics.csv"
|
||||
|
||||
freq_data <- data.frame()
|
||||
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)
|
||||
|
||||
if (!file.exists(mnem_path)) {
|
||||
warning(paste("Missing:", mnem_path))
|
||||
next
|
||||
}
|
||||
if (!file.exists(faults_path)) {
|
||||
warning(paste("Missing:", faults_path))
|
||||
next
|
||||
}
|
||||
|
||||
mdf <- read_csv(mnem_path, col_types = cols())
|
||||
mdf$experiment <- basename(arg)
|
||||
freq_data <- bind_rows(freq_data, mdf)
|
||||
|
||||
fdf <- read_csv(faults_path, col_types = cols())
|
||||
fdf$experiment <- basename(arg)
|
||||
faults_data <- bind_rows(faults_data, fdf)
|
||||
}
|
||||
|
||||
if (nrow(freq_data) == 0 || nrow(faults_data) == 0) {
|
||||
stop("No data loaded")
|
||||
}
|
||||
|
||||
# x-axis: mnemonics.csv counts
|
||||
instr_freq <- freq_data |>
|
||||
filter(!is.na(mnemonic), mnemonic != "NULL") |>
|
||||
group_by(mnemonic) |>
|
||||
summarise(instr_count = sum(count, na.rm = TRUE), .groups = "drop")
|
||||
|
||||
# y-axis: no OK_MARKERs, sum GROUP1_MARKER + TRAP.
|
||||
marker_count <- faults_data |>
|
||||
filter(!is.na(mnemonic), mnemonic != "NULL") |>
|
||||
filter(resulttype != "OK_MARKER") |>
|
||||
mutate(
|
||||
resulttype = ifelse(resulttype == "GROUP1_MARKER", "TRAP", resulttype)
|
||||
) |>
|
||||
group_by(mnemonic) |>
|
||||
summarise(marker_count = sum(faults, na.rm = TRUE), .groups = "drop")
|
||||
|
||||
correlation <- instr_freq |>
|
||||
inner_join(marker_count, by = "mnemonic") |>
|
||||
filter(instr_count > 0, marker_count > 0)
|
||||
|
||||
if (nrow(correlation) < 2) {
|
||||
stop("Not enough mnemonics to compute a correlation")
|
||||
}
|
||||
|
||||
cor_raw <- cor(
|
||||
correlation$instr_count,
|
||||
correlation$marker_count,
|
||||
method = "pearson"
|
||||
)
|
||||
cor_log <- cor(
|
||||
log10(correlation$instr_count),
|
||||
log10(correlation$marker_count),
|
||||
method = "pearson"
|
||||
)
|
||||
cat(sprintf("Pearson correlation (raw): %.4f\n", cor_raw))
|
||||
cat(sprintf("Pearson correlation (log10): %.4f\n", cor_log))
|
||||
|
||||
plot <- ggplot(
|
||||
correlation,
|
||||
aes(x = instr_count, y = marker_count)
|
||||
) +
|
||||
geom_smooth(
|
||||
method = "lm",
|
||||
se = FALSE,
|
||||
colour = "grey50",
|
||||
linetype = "dashed"
|
||||
) +
|
||||
geom_point(aes(colour = mnemonic), size = 3, alpha = 0.8) +
|
||||
geom_text(
|
||||
aes(label = mnemonic),
|
||||
size = 3,
|
||||
vjust = -0.8,
|
||||
check_overlap = TRUE
|
||||
) +
|
||||
scale_x_log10(name = "Instruction Executions") +
|
||||
scale_y_log10(name = "Fault Count") +
|
||||
labs(
|
||||
# title = sprintf(
|
||||
# "Instruction / Fault Correlation (r_raw = %.4f, r_log = %.4f)",
|
||||
# cor_raw,
|
||||
# cor_log
|
||||
# ),
|
||||
title = "Instruction / Fault Correlation",
|
||||
colour = "Mnemonic"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(
|
||||
legend.position = "none",
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
suffix <- gsub("^faults|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/instr_fault_correlation", suffix, ".svg")
|
||||
ggsave(outfile, plot = plot, width = 10, height = 8)
|
||||
print(paste("Saved", outfile))
|
||||
@@ -0,0 +1,120 @@
|
||||
library(ggplot2)
|
||||
library(dplyr)
|
||||
library(readr)
|
||||
library(viridisLite)
|
||||
|
||||
# Usage: Rscript combined_instr_fault_correlation_heatmap.r exp_abspath1 ... [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)])) {
|
||||
args[-length(args)]
|
||||
} else {
|
||||
args
|
||||
}
|
||||
|
||||
all_data <- data.frame()
|
||||
all_mnem <- data.frame()
|
||||
|
||||
for (arg in exp_args) {
|
||||
csv_file <- file.path(arg, csv_suffix)
|
||||
if (!file.exists(csv_file)) {
|
||||
warning(paste("Missing:", csv_file))
|
||||
next
|
||||
}
|
||||
|
||||
df <- read_csv(csv_file, col_types = cols())
|
||||
df$experiment <- basename(arg)
|
||||
all_data <- bind_rows(all_data, df)
|
||||
|
||||
# TODO: This is ignoring any filters currently
|
||||
mnem_file <- file.path(arg, "mnemonics.csv")
|
||||
if (!file.exists(mnem_file)) {
|
||||
warning(paste("Missing:", mnem_file))
|
||||
next
|
||||
}
|
||||
mdf <- read_csv(mnem_file, col_types = cols())
|
||||
all_mnem <- bind_rows(all_mnem, mdf)
|
||||
}
|
||||
|
||||
if (nrow(all_data) == 0) {
|
||||
stop("No faults.csv data loaded")
|
||||
}
|
||||
|
||||
if (nrow(all_mnem) == 0) {
|
||||
stop("No mnemonics.csv data loaded")
|
||||
}
|
||||
|
||||
# no OK_MARKER, sum GROUP1 + TRAP.
|
||||
all_data <- all_data |>
|
||||
filter(!is.na(mnemonic), mnemonic != "NULL") |>
|
||||
filter(resulttype != "OK_MARKER") |>
|
||||
mutate(
|
||||
resulttype = ifelse(resulttype == "GROUP1_MARKER", "TRAP", resulttype)
|
||||
)
|
||||
|
||||
if (nrow(all_data) == 0) {
|
||||
stop("No failure-marker data to plot")
|
||||
}
|
||||
|
||||
# Sum faults per (mnemonic, marker) pair for all experiments
|
||||
heat <- all_data |>
|
||||
group_by(mnemonic, resulttype) |>
|
||||
summarise(faults = sum(faults, na.rm = TRUE), .groups = "drop")
|
||||
|
||||
# Sum mnemonic counts for all experiments
|
||||
mnem_counts <- all_mnem |>
|
||||
filter(!is.na(mnemonic), mnemonic != "NULL") |>
|
||||
group_by(mnemonic) |>
|
||||
summarise(count = sum(count, na.rm = TRUE), .groups = "drop")
|
||||
|
||||
# Normalize by mnemonic count
|
||||
heat <- heat |>
|
||||
left_join(mnem_counts, by = "mnemonic") |>
|
||||
filter(!is.na(count), count > 0) |>
|
||||
mutate(fault_rate = faults / count)
|
||||
|
||||
if (nrow(heat) == 0) {
|
||||
stop("Heat join failed")
|
||||
}
|
||||
|
||||
# Order by fault rate
|
||||
mnem_order <- heat |>
|
||||
group_by(mnemonic) |>
|
||||
summarise(total = sum(fault_rate), .groups = "drop") |>
|
||||
arrange(desc(total)) |>
|
||||
pull(mnemonic)
|
||||
|
||||
heat <- heat |>
|
||||
mutate(mnemonic = factor(mnemonic, levels = mnem_order))
|
||||
|
||||
plot <- ggplot(
|
||||
heat,
|
||||
aes(x = mnemonic, y = resulttype, fill = fault_rate)
|
||||
) +
|
||||
geom_tile(colour = "white") +
|
||||
scale_fill_viridis_c(name = "Fault rate", trans = "log10") +
|
||||
labs(
|
||||
title = "Instruction / Fault Rate Heatmap (Normalized)",
|
||||
x = "Instruction",
|
||||
y = "Fault Type"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(
|
||||
axis.text.x = element_text(angle = 90, hjust = 1),
|
||||
panel.grid = element_blank(),
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
suffix <- gsub("^faults|\\.csv$", "", csv_suffix)
|
||||
outfile <- paste0("injections/instr_fault_rate_heatmap", suffix, ".svg")
|
||||
ggsave(outfile, plot = plot, width = 12, height = 6)
|
||||
print(paste("Saved", outfile))
|
||||
@@ -83,12 +83,18 @@ plot <- ggplot(
|
||||
) +
|
||||
geom_point(size = 2) +
|
||||
geom_line() +
|
||||
facet_wrap(~base_name, scales = "free_x") +
|
||||
facet_wrap(~base_name) +
|
||||
scale_y_log10(name = "Ratio (to C)") +
|
||||
scale_x_discrete(name = "Marker") +
|
||||
labs(color = "Variant") +
|
||||
scale_x_discrete(name = "Fault Type") +
|
||||
labs(
|
||||
title = "Fault Count Ratios",
|
||||
color = "Variant"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(axis.text.x = element_text(angle = 45, hjust = 1))
|
||||
theme(
|
||||
axis.text.x = element_text(angle = 90, hjust = 1),
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
ggsave("injections/ratio_comparison.svg", plot = plot, width = 12, height = 8)
|
||||
print("Saved ratio_comparison.svg")
|
||||
|
||||
@@ -3,8 +3,8 @@ library(dplyr)
|
||||
library(readr)
|
||||
library(stringr)
|
||||
|
||||
# Usage: Rscript ratio_comparison_merged.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Sums all benchmarks
|
||||
# Usage: Rscript ratio_comparison_merged_trap.r exp_abspath1 exp_abspath2 ... [resultsdata_file]
|
||||
# Sums all benchmarks, merges GROUP1_MARKER into TRAP
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) < 2) {
|
||||
@@ -59,7 +59,9 @@ if (nrow(all_data) == 0) {
|
||||
stop("No data loaded")
|
||||
}
|
||||
|
||||
# Add all benchs together (per marker type)
|
||||
all_data <- all_data |>
|
||||
mutate(resulttype = ifelse(resulttype == "GROUP1_MARKER", "TRAP", resulttype))
|
||||
|
||||
merged_data <- all_data |>
|
||||
group_by(base_name, variant, resulttype) |>
|
||||
summarise(faults = sum(faults), .groups = "drop")
|
||||
@@ -88,15 +90,21 @@ plot <- ggplot(
|
||||
geom_line() +
|
||||
facet_wrap(~base_name) +
|
||||
scale_y_log10(name = "Ratio (to C)") +
|
||||
scale_x_discrete(name = "Marker") +
|
||||
labs(color = "Variant") +
|
||||
scale_x_discrete(name = "Fault Type") +
|
||||
labs(
|
||||
color = "Variant",
|
||||
title = "Fault Count Ratios"
|
||||
) +
|
||||
theme_minimal() +
|
||||
theme(axis.text.x = element_text(angle = 45, hjust = 1))
|
||||
theme(
|
||||
axis.text.x = element_text(angle = 90, hjust = 1),
|
||||
plot.title = element_text(size = 14, face = "bold")
|
||||
)
|
||||
|
||||
ggsave(
|
||||
"injections/ratio_comparison_merged.svg",
|
||||
"injections/ratio_comparison_merged_trap.svg",
|
||||
plot = plot,
|
||||
width = 12,
|
||||
height = 8
|
||||
)
|
||||
print("Saved ratio_comparison_merged.svg")
|
||||
print("Saved ratio_comparison_merged_trap.svg")
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user