plot stgsize + observe_hitcounts--

This commit is contained in:
Alwin Berger 2024-11-14 13:22:04 +01:00
parent cd3c101e87
commit 0a233aad48
5 changed files with 78 additions and 2 deletions

View File

@ -47,7 +47,7 @@ sched_stg_abbhash = ['sched_stg'] # every path of abbs
sched_stg_aggregatehash = ['sched_stg'] # every aggregated path (order independent)
# overall_configs
config_genetic = ["gensize_100","feed_genetic","sched_genetic","trace_stg"]
config_afl = ["feed_afl","sched_afl","observe_hitcounts","trace_stg"]
config_afl = ["feed_afl","sched_afl","trace_stg"]
config_frafl = ["feed_afl","sched_afl","feed_longest","trace_stg"]
config_stg = ["feed_stg_aggregatehash","sched_stg_aggregatehash","mutate_stg"]
# config_stg_aggregate = ["feed_stg_aggregatehash","sched_stg_aggregatehash","mutate_stg"]

View File

@ -44,7 +44,7 @@ rule build_afl:
output:
directory("bins/target_afl")
shell:
"cp -r -a --reflink=auto {input} {output} && cargo build --target-dir {output} {def_flags},config_afl,observe_hitcounts"
"cp -r -a --reflink=auto {input} {output} && cargo build --target-dir {output} {def_flags},config_afl"
rule build_stg:
input:

View File

@ -0,0 +1,20 @@
get_max_nodecount () {
rm -f sizecomp && for sizefile in remote/timedump/**/$1*.stgsize;do echo "$(tail -n 1 $sizefile),${sizefile}" >> sizecomp; done; sort -n sizecomp | tail -n 1
}
get_largest_files () {
T=$(get_max_nodecount $1)
echo $T | cut -d',' -f6
}
perform () {
T=$(get_max_nodecount $1)
echo $T | cut -d',' -f6
echo $T | cut -d',' -f6 | xargs -I {} ./plot_stgsize.r {}
mv "$(echo $T | cut -d',' -f6 | xargs -I {} basename -s .stgsize {})_nodes.png" $1_nodes.png
}
perform copter
perform release
perform waters
./plot_stgsize_multi.r $(get_largest_files copter) $(get_largest_files release) $(get_largest_files waters)

View File

@ -0,0 +1,23 @@
#!/usr/bin/env Rscript
# Load necessary libraries
library(ggplot2)
# Define the function to load CSV and plot
plot_stgsize <- function(file_path) {
print(file_path)
# Read the CSV file without headers
data <- read.csv(file_path, header = FALSE)
data['V5'] <- data['V5']/(3600*1000)
# Plot the line chart
p <- ggplot(data, aes(x = V5, y = V2)) +
geom_line() +
labs(x = "runtime [h]", y = "# of nodes") + #, title = "Number of nodes over time.") +
theme_minimal()
output_file <- sub("\\.stgsize$", paste0("_nodes.png"), file_path)
ggsave(basename(output_file), plot = p + theme_bw(base_size = 10), width = 3.5, height = 2, dpi = 300, units = "in", device = "png")
}
args <- commandArgs(trailingOnly = TRUE)
plot_stgsize(args[1])

View File

@ -0,0 +1,33 @@
#!/usr/bin/env Rscript
library(ggplot2)
# Function to plot multiple files
plot_multiple_files <- function(file_paths) {
all_data <- data.frame()
for (file_path in file_paths) {
# Read the CSV file without headers
data <- read.csv(file_path, header = FALSE)
data['V5'] <- data['V5']/(3600*1000)
# Extract the name for the line
target <- sub("_.*", "", basename(file_path))
data$target <- target
# Combine data
all_data <- rbind(all_data, data)
}
# Plot the line chart
p <- ggplot(all_data, aes(x = V5, y = V2, color = target)) +
geom_line() +
labs(x = "runtime [h]", y = "# of nodes") +
theme_minimal()
# Save the plot
ggsave("stg_node_sizes.png", plot = p + theme_bw(base_size = 10), width = 4, height = 2.5, dpi = 300, units = "in", device = "png")
}
# Example usage
file_paths <- commandArgs(trailingOnly = TRUE)
plot_multiple_files(file_paths)