hpcs-17-subord

Subordination: Providing Resilience to Simultaneous Failure of Multiple Cluster Nodes
git clone https://git.igankevich.com/hpcs-17-subord.git
Log | Files | Refs

common.R (2135B)


      1 load_log_file_as_data_frame <- function (prefix) {
      2 	runtime <- data.frame()
      3 	dirs <- sort(list.files(prefix))
      4 	for (d in dirs) {
      5 		files <- sort(list.files(file.path(prefix, d), pattern="\\.log$"))
      6 		for (f in files) {
      7 			lines <- readLines(file.path(prefix, d, f))
      8 			lines <- sort(lines[grepl("^\\s*[0-9]{6,}\\s+.*$", lines, perl=TRUE)])
      9 			finish_line <- which(grepl(
     10 				"^.*autoreg:\\s+finished all\\s*$",
     11 				lines,
     12 				perl=TRUE
     13 			) == TRUE)
     14 			if (length(finish_line) == 1) {
     15 				lines <- lines[c(1:finish_line)]
     16 			}
     17 			lines <- gsub("^\\s*([0-9]{6,})\\s+.*$", "\\1", lines, perl=TRUE)
     18 			lines <- as.numeric(lines)
     19 			r <- range(lines)
     20 			ipaddr <- gsub("^.*-([0-9\\.]+)\\.log$", "\\1", f, perl=TRUE)
     21 			t <- r[[2]] - r[[1]]
     22 			# add new column if needed
     23 			if (!(ipaddr %in% colnames(runtime))) {
     24 				runtime[, ipaddr] <- rep(NA, nrow(runtime))
     25 			}
     26 			# add new row if needed
     27 			if (!(d %in% rownames(runtime))) {
     28 				runtime[d, ] <- rep(NA, ncol(runtime))
     29 			}
     30 			runtime[d, ipaddr] <- t
     31 		}
     32 	}
     33 	runtime
     34 }
     35 
     36 load_overhead_from_log_file <- function (prefix) {
     37 	runtime <- data.frame()
     38 	dirs <- sort(list.files(prefix))
     39 	for (d in dirs) {
     40 		files <- sort(list.files(file.path(prefix, d), pattern="\\.log$"))
     41 		for (f in files) {
     42 			lines <- readLines(file.path(prefix, d, f))
     43 			lines <- lines[grepl("^.*multiple node failure handling overhead is ([0-9]+)ns\\s*$", lines, perl=TRUE)]
     44 			lines <- gsub("^.*multiple node failure handling overhead is ([0-9]+)ns\\s*$", "\\1", lines, perl=TRUE)
     45 			lines <- as.numeric(lines)
     46 			ipaddr <- gsub("^.*-([0-9\\.]+)\\.log$", "\\1", f, perl=TRUE)
     47 			if (length(lines) == 0) {
     48 				message(paste("Skipping unparseable file \"", f, "\".", sep=""))
     49 			} else {
     50 				t <- lines[[1]]
     51 				# add new column if needed
     52 				if (!(ipaddr %in% colnames(runtime))) {
     53 					runtime[, ipaddr] <- rep(NA, nrow(runtime))
     54 				}
     55 				# add new row if needed
     56 				if (!(d %in% rownames(runtime))) {
     57 					runtime[d, ] <- rep(NA, ncol(runtime))
     58 				}
     59 				runtime[d, ipaddr] <- t
     60 			}
     61 		}
     62 	}
     63 	runtime
     64 }
     65 
     66 subord.colRange <- function(df) {
     67 	result <- c()
     68 	if (ncol(df) > 0) {
     69 		result <- c(1:ncol(df))
     70 	}
     71 	result
     72 }