plot lines instead of points
This commit is contained in:
parent
6d920fd962
commit
54312b2577
@ -4,7 +4,7 @@ args = commandArgs(trailingOnly=TRUE)
|
|||||||
|
|
||||||
if (length(args)==0) {
|
if (length(args)==0) {
|
||||||
runtype="mnt/timedump"
|
runtype="mnt/timedump"
|
||||||
target="waters"
|
target="micro_longint"
|
||||||
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,6 +15,8 @@ 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_case <- worst_cases[[target]]
|
||||||
|
|
||||||
#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", "black", "orange", "black")
|
||||||
@ -24,6 +26,9 @@ PATTERNS="%s.[0-9]*$"
|
|||||||
#RIBBON='sd'
|
#RIBBON='sd'
|
||||||
#RIBBON='span'
|
#RIBBON='span'
|
||||||
RIBBON='both'
|
RIBBON='both'
|
||||||
|
DRAW_WC = worst_case > 0
|
||||||
|
LEGEND_POS="topleft"
|
||||||
|
#LEGEND_POS="bottomright"
|
||||||
|
|
||||||
# Trimm a list of data frames to common length
|
# Trimm a list of data frames to common length
|
||||||
trim_data <- function(input,len=NULL) {
|
trim_data <- function(input,len=NULL) {
|
||||||
@ -41,7 +46,11 @@ length_of_data <- function(input) {
|
|||||||
trace2maxline <- function(tr) {
|
trace2maxline <- function(tr) {
|
||||||
maxline = tr
|
maxline = tr
|
||||||
for (var in seq_len(length(maxline))[2:length(maxline)]) {
|
for (var in seq_len(length(maxline))[2:length(maxline)]) {
|
||||||
maxline[var] = max(maxline[var],maxline[var-1])
|
#if (maxline[var]>1000000000) {
|
||||||
|
# maxline[var]=maxline[var-1]
|
||||||
|
#} else {
|
||||||
|
maxline[var] = max(maxline[var],maxline[var-1])
|
||||||
|
#}
|
||||||
}
|
}
|
||||||
#plot(seq_len(length(maxline)),maxline,"l",xlab="Index",ylab="WOET")
|
#plot(seq_len(length(maxline)),maxline,"l",xlab="Index",ylab="WOET")
|
||||||
return(maxline)
|
return(maxline)
|
||||||
@ -90,7 +99,24 @@ 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"))]
|
typenames = typenames[which(!endsWith(typenames, "_sd"))]
|
||||||
ylow=min(one_frame[typenames])
|
ylow=min(one_frame[typenames])
|
||||||
yhigh=max(one_frame[typenames])
|
yhigh=max(one_frame[typenames],worst_case)
|
||||||
|
#yhigh=3400000
|
||||||
|
#yhigh=max(one_frame[typenames],405669)
|
||||||
|
|
||||||
|
ml2lines <- function(ml) {
|
||||||
|
lines = NULL
|
||||||
|
last = -1
|
||||||
|
for (i in seq_len(length(ml))) {
|
||||||
|
if (ml[[i]] != last || (i >= length(ml))) {
|
||||||
|
if (i != 1) {
|
||||||
|
lines = rbind(lines, cbind(X=i, Y=last))
|
||||||
|
}
|
||||||
|
lines = rbind(lines, cbind(X=i, Y=ml[[i]]))
|
||||||
|
last=ml[[i]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(lines)
|
||||||
|
}
|
||||||
|
|
||||||
plotting <- function(selection, filename, MY_COLORS_) {
|
plotting <- function(selection, filename, MY_COLORS_) {
|
||||||
# filter out names of iters and sd cols
|
# filter out names of iters and sd cols
|
||||||
@ -111,12 +137,15 @@ par(oma=c(0,0,0,0))
|
|||||||
plot(c(1,length(one_frame[[1]])),c(ylow,yhigh), col='white', xlab="Iters", ylab="WORT", pch='.')
|
plot(c(1,length(one_frame[[1]])),c(ylow,yhigh), col='white', xlab="Iters", ylab="WORT", pch='.')
|
||||||
|
|
||||||
for (t in seq_len(length(typenames))) {
|
for (t in seq_len(length(typenames))) {
|
||||||
proj = one_frame[seq(1, dim(one_frame)[1], by=200),]
|
proj = one_frame[seq(1, dim(one_frame)[1], by=max(1, length(one_frame[[1]])/(10*w_))),]
|
||||||
points(proj[c('iters',typenames[t])], col=MY_COLORS_[t], pch='.')
|
#points(proj[c('iters',typenames[t])], col=MY_COLORS_[t], pch='.')
|
||||||
|
drawlines = ml2lines(one_frame[[typenames[t]]])
|
||||||
|
lines(drawlines, col=MY_COLORS_[t])
|
||||||
if (exists("RIBBON") && RIBBON=='both') {
|
if (exists("RIBBON") && RIBBON=='both') {
|
||||||
points(proj[c('iters',sprintf("%s_min",typenames[t]))], col=MY_COLORS_[t], pch='.')
|
points(proj[c('iters',sprintf("%s_min",typenames[t]))], col=MY_COLORS_[t], pch='.')
|
||||||
points(proj[c('iters',sprintf("%s_max",typenames[t]))], col=MY_COLORS_[t], pch='.')
|
points(proj[c('iters',sprintf("%s_max",typenames[t]))], col=MY_COLORS_[t], pch='.')
|
||||||
}
|
}
|
||||||
|
if (RIBBON != '') {
|
||||||
for (i in seq_len(dim(proj)[1])) {
|
for (i in seq_len(dim(proj)[1])) {
|
||||||
row = proj[i,]
|
row = proj[i,]
|
||||||
x_ <- row['iters'][[1]]
|
x_ <- row['iters'][[1]]
|
||||||
@ -126,15 +155,23 @@ for (t in seq_len(length(typenames))) {
|
|||||||
max_ <- row[sprintf("%s_max",typenames[t])][[1]]
|
max_ <- row[sprintf("%s_max",typenames[t])][[1]]
|
||||||
if (exists("RIBBON")) {
|
if (exists("RIBBON")) {
|
||||||
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.05)),
|
'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.1)),
|
'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.05))
|
'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))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
legend("bottomright", legend=typenames, col=MY_COLORS_, lty="solid")
|
leglines=typenames
|
||||||
|
if (DRAW_WC) {
|
||||||
|
lines(c(0,length(one_frame[[1]])),y=c(worst_case,worst_case), lty='dotted')
|
||||||
|
leglines=c(typenames, 'worst observed')
|
||||||
|
}
|
||||||
|
legend(LEGEND_POS, legend=leglines,#"topleft"
|
||||||
|
col=c(MY_COLORS_[1:length(typenames)],"black"),
|
||||||
|
lty=c(rep("solid",length(typenames)),"dotted"))
|
||||||
|
|
||||||
if (SAVE_FILE) {dev.off()}
|
if (SAVE_FILE) {dev.off()}
|
||||||
}
|
}
|
||||||
@ -144,7 +181,8 @@ 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', 'graph', 'random', 'feedlongest')
|
#MY_SELECTION=c('state', 'afl', 'random', 'feedlongest', 'graph', 'feedgeneration')
|
||||||
|
MY_SELECTION=c('state_int', 'afl_int', 'random_int', 'feedlongest_int', 'feedgeneration_int')
|
||||||
RIBBON=''
|
RIBBON=''
|
||||||
plotting(MY_SELECTION,'all', MY_COLORS)
|
plotting(MY_SELECTION,'all', MY_COLORS)
|
||||||
RIBBON='both'
|
RIBBON='both'
|
||||||
@ -153,3 +191,4 @@ if (exists("MY_SELECTION")) {
|
|||||||
plotting(c(n), n, c(MY_COLORS[i]))
|
plotting(c(n), n, c(MY_COLORS[i]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user