diff --git a/scripts/create_gantt.R b/scripts/create_gantt.R new file mode 100644 index 0000000000000000000000000000000000000000..4ffa9f010673cbb646c4a52afb7e95d0fb0f52b4 --- /dev/null +++ b/scripts/create_gantt.R @@ -0,0 +1,47 @@ +library(dplyr); +library(ggplot2); + +readtrace <- function (filename) +{ + df <- read.csv(filename, header=TRUE, sep=",", strip.white=TRUE); + df <- df %>% filter((Explicit==1)) %>% as.data.frame(); + df$Start <- df$Start*1e-9; # Convert ns to second + df$End <- df$End*1e-9; + df$Duration <- df$Duration*1e-9; + df; +} + +args <- commandArgs(trailingOnly=TRUE) + + +df <- readtrace(args[1]); + + +# helper: convert s to the date +date<-function(d) { as.POSIXct(d, origin="1970-01-01"); } + +# theplot +theplot = ggplot() + + theme_bw(base_size=16) + + xlab("Time [s]") + + ylab("Thread Identification") + + scale_fill_brewer(palette = "Set1") + + theme ( + legend.spacing = unit(.1, "line"), + panel.grid.major = element_blank(), + panel.spacing=unit(0, "cm"), + panel.grid=element_line(size=0), + legend.position = "bottom", + legend.title = element_text("Helvetica") + ) + + guides(fill = guide_legend(nrow = 1)) + + geom_rect(data=df, alpha=1, aes(fill=Name, + xmin=date(Start), + xmax=date(End), + ymin=Resource, + ymax=Resource+0.9)) + + scale_y_reverse(); + pdf("gantt.pdf", width=10, height=6) + print(theplot) + dev.off() +