public Void call() throws Exception { List<String> urls = Lists.newArrayList(); final BufferedReader in; if (urlFile != null) { in = new BufferedReader(new InputStreamReader(new FileInputStream(urlFile))); } else { in = new BufferedReader(new InputStreamReader(System.in)); } for (String line = in.readLine(); line != null; line = in.readLine()) { if (maxRequests >= 0) { if (maxRequests == 0) { break; } else if (maxRequests > 0) { maxRequests--; } } urls.add(line); } Optional<StepFunction> of = mvel(stepFunction); if (!of.isPresent()) { of = clojure(stepFunction); } if (!of.isPresent()) { System.err.printf("'%s' is an invalid step function\n", stepFunction); return null; } StepFunction step = of.get(); if (labels) { System.out.printf("clients\ttp%.1f\tmean\treqs/sec\n", percentile); } int concurrency = start; do { DescriptiveStatistics stats = new Fight(concurrency, urls).call(); System.out.printf( "%d\t%.2f\t%.2f\t%.2f\n", concurrency, stats.getPercentile(percentile), stats.getMean(), (1000 / stats.getMean()) * concurrency); concurrency = step.step(concurrency); } while (concurrency < limit); return null; }
public static void main(String[] argv) throws Exception { RSmo rsmo; Data data = null; double C = 100.0; double tau = 1E-8; double eps = 0.001; int type = Kernel.POL; int degree = 3; double factor = 0.01; double bias = 0.0; int size = 40; String filename = null; int i; try { for (i = 0; i < argv.length; i++) { if (argv[i].charAt(0) != '-') { break; } ++i; switch (argv[i - 1].charAt(1)) { case 'k': type = atoi(argv[i]); break; case 'd': degree = atoi(argv[i]); break; case 'f': factor = atof(argv[i]); break; case 'g': factor = atof(argv[i]); break; case 'b': bias = atof(argv[i]); break; case 'c': C = atof(argv[i]); break; case 't': tau = atof(argv[i]); break; case 'e': eps = atof(argv[i]); break; case 'i': filename = argv[i]; break; case 'o': break; case 'O': break; case 's': size = atoi(argv[i]); break; case 'v': IO.setVerbosity(atoi(argv[i])); break; default: System.err.print("unknown option: " + argv[i - 1].charAt(1) + ""); System.exit(1); } } } catch (Exception e) { // System.err.print(e.toString()); // System.exit(1); } try { data = SparseVector.readData(filename); } catch (RuntimeException e) { data = StepFunction.readData(filename); } Kernel kernel = new Kernel(data.point, type, degree, factor, bias, size); double t[]; t = new double[data.l]; for (i = 0; i < data.l; i++) { t[i] = Double.parseDouble(data.label[i]); } rsmo = new RSmo(kernel, t, C, tau, eps); rsmo.train(); }