update plot script
This commit is contained in:
parent
253048e534
commit
1bd7d853ac
@ -3,8 +3,8 @@ library("dplyr")
|
|||||||
args = commandArgs(trailingOnly=TRUE)
|
args = commandArgs(trailingOnly=TRUE)
|
||||||
|
|
||||||
if (length(args)==0) {
|
if (length(args)==0) {
|
||||||
runtype="mnt/timedump"
|
runtype="timedump_253048_1873f6/timedump"
|
||||||
target="micro_longint"
|
target="waters"
|
||||||
outputpath="~/code/FRET/LibAFL/fuzzers/FRET/benchmark/"
|
outputpath="~/code/FRET/LibAFL/fuzzers/FRET/benchmark/"
|
||||||
#MY_SELECTION <- c('state', 'afl', 'graph', 'random')
|
#MY_SELECTION <- c('state', 'afl', 'graph', 'random')
|
||||||
SAVE_FILE=TRUE
|
SAVE_FILE=TRUE
|
||||||
@ -15,13 +15,16 @@ if (length(args)==0) {
|
|||||||
MY_SELECTION <- args[4:length(args)]
|
MY_SELECTION <- args[4:length(args)]
|
||||||
SAVE_FILE=TRUE
|
SAVE_FILE=TRUE
|
||||||
}
|
}
|
||||||
worst_cases <- list(waters=14469618, waters_int=6599821, tmr=405669, micro_longint=0)
|
worst_cases <- list(waters=0, waters_int=0, tmr=405669, micro_longint=0)
|
||||||
worst_case <- worst_cases[[target]]
|
worst_case <- worst_cases[[target]]
|
||||||
|
if (is.null(worst_case)) {
|
||||||
|
worst_case = 0
|
||||||
|
}
|
||||||
|
|
||||||
#MY_COLORS=c("green","blue","red", "orange", "pink", "black")
|
#MY_COLORS=c("green","blue","red", "orange", "pink", "black")
|
||||||
MY_COLORS <- c("green", "blue", "red", "magenta", "orange", "cyan", "pink", "black", "orange", "black")
|
MY_COLORS <- c("green", "blue", "red", "magenta", "orange", "cyan", "pink", "gray", "orange", "black", "yellow","brown")
|
||||||
BENCHDIR=sprintf("~/code/FRET/LibAFL/fuzzers/FRET/benchmark/%s",runtype)
|
BENCHDIR=sprintf("~/code/FRET/LibAFL/fuzzers/FRET/benchmark/%s",runtype)
|
||||||
BASENAMES=Filter(function(x) x!="",list.dirs(BENCHDIR,full.names=FALSE))
|
BASENAMES=Filter(function(x) x!="" && substr(x,1,1)!='.',list.dirs(BENCHDIR,full.names=FALSE))
|
||||||
PATTERNS="%s.[0-9]*$"
|
PATTERNS="%s.[0-9]*$"
|
||||||
#RIBBON='sd'
|
#RIBBON='sd'
|
||||||
#RIBBON='span'
|
#RIBBON='span'
|
||||||
@ -30,6 +33,7 @@ DRAW_WC = worst_case > 0
|
|||||||
LEGEND_POS="topleft"
|
LEGEND_POS="topleft"
|
||||||
#LEGEND_POS="bottomright"
|
#LEGEND_POS="bottomright"
|
||||||
|
|
||||||
|
# https://www.r-bloggers.com/2013/04/how-to-change-the-alpha-value-of-colours-in-r/
|
||||||
alpha <- function(col, alpha=1){
|
alpha <- function(col, alpha=1){
|
||||||
if(missing(col))
|
if(missing(col))
|
||||||
stop("Please provide a vector of colours.")
|
stop("Please provide a vector of colours.")
|
||||||
@ -86,8 +90,9 @@ for (bn in BASENAMES) {
|
|||||||
runtypefiles <- list.files(file.path(BENCHDIR,bn),pattern=sprintf(PATTERNS,target),full.names = TRUE)
|
runtypefiles <- list.files(file.path(BENCHDIR,bn),pattern=sprintf(PATTERNS,target),full.names = TRUE)
|
||||||
if (length(runtypefiles) > 0) {
|
if (length(runtypefiles) > 0) {
|
||||||
runtypetables <- lapply(seq_len(length(runtypefiles)),
|
runtypetables <- lapply(seq_len(length(runtypefiles)),
|
||||||
function(i)read.table(runtypefiles[[i]], quote="\"", comment.char="", col.names=c(sprintf("%s%d",bn,i))))
|
function(i)read.csv(runtypefiles[[i]], col.names=c(sprintf("%s%d",bn,i),"times")))
|
||||||
runtypetables = trim_data(runtypetables)
|
runtypetables = trim_data(runtypetables)
|
||||||
|
runtypetables = lapply(runtypetables, function(i) i[1])
|
||||||
list_of_maxlines = data2maxlines(runtypetables)
|
list_of_maxlines = data2maxlines(runtypetables)
|
||||||
tmp_frame <- Reduce(bind_cols, list_of_maxlines)
|
tmp_frame <- Reduce(bind_cols, list_of_maxlines)
|
||||||
statframe <- bind_cols(rowMeans(tmp_frame),apply(tmp_frame, 1, sd),apply(tmp_frame, 1, min),apply(tmp_frame, 1, max))
|
statframe <- bind_cols(rowMeans(tmp_frame),apply(tmp_frame, 1, sd),apply(tmp_frame, 1, min),apply(tmp_frame, 1, max))
|
||||||
@ -105,9 +110,11 @@ one_frame[length(one_frame)+1] <- seq_len(length(one_frame[[1]]))
|
|||||||
names(one_frame)[length(one_frame)] <- 'iters'
|
names(one_frame)[length(one_frame)] <- 'iters'
|
||||||
|
|
||||||
typenames = names(one_frame)[which(names(one_frame) != 'iters')]
|
typenames = names(one_frame)[which(names(one_frame) != 'iters')]
|
||||||
typenames = typenames[which(!endsWith(typenames, "_sd"))]
|
|
||||||
ylow=min(one_frame[typenames])
|
ylow=min(one_frame[typenames])
|
||||||
yhigh=max(one_frame[typenames],worst_case)
|
yhigh=max(one_frame[typenames],worst_case)
|
||||||
|
typenames = typenames[which(!endsWith(typenames, "_sd"))]
|
||||||
|
typenames = typenames[which(!endsWith(typenames, "_min"))]
|
||||||
|
typenames = typenames[which(!endsWith(typenames, "_max"))]
|
||||||
#yhigh=3400000
|
#yhigh=3400000
|
||||||
#yhigh=max(one_frame[typenames],405669)
|
#yhigh=max(one_frame[typenames],405669)
|
||||||
|
|
||||||
@ -135,7 +142,7 @@ typenames = typenames[which(!endsWith(typenames, "_max"))]
|
|||||||
typenames = selection[which(selection %in% typenames)]
|
typenames = selection[which(selection %in% typenames)]
|
||||||
if (length(typenames) == 0) {return()}
|
if (length(typenames) == 0) {return()}
|
||||||
|
|
||||||
h_ = 300
|
h_ = 500
|
||||||
w_ = h_*4/3
|
w_ = h_*4/3
|
||||||
|
|
||||||
if (SAVE_FILE) {png(file=sprintf("%s%s_%s.png",outputpath,target,filename), width=w_, height=h_)}
|
if (SAVE_FILE) {png(file=sprintf("%s%s_%s.png",outputpath,target,filename), width=w_, height=h_)}
|
||||||
@ -149,7 +156,7 @@ for (t in seq_len(length(typenames))) {
|
|||||||
#points(proj[c('iters',typenames[t])], col=MY_COLORS_[t], pch='.')
|
#points(proj[c('iters',typenames[t])], col=MY_COLORS_[t], pch='.')
|
||||||
avglines = ml2lines(one_frame[[typenames[t]]])
|
avglines = ml2lines(one_frame[[typenames[t]]])
|
||||||
lines(avglines, col=MY_COLORS_[t])
|
lines(avglines, col=MY_COLORS_[t])
|
||||||
if (exists("RIBBON") && RIBBON=='both') {
|
if (exists("RIBBON") && ( RIBBON=='both' || RIBBON=='span')) {
|
||||||
milines = ml2lines(one_frame[[sprintf("%s_min",typenames[t])]])
|
milines = ml2lines(one_frame[[sprintf("%s_min",typenames[t])]])
|
||||||
malines = ml2lines(one_frame[[sprintf("%s_max",typenames[t])]])
|
malines = ml2lines(one_frame[[sprintf("%s_max",typenames[t])]])
|
||||||
lines(milines, col=MY_COLORS_[t], lty='dashed')
|
lines(milines, col=MY_COLORS_[t], lty='dashed')
|
||||||
@ -169,7 +176,7 @@ for (t in seq_len(length(typenames))) {
|
|||||||
switch (RIBBON,
|
switch (RIBBON,
|
||||||
'sd' = arrows(x_, y_-sd_, x_, y_+sd_, length=0, angle=90, code=3, col=alpha(MY_COLORS_[t], alpha=0.03)),
|
'sd' = arrows(x_, y_-sd_, x_, y_+sd_, length=0, angle=90, code=3, col=alpha(MY_COLORS_[t], alpha=0.03)),
|
||||||
'both' = arrows(x_, y_-sd_, x_, y_+sd_, length=0, angle=90, code=3, col=alpha(MY_COLORS_[t], alpha=0.05)),
|
'both' = arrows(x_, y_-sd_, x_, y_+sd_, length=0, angle=90, code=3, col=alpha(MY_COLORS_[t], alpha=0.05)),
|
||||||
'span' = arrows(x_, min_, x_, max_, length=0, angle=90, code=3, col=alpha(MY_COLORS_[t], alpha=0.03))
|
'span' = #arrows(x_, min_, x_, max_, length=0, angle=90, code=3, col=alpha(MY_COLORS_[t], alpha=0.03))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
#arrows(x_, y_-sd_, x_, y_+sd_, length=0.05, angle=90, code=3, col=alpha(MY_COLORS[t], alpha=0.1))
|
#arrows(x_, y_-sd_, x_, y_+sd_, length=0.05, angle=90, code=3, col=alpha(MY_COLORS[t], alpha=0.1))
|
||||||
@ -193,14 +200,17 @@ par(oma=c(0,0,0,0))
|
|||||||
if (exists("MY_SELECTION")) {
|
if (exists("MY_SELECTION")) {
|
||||||
plotting(MY_SELECTION, 'custom', MY_COLORS)
|
plotting(MY_SELECTION, 'custom', MY_COLORS)
|
||||||
} else {
|
} else {
|
||||||
#MY_SELECTION=c('state', 'afl', 'random', 'feedlongest', 'graph', 'feedgeneration')
|
#MY_SELECTION=c('state', 'afl', 'random', 'feedlongest', 'feedgeneration', 'feedgeneration10')
|
||||||
MY_SELECTION=c('state_int', 'afl_int', 'random_int', 'feedlongest_int', 'feedgeneration_int')
|
#MY_SELECTION=c('state_int', 'afl_int', 'random_int', 'feedlongest_int', 'feedgeneration_int', 'feedgeneration10_int')
|
||||||
RIBBON=''
|
#MY_SELECTION=c('state', 'frAFL', 'statenohash', 'feedgeneration10')
|
||||||
plotting(MY_SELECTION,'all', MY_COLORS)
|
#MY_SELECTION=c('state_int', 'frAFL_int', 'statenohash_int', 'feedgeneration10_int')
|
||||||
|
MY_SELECTION=typenames
|
||||||
RIBBON='both'
|
RIBBON='both'
|
||||||
for (i in seq_len(length(MY_SELECTION))) {
|
for (i in seq_len(length(MY_SELECTION))) {
|
||||||
n <- MY_SELECTION[i]
|
n <- MY_SELECTION[i]
|
||||||
plotting(c(n), n, c(MY_COLORS[i]))
|
plotting(c(n), n, c(MY_COLORS[i]))
|
||||||
}
|
}
|
||||||
|
RIBBON='span'
|
||||||
|
plotting(MY_SELECTION,'all', MY_COLORS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user