4 #system("../nodequery.py --nodelist > ../nodelist.txt")
5 #system("../comonquery.py --cache --nodelist ../nodelist.txt --select 'resptime>0' --fields='name,cpuspeed,numcores,memsize,disksize,bwlimit' | grep -v null | ./hn2lb.py | ./hn2pcustatus.py > ./out_resources.csv ")
7 mdrc <- read.csv("out_resources.csv", TRUE, sep=",")
9 # replace all weird numbers with defaults of 100mbps
10 mdrc$bwlimit <- replace(mdrc$bwlimit, which(mdrc$bwlimit==0 | mdrc$bwlimit==1), 100000)
18 # ----------------------
20 unique_loginbase_length <- length(unique(mdrc$loginbase));
21 unique_lb <- list(loginbase=array(0,c(unique_loginbase_length)),
22 score=array(0,c(unique_loginbase_length)),
23 memsize=array(0,c(unique_loginbase_length)),
24 disksize=array(0,c(unique_loginbase_length)),
25 cpuspeed=array(0,c(unique_loginbase_length))
28 for ( i in 1:length(mdrc$loginbase) )
31 unique_lb$loginbase[r$loginbase] <- r$loginbase;
32 unique_lb$score[r$loginbase] <- unique_lb$score[r$loginbase] + r$score;
35 unique_lb$memsize[r$loginbase] <- unique_lb$memsize[r$loginbase] + v[1];
36 unique_lb$disksize[r$loginbase] <- unique_lb$disksize[r$loginbase] + v[2];
37 unique_lb$cpuspeed[r$loginbase] <- unique_lb$cpuspeed[r$loginbase] + v[3];
40 df<- data.frame(unique_lb)
42 h<- hist(df$score, breaks=b);
43 bins<-length(h$breaks);
48 # foreach score value, find which range it falls into,
49 # then in three columns for cpu, mem, disk, record the fraction of each.
50 # then plot each sequence in a stacked graph, perhaps beside h$counts
51 for ( i in 1:length(df$cpuspeed) )
54 s <- index_of_bin(h, r$score); # find bin position...
55 # take fraction that each component contributes to the total, and add to sum
57 m[s] <- m[s] + unique_lb$memsize[r$loginbase]/r$score;
58 d[s] <- d[s] + unique_lb$disksize[r$loginbase]/r$score;
59 c[s] <- c[s] + unique_lb$cpuspeed[r$loginbase]/r$score;
62 a <- array(c(c,d,m), dim=c(bins, 3));
64 png("/Users/soltesz/Downloads/slice_policy_3.png")
66 par(mai=c(0.5,1,0.5,0.2))
67 barplot(c(0,h$counts),
69 main="Distribution of Site Scores",
70 ylab="Total Frequency",
72 par(mai=c(1.0,1,0,0.2));
74 legend=c("CPUspeed (GHz)", "DISKsize (GB)", "MEMsize (GB)"),
75 col=c("pink", "lightblue", "lightgreen"),
77 ylab="Break-down by Resource",
79 names.arg=c(0,h$breaks[1:length(h$breaks)-1]),