From 2427ae4703698f42040d152513532f701429f6e3 Mon Sep 17 00:00:00 2001 From: Alwin Berger Date: Tue, 3 Dec 2024 09:27:28 +0100 Subject: [PATCH] update helper-scripts --- fuzzers/FRET/benchmark/bench_rename.sh | 5 +++++ fuzzers/FRET/benchmark/plot_all_benchmarks.sh | 19 +++++++++++-------- fuzzers/FRET/benchmark/plot_all_stgsizes.sh | 18 ++++++++++++++---- fuzzers/FRET/benchmark/plot_multi.r | 14 +++++++++----- fuzzers/FRET/benchmark/plot_stgsize_multi.r | 6 +++--- 5 files changed, 42 insertions(+), 20 deletions(-) create mode 100644 fuzzers/FRET/benchmark/bench_rename.sh diff --git a/fuzzers/FRET/benchmark/bench_rename.sh b/fuzzers/FRET/benchmark/bench_rename.sh new file mode 100644 index 0000000000..e9d47cff93 --- /dev/null +++ b/fuzzers/FRET/benchmark/bench_rename.sh @@ -0,0 +1,5 @@ +#!/bin/sh +export TOPLEVEL="remote/timedump" +[ -d "$TOPLEVEL/feedgeneration100" ] && mv $TOPLEVEL/feedgeneration100 $TOPLEVEL/evolutionary +[ -d "$TOPLEVEL/stg" ] && mv $TOPLEVEL/stg $TOPLEVEL/fret +[ -d "$TOPLEVEL/frafl" ] && mv $TOPLEVEL/frafl $TOPLEVEL/coverage diff --git a/fuzzers/FRET/benchmark/plot_all_benchmarks.sh b/fuzzers/FRET/benchmark/plot_all_benchmarks.sh index d607f1e04f..8714b6a29c 100644 --- a/fuzzers/FRET/benchmark/plot_all_benchmarks.sh +++ b/fuzzers/FRET/benchmark/plot_all_benchmarks.sh @@ -1,5 +1,6 @@ +BDIR=remote plot () { - [ ! -f ~/code/FRET/LibAFL/fuzzers/FRET/benchmark/remote/${1}${2}_all.png ] && Rscript plot_multi.r remote ${1}${2} ~/code/FRET/LibAFL/fuzzers/FRET/benchmark/remote + [ ! -f ~/code/FRET/LibAFL/fuzzers/FRET/benchmark/$BDIR/${1}${2}_all.png ] && Rscript plot_multi.r $BDIR/timedump ${1}${2} ~/code/FRET/LibAFL/fuzzers/FRET/benchmark/$BDIR } # Only bytes @@ -7,9 +8,9 @@ plot () { export SUFFIX="_seq_bytes" plot waters $SUFFIX -plot release $SUFFIX -plot copter $SUFFIX -plot interact $SUFFIX +#plot release $SUFFIX +#plot copter $SUFFIX +#plot interact $SUFFIX # Only interrupts @@ -17,14 +18,16 @@ export SUFFIX="_seq_int" plot waters $SUFFIX plot release $SUFFIX -plot copter $SUFFIX -plot interact $SUFFIX +#plot copter $SUFFIX +#plot interact $SUFFIX # Full export SUFFIX="_seq_full" plot waters $SUFFIX -plot release $SUFFIX +#plot release $SUFFIX plot copter $SUFFIX -plot interact $SUFFIX \ No newline at end of file +#plot interact $SUFFIX + +# plot copter "_seq_stateless_full" diff --git a/fuzzers/FRET/benchmark/plot_all_stgsizes.sh b/fuzzers/FRET/benchmark/plot_all_stgsizes.sh index 60706c3884..7a0564d146 100755 --- a/fuzzers/FRET/benchmark/plot_all_stgsizes.sh +++ b/fuzzers/FRET/benchmark/plot_all_stgsizes.sh @@ -14,7 +14,17 @@ perform () { 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) \ No newline at end of file +# perform copter +# perform release +# perform waters +A=$(get_largest_files copter) +B=$(get_largest_files release) +C=$(get_largest_files waters) +A_="$(echo $A | sed 's/copter/UAV w. hid. com./')" +B_="$(echo $B | sed 's/release/Async. rel./')" +C_="$(echo $C | sed 's/waters/Waters ind. ch./')" +echo $A_ $B_ $C_ +cp $A "$A_" +cp $B "$B_" +cp $C "$C_" +./plot_stgsize_multi.r "$A_" "$B_" "$C_" \ No newline at end of file diff --git a/fuzzers/FRET/benchmark/plot_multi.r b/fuzzers/FRET/benchmark/plot_multi.r index 337e9a2ef5..66c424a01c 100644 --- a/fuzzers/FRET/benchmark/plot_multi.r +++ b/fuzzers/FRET/benchmark/plot_multi.r @@ -5,7 +5,7 @@ library("doParallel") #setup parallel backend to use many processors cores=detectCores() -cl <- makeCluster(cores[1]-1) #not to overload your computer +cl <- makeCluster(cores[1]-4) #not to overload your computer registerDoParallel(cl) args = commandArgs(trailingOnly=TRUE) @@ -13,7 +13,7 @@ args = commandArgs(trailingOnly=TRUE) if (length(args)==0) { runtype="remote" #target="waters" - target="watersv2" + target="waters" #target="waters_int" #target="watersv2_int" outputpath="~/code/FRET/LibAFL/fuzzers/FRET/benchmark/" @@ -223,14 +223,14 @@ typenames = typenames[which(!endsWith(typenames, "_max"))] typenames = selection[which(selection %in% typenames)] if (length(typenames) == 0) {return()} -h_ = 500 +h_ = 380 w_ = h_*4/3 if (SAVE_FILE) {png(file=sprintf("%s/%s_%s.png",outputpath,target,filename), width=w_, height=h_)} par(mar=c(4,4,1,1)) par(oma=c(0,0,0,0)) -plot(c(0,max(one_frame['time'])),c(ylow,yhigh), col='white', xlab="Time [h]", ylab="WORT [insn]", pch='.') +plot(c(0,max(one_frame['time'])),c(ylow,yhigh), col='white', xlab="Time [h]", ylab="WCRT estimate [insn]", pch='.') for (t in seq_len(length(typenames))) { #proj = one_frame[seq(1, dim(one_frame)[1], by=max(1, length(one_frame[[1]])/(10*w_))),] @@ -300,7 +300,11 @@ legend(LEGEND_POS, legend=leglines,#"bottomright", col=c(MY_COLORS_[1:length(typenames)],"black"), lty=c(rep("solid",length(typenames)),"dotted")) -if (SAVE_FILE) {dev.off()} +if (SAVE_FILE) { + dev.new() + par(las = 2, mar = c(10, 5, 1, 1)) + dev.off() + } } stopCluster(cl) diff --git a/fuzzers/FRET/benchmark/plot_stgsize_multi.r b/fuzzers/FRET/benchmark/plot_stgsize_multi.r index 5f621d161e..85c59aec42 100755 --- a/fuzzers/FRET/benchmark/plot_stgsize_multi.r +++ b/fuzzers/FRET/benchmark/plot_stgsize_multi.r @@ -11,15 +11,15 @@ plot_multiple_files <- function(file_paths) { data['V5'] <- data['V5']/(3600*1000) # Extract the name for the line - target <- sub("_.*", "", basename(file_path)) - data$target <- target + application <- sub("_.*", "", basename(file_path)) + data$application <- application # Combine data all_data <- rbind(all_data, data) } # Plot the line chart - p <- ggplot(all_data, aes(x = V5, y = V2, color = target)) + + p <- ggplot(all_data, aes(x = V5, y = V2, color = application)) + geom_line() + labs(x = "runtime [h]", y = "# of nodes") + theme_minimal()