Hello,

I have a loop where I iterate performance data files within a folder, parse and 
plot them in one shot (see below).

However, when executing plot_raw which invokes dev.new(..) all windows come out 
blank whereas if I execute each file outside of a loop then I can see the plots 
properly. What's wrong here?

Thanks in advance,
Best regards,
Giovanni

# given a directory name, it will iterate all files that match the given pattern
#basedir <- "/Users/bravegag/code/asl11/data/2k-r1-test-20111111_data/"
basedir <- "/Users/bravegag/code/asl11/data/nclients_2_128-20111110_data/"
pattern <- paste("logs.*cl\\-.*mw\\-.*db\\-.*\\-client\\.dat",sep="")
all_files <- dir(path=basedir, pattern=pattern)

throughput <- NULL
response <- NULL

#file_name <- all_files[1]

# iterate all files
for (file_name in all_files) {
        print(paste("processing", file_name, "..."))

        df <- read.table(paste(basedir, file_name, sep=""))              # read 
the data as a data frame
        names(df)[names(df)=="V1"] <- "Time"
        names(df)[names(df)=="V2"] <- "Partitioning"
        names(df)[names(df)=="V3"] <- "Workload"
        names(df)[names(df)=="V4"] <- "Runtime"

        # get rid of first and last n minutes 
        df <- subset(df, df$Time > warmup_cooldown_minutes)
        df <- subset(df, df$Time < (max(df$Time) - warmup_cooldown_minutes))
        
        # 
=========================================================================================
        # Throughput
        # 
=========================================================================================
        if (decouple) {
                dft <- aggregate(x=df$Runtime, by=list(df$Time,df$Workload), 
FUN=length)
                names(dft)[names(dft)=="Group.1"] <- "Time"           
                names(dft)[names(dft)=="Group.2"] <- "Workload"
                names(dft)[names(dft)=="x"] <- "Y"
                
        } else {
                dft <- aggregate(x=df$Runtime, by=list(df$Time), FUN=length)
                names(dft)[names(dft)=="Group.1"] <- "Time"           
                names(dft)[names(dft)=="x"] <- "Y"
        }
        dft$se <- 0
        plot_raw(dft,connect=TRUE,label=file_name)
}
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to