In my case, I'm using the basic performance information from "Guerrilla Capacity Planning." I've created a CSV file with the number of procs and the resultant ray trace benchmark from Table 5.1:
1: C:\Users\auswipe\Desktop>cat raw_throughput.csv
2: p,x
3: 1,20
4: 4,78
5: 8,130
6: 12,170
7: 16,190
8: 20,200
9: 24,210
10: 28,230
11: 32,260
12: 48,280
13: 64,310
Then I wrote an R function to crunch the numbers:
1: uslCoefficients <- function(dataFile) {
2: uslData <- read.csv(dataFile, header=TRUE);
3: uslData$c <- uslData$x / uslData$x[1];
4: usl <- nls(c ~ p/(1+sigma*(p-1)+kappa*p*(p-1)),
5: uslData,
6: algorithm="port",
7: start=c(sigma=0.0, kappa=0.0),
8: lower=c(0,0));
9: sigma <- coef(usl)["sigma"];
10: kappa <- coef(usl)["kappa"];
11: return(list(sigma=sigma, kappa=kappa));
12: };
The function uslCoefficient returns a list where I can reference the "sigma" and "kappa" by named index:
1: > uslCoef <- uslCoefficients("c:\\Users\\auswipe\\Desktop\\raw_throughput.csv")
2: > uslCoef["sigma"]
3: $sigma
4: sigma
5: 0.0497973
6:
7: > uslCoef["kappa"]
8: $kappa
9: kappa
10: 1.143404e-05
11:
12: > uslCoef
13: $sigma
14: sigma
15: 0.0497973
16:
17: $kappa
18: kappa
19: 1.143404e-05
R is pretty nifty. I doubt I'll ever make use of all the power that is available but it'll be better than writing my own stat routines.
No comments:
Post a Comment