Skip to content

Instantly share code, notes, and snippets.

@mmgaggle
Created April 8, 2016 18:38
Show Gist options
  • Save mmgaggle/794def09940710feb4e736165581846e to your computer and use it in GitHub Desktop.
Save mmgaggle/794def09940710feb4e736165581846e to your computer and use it in GitHub Desktop.
#!/usr/local/bin/Rscript
printf <- function(...) invisible(print(sprintf(...)))
filenames <- list.files("./",pattern="output*",full.names=TRUE)
files <- lapply(filenames, function(filename){ read.csv(file=filename,sep=';',stringsAsFactors=FALSE,skip=4) })
post_ramp_subsets <- lapply(files, function(file) { subset(file,file[50]>=60000) })
thread_iops_means <- lapply(post_ramp_subsets, function(thread_subset) {
threads <- unique(thread_subset[,3])
thread_subsets <- lapply(threads, function(thread){ subset(thread_subset,thread_subset[,3]==thread) })
lapply(thread_subsets, function(thread_subset){ mean(thread_subset[,49]) })
})
thread_iops_sum <- Reduce("+",Filter(
Negate(is.null),
lapply(thread_iops_means, function(thread_means){
Reduce("+",thread_means)
})
)
)
printf("sum IOPS, all threads: %s", thread_iops_sum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment