Update charts to account for new datafile/charts folders

This commit is contained in:
2026-09-18 19:57:13 +02:00
parent 731701c991
commit a3e341cf27
12 changed files with 200 additions and 83 deletions
+17 -8
View File
@@ -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,