List of usage examples for org.apache.commons.cli HelpFormatter printHelp
public void printHelp(String cmdLineSyntax, Options options)
options
with the specified command line syntax. From source file:com.couchbase.roadrunner.RoadRunner.java
/** * Initialize the RoadRunner./*from www . j a va 2 s . c om*/ * * This method is responsible for parsing the passed in command line arguments * and also dispatch the bootstrapping of the actual workload runner. * * @param args Command line arguments to be passed in. */ public static void main(final String[] args) { CommandLine params = null; try { params = parseCommandLine(args); } catch (ParseException ex) { LOGGER.error("Exception while parsing command line!", ex); System.exit(-1); } if (params.hasOption(OPT_HELP)) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("roadrunner", getCommandLineOptions()); System.exit(0); } GlobalConfig config = GlobalConfig.fromCommandLine(params); WorkloadDispatcher dispatcher = new WorkloadDispatcher(config); LOGGER.info("Running with Config: " + config.toString()); try { LOGGER.debug("Initializing ClientHandlers."); dispatcher.init(); } catch (Exception ex) { LOGGER.error("Error while initializing the ClientHandlers: ", ex); System.exit(-1); } Stopwatch workloadStopwatch = new Stopwatch().start(); try { LOGGER.info("Running Workload."); dispatcher.dispatchWorkload(); } catch (Exception ex) { LOGGER.error("Error while running the Workload: ", ex); System.exit(-1); } workloadStopwatch.stop(); LOGGER.debug("Finished Workload."); LOGGER.info("==== RESULTS ===="); dispatcher.prepareMeasures(); long totalOps = dispatcher.getTotalOps(); long measuredOps = dispatcher.getMeasuredOps(); LOGGER.info("Operations: measured " + measuredOps + "ops out of total " + totalOps + "ops."); Map<String, List<Stopwatch>> measures = dispatcher.getMeasures(); for (Map.Entry<String, List<Stopwatch>> entry : measures.entrySet()) { Histogram h = new Histogram(60 * 60 * 1000, 5); for (Stopwatch watch : entry.getValue()) { h.recordValue(watch.elapsed(TimeUnit.MICROSECONDS)); } LOGGER.info("Percentile (microseconds) for \"" + entry.getKey() + "\" Workload:"); LOGGER.info(" 50%:" + (Math.round(h.getValueAtPercentile(0.5) * 100) / 100) + " 75%:" + (Math.round(h.getValueAtPercentile(0.75) * 100) / 100) + " 95%:" + (Math.round(h.getValueAtPercentile(0.95) * 100) / 100) + " 99%:" + (Math.round(h.getValueAtPercentile(0.99) * 100) / 100)); } LOGGER.info("Elapsed: " + workloadStopwatch.elapsed(TimeUnit.MILLISECONDS) + "ms"); List<Stopwatch> elapsedThreads = dispatcher.getThreadElapsed(); long shortestThread = 0; long longestThread = 0; for (Stopwatch threadWatch : elapsedThreads) { long threadMs = threadWatch.elapsed(TimeUnit.MILLISECONDS); if (longestThread == 0 || threadMs > longestThread) { longestThread = threadMs; } if (shortestThread == 0 || threadMs < shortestThread) { shortestThread = threadMs; } } LOGGER.info("Shortest Thread: " + shortestThread + "ms"); LOGGER.info("Longest Thread: " + longestThread + "ms"); }
From source file:com.jolbox.benchmark.BenchmarkMain.java
/** * @param args//w w w.j av a 2 s.co m * @throws ClassNotFoundException * @throws PropertyVetoException * @throws SQLException * @throws NoSuchMethodException * @throws InvocationTargetException * @throws IllegalAccessException * @throws InterruptedException * @throws SecurityException * @throws IllegalArgumentException * @throws NamingException * @throws ParseException */ public static void main(String[] args) throws ClassNotFoundException, SQLException, PropertyVetoException, IllegalArgumentException, SecurityException, InterruptedException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, NamingException, ParseException { Options options = new Options(); options.addOption("t", "threads", true, "Max number of threads"); options.addOption("s", "stepping", true, "Stepping of threads"); options.addOption("p", "poolsize", true, "Pool size"); options.addOption("h", "help", false, "Help"); CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("h")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("benchmark.jar", options); System.exit(1); } Class.forName("com.jolbox.bonecp.MockJDBCDriver"); new MockJDBCDriver(); BenchmarkTests tests = new BenchmarkTests(); BenchmarkTests.threads = 200; BenchmarkTests.stepping = 20; BenchmarkTests.pool_size = 200; // warm up System.out.println("JIT warm up"); tests.testMultiThreadedConstantDelay(0); BenchmarkTests.threads = 200; BenchmarkTests.stepping = 5; BenchmarkTests.pool_size = 100; if (cmd.hasOption("t")) { BenchmarkTests.threads = Integer.parseInt(cmd.getOptionValue("t", "400")); } if (cmd.hasOption("s")) { BenchmarkTests.stepping = Integer.parseInt(cmd.getOptionValue("s", "20")); } if (cmd.hasOption("p")) { BenchmarkTests.pool_size = Integer.parseInt(cmd.getOptionValue("p", "200")); } System.out.println("Starting benchmark tests with " + BenchmarkTests.threads + " threads (stepping " + BenchmarkTests.stepping + ") using pool size of " + BenchmarkTests.pool_size + " connections"); System.out.println("Starting tests"); plotLineGraph(tests.testMultiThreadedConstantDelay(0), 0, false); // plotLineGraph(tests.testMultiThreadedConstantDelay(10), 10, false); // plotLineGraph(tests.testMultiThreadedConstantDelay(25), 25, false); // plotLineGraph(tests.testMultiThreadedConstantDelay(50), 50, false); // plotLineGraph(tests.testMultiThreadedConstantDelay(75), 75, false); // plotBarGraph("Single Thread", "bonecp-singlethread-poolsize-" + BenchmarkTests.pool_size + "-threads-" + BenchmarkTests.threads + ".png", tests.testSingleThread()); plotBarGraph( "Prepared Statement\nSingle Threaded", "bonecp-preparedstatement-single-poolsize-" + BenchmarkTests.pool_size + "-threads-" + BenchmarkTests.threads + ".png", tests.testPreparedStatementSingleThread()); // plotLineGraph(tests.testMultiThreadedConstantDelayWithPreparedStatements(0), 0, true); // plotLineGraph(tests.testMultiThreadedConstantDelayWithPreparedStatements(10), 10, true); // plotLineGraph(tests.testMultiThreadedConstantDelayWithPreparedStatements(25), 25, true); // plotLineGraph(tests.testMultiThreadedConstantDelayWithPreparedStatements(50), 50, true); // plotLineGraph(tests.testMultiThreadedConstantDelayWithPreparedStatements(75), 75, true); }
From source file:isi.pasco2.Main.java
public static void main(String[] args) { CommandLineParser parser = new PosixParser(); Options options = new Options(); Option undelete = new Option("d", "Undelete activity records"); options.addOption(undelete);//from w ww . ja v a2 s. c o m Option disableAllocation = new Option("M", "Disable allocation detection"); options.addOption(disableAllocation); Option fieldDelimeter = OptionBuilder.withArgName("field-delimeter").hasArg() .withDescription("Field Delimeter (TAB by default)").create("t"); options.addOption(fieldDelimeter); Option timeFormat = OptionBuilder.withArgName("time-format").hasArg() .withDescription("xsd or standard (pasco1 compatible)").create("f"); options.addOption(timeFormat); Option fileTypeOption = OptionBuilder.withArgName("file-type").hasArg() .withDescription("The type of file: cache or history").create("T"); options.addOption(fileTypeOption); try { CommandLine line = parser.parse(options, args); boolean undeleteMethod = false; String delimeter = null; String format = null; String fileType = null; boolean disableAllocationTest = false; if (line.hasOption("d")) { undeleteMethod = true; } if (line.hasOption('t')) { delimeter = line.getOptionValue('t'); } if (line.hasOption('M')) { disableAllocationTest = true; } if (line.hasOption('T')) { fileType = line.getOptionValue('T'); } if (line.hasOption('f')) { format = line.getOptionValue('f'); } if (line.getArgs().length != 1) { System.err.println("No file specified."); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("pasco2", options); System.exit(1); } String fileName = line.getArgs()[0]; try { IndexFile fr = new FastReadIndexFile(fileName, "r"); CountingCacheHandler handler = null; if (fileType == null) { handler = new CountingCacheHandler(); } if (fileType == null) { handler = new CountingCacheHandler(); } else if (fileType.equals("cache")) { handler = new CountingCacheHandler(); } else if (fileType.equals("history")) { handler = new Pasco2HistoryHandler(); } if (format != null) { if (format.equals("pasco")) { DateFormat regularDateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss.SSS"); handler.setDateFormat(regularDateFormat); TimeZone tz = TimeZone.getTimeZone("Australia/Brisbane"); regularDateFormat.setTimeZone(tz); } else if (format.equals("standard")) { DateFormat xsdDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); handler.setDateFormat(xsdDateFormat); xsdDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); } else { System.err.println("Format not supported."); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("pasco2", options); System.exit(1); } } if (delimeter != null) { handler.setDelimeter(delimeter); } IEIndexFileParser logparser = null; if (fileType == null) { System.err.println("Using cache file parser."); logparser = new IECacheFileParser(fileName, fr, handler); } else if (fileType.equals("cache")) { logparser = new IECacheFileParser(fileName, fr, handler); } else if (fileType.equals("history")) { logparser = new IEHistoryFileParser(fileName, fr, handler); } else { System.err.println("Unsupported file type."); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("pasco2", options); System.exit(1); } if (disableAllocationTest) { logparser.setDisableAllocationTest(true); } logparser.parseFile(); } catch (Exception ex) { System.err.println(ex.getMessage()); ex.printStackTrace(); } } catch (ParseException exp) { System.out.println("Unexpected exception:" + exp.getMessage()); } }
From source file:javadepchecker.Main.java
/** * @param args the command line arguments *//*ww w . j a va 2s.co m*/ public static void main(String[] args) throws IOException { int exit = 0; try { CommandLineParser parser = new PosixParser(); Options options = new Options(); options.addOption("h", "help", false, "print help"); options.addOption("i", "image", true, "image directory"); options.addOption("v", "verbose", false, "print verbose output"); CommandLine line = parser.parse(options, args); String[] files = line.getArgs(); if (line.hasOption("h") || files.length == 0) { HelpFormatter h = new HelpFormatter(); h.printHelp("java-dep-check [-i <image] <package.env>+", options); } else { image = line.getOptionValue("i", ""); for (String arg : files) { if (line.hasOption('v')) { System.out.println("Checking " + arg); } if (!checkPkg(new File(arg))) { exit = 1; } } } } catch (ParseException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } System.exit(exit); }
From source file:co.turnus.analysis.buffers.BoundedBufferSchedulingCliLauncher.java
public static void main(String[] args) { try {/*from w ww .j a va 2s . c o m*/ CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); BoundedBufferScheduling bbs = new BoundedBufferScheduling(project); bbs.setConfiguration(config); BufferMinimizationData data = bbs.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Bounded Buffer Scheduling results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsBufferMinimizationDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } String bxdfName = config.getString(BXDF, ""); if (!bxdfName.isEmpty()) { File bxdfFile = new File(outPath, bxdfName + ".bxdf"); new XmlBufferMinimizationDataWriter().write(data, bxdfFile); TurnusLogger.info("BXDF files (one for each configuration) " + "stored in " + outPath); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(BoundedBufferSchedulingCliLauncher.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getCause().toString()); } }
From source file:io.github.the28awg.okato.App.java
public static void main(String[] args) { Options options = new Options(); options.addOption(Option.builder().longOpt("token").hasArg().required().argName("token") .desc(" ? ? ??").build()); options.addOption(Option.builder("t").longOpt("type").hasArg().required().argName("type") .desc(" [city, street, building]").build()); options.addOption(Option.builder("q").longOpt("query").hasArg().argName("query") .desc(" ? ? ").build()); options.addOption(Option.builder("c").longOpt("city_id").hasArg().argName("city_id") .desc(" (? )").build()); options.addOption(Option.builder("s").longOpt("street_id").hasArg().argName("street_id") .desc(" ").build()); CommandLineParser parser = new DefaultParser(); HelpFormatter formatter = new HelpFormatter(); CommandLine cmd;/*from w ww .ja v a 2 s .c o m*/ try { cmd = parser.parse(options, args); } catch (ParseException e) { System.out.println(e.getMessage()); formatter.printHelp("okato", options); System.exit(1); return; } AddressFactory.token(cmd.getOptionValue("token")); String arg_type = cmd.getOptionValue("type"); String arg_city_id = cmd.getOptionValue("city_id", ""); String arg_street_id = cmd.getOptionValue("street_id", ""); String arg_query = cmd.getOptionValue("query", ""); if (arg_type.equalsIgnoreCase("city")) { try { log(SimpleOkato.toSimpleResponse( AddressFactory.service().city(AddressFactory.token(), arg_query).execute().body())); } catch (IOException e) { e.printStackTrace(); } } else if (arg_type.equalsIgnoreCase("street")) { try { log(SimpleOkato.toSimpleResponse(AddressFactory.service() .street(AddressFactory.token(), arg_city_id, arg_query).execute().body())); } catch (IOException e) { e.printStackTrace(); } } else if (arg_type.equalsIgnoreCase("building")) { try { log(SimpleOkato.toSimpleResponse(AddressFactory.service() .building(AddressFactory.token(), arg_city_id, arg_street_id, arg_query).execute().body())); } catch (IOException e) { e.printStackTrace(); } } }
From source file:com.mfalaize.zipdiff.Main.java
/** * The command line interface to zipdiff utility * * @param args The command line parameters *///from w w w . jav a 2 s.c om public static void main(String[] args) { CommandLineParser parser = new DefaultParser(); try { CommandLine line = parser.parse(options, args); String filename1; String filename2; filename1 = line.getOptionValue(OPTION_FILE1); filename2 = line.getOptionValue(OPTION_FILE2); File f1 = new File(filename1); File f2 = new File(filename2); checkFile(f1); checkFile(f2); System.out.println("File 1 = " + f1); System.out.println("File 2 = " + f2); DifferenceCalculator calc = new DifferenceCalculator(f1, f2); String regularExpression; // todo - calc.setFilenamesToIgnore(); if (line.hasOption(OPTION_COMPARE_CRC_VALUES)) { calc.setCompareCRCValues(true); } else { calc.setCompareCRCValues(false); } if (line.hasOption(OPTION_IGNORE_CVS_FILES)) { calc.setIgnoreCVSFiles(true); } else { calc.setIgnoreCVSFiles(false); } if (line.hasOption(OPTION_COMPARE_TIMESTAMPS)) { calc.setIgnoreTimestamps(false); } else { calc.setIgnoreTimestamps(true); } if (line.hasOption(OPTION_REGEX)) { regularExpression = line.getOptionValue(OPTION_REGEX); Set<String> regexSet = new HashSet<String>(); regexSet.add(regularExpression); calc.setFilenameRegexToIgnore(regexSet); } boolean exitWithErrorOnDiff = false; if (line.hasOption(OPTION_EXIT_WITH_ERROR_ON_DIFF)) { exitWithErrorOnDiff = true; } Differences d = calc.getDifferences(); if (line.hasOption(OPTION_OUTPUT_FILE)) { String outputFilename = line.getOptionValue(OPTION_OUTPUT_FILE); writeOutputFile(outputFilename, d); } if (d.hasDifferences()) { if (line.hasOption(OPTION_VERBOSE)) { System.out.println(d); System.out.println(d.getFilename1() + " and " + d.getFilename2() + " are different."); } if (exitWithErrorOnDiff) { System.exit(EXITCODE_DIFF); } } else { System.out.println("No differences found."); } } catch (ParseException pex) { System.err.println(pex.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("Main [options] ", options); System.exit(EXITCODE_ERROR); } catch (Exception ex) { ex.printStackTrace(); System.exit(EXITCODE_ERROR); } }
From source file:cc.wikitools.lucene.IndexWikipediaDump.java
@SuppressWarnings("static-access") public static void main(String[] args) throws Exception { Options options = new Options(); options.addOption(OptionBuilder.withArgName("path").hasArg().withDescription("bz2 Wikipedia XML dump file") .create(INPUT_OPTION));// w w w. j a v a 2s .c o m options.addOption( OptionBuilder.withArgName("dir").hasArg().withDescription("index location").create(INDEX_OPTION)); options.addOption(OptionBuilder.withArgName("num").hasArg() .withDescription("maximum number of documents to index").create(MAX_OPTION)); options.addOption(OptionBuilder.withArgName("num").hasArg().withDescription("number of indexing threads") .create(THREADS_OPTION)); options.addOption(new Option(OPTIMIZE_OPTION, "merge indexes into a single segment")); CommandLine cmdline = null; CommandLineParser parser = new GnuParser(); try { cmdline = parser.parse(options, args); } catch (ParseException exp) { System.err.println("Error parsing command line: " + exp.getMessage()); System.exit(-1); } if (!cmdline.hasOption(INPUT_OPTION) || !cmdline.hasOption(INDEX_OPTION)) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(IndexWikipediaDump.class.getCanonicalName(), options); System.exit(-1); } String indexPath = cmdline.getOptionValue(INDEX_OPTION); int maxdocs = cmdline.hasOption(MAX_OPTION) ? Integer.parseInt(cmdline.getOptionValue(MAX_OPTION)) : Integer.MAX_VALUE; int threads = cmdline.hasOption(THREADS_OPTION) ? Integer.parseInt(cmdline.getOptionValue(THREADS_OPTION)) : DEFAULT_NUM_THREADS; long startTime = System.currentTimeMillis(); String path = cmdline.getOptionValue(INPUT_OPTION); PrintStream out = new PrintStream(System.out, true, "UTF-8"); WikiClean cleaner = new WikiCleanBuilder().withTitle(true).build(); Directory dir = FSDirectory.open(new File(indexPath)); IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_43, ANALYZER); config.setOpenMode(OpenMode.CREATE); IndexWriter writer = new IndexWriter(dir, config); LOG.info("Creating index at " + indexPath); LOG.info("Indexing with " + threads + " threads"); try { WikipediaBz2DumpInputStream stream = new WikipediaBz2DumpInputStream(path); ExecutorService executor = Executors.newFixedThreadPool(threads); int cnt = 0; String page; while ((page = stream.readNext()) != null) { String title = cleaner.getTitle(page); // These are heuristic specifically for filtering out non-articles in enwiki-20120104. if (title.startsWith("Wikipedia:") || title.startsWith("Portal:") || title.startsWith("File:")) { continue; } if (page.contains("#REDIRECT") || page.contains("#redirect") || page.contains("#Redirect")) { continue; } Runnable worker = new AddDocumentRunnable(writer, cleaner, page); executor.execute(worker); cnt++; if (cnt % 10000 == 0) { LOG.info(cnt + " articles added"); } if (cnt >= maxdocs) { break; } } executor.shutdown(); // Wait until all threads are finish while (!executor.isTerminated()) { } LOG.info("Total of " + cnt + " articles indexed."); if (cmdline.hasOption(OPTIMIZE_OPTION)) { LOG.info("Merging segments..."); writer.forceMerge(1); LOG.info("Done!"); } LOG.info("Total elapsed time: " + (System.currentTimeMillis() - startTime) + "ms"); } catch (Exception e) { e.printStackTrace(); } finally { writer.close(); dir.close(); out.close(); } }
From source file:com.ibm.crail.tools.CrailFsck.java
public static void main(String[] args) throws Exception { String type = ""; String filename = "/tmp.dat"; long offset = 0; long length = 1; boolean randomize = false; int storageClass = 0; int locationClass = 0; Option typeOption = Option.builder("t").desc( "type of experiment [getLocations|directoryDump|namenodeDump|blockStatistics|ping|createDirectory]") .hasArg().build();//from ww w .j av a2 s .c om Option fileOption = Option.builder("f").desc("filename").hasArg().build(); Option offsetOption = Option.builder("y").desc("offset into the file").hasArg().build(); Option lengthOption = Option.builder("l").desc("length of the file [bytes]").hasArg().build(); Option storageOption = Option.builder("c").desc("storageClass for file [1..n]").hasArg().build(); Option locationOption = Option.builder("p").desc("locationClass for file [1..n]").hasArg().build(); Options options = new Options(); options.addOption(typeOption); options.addOption(fileOption); options.addOption(offsetOption); options.addOption(lengthOption); options.addOption(storageOption); options.addOption(locationOption); CommandLineParser parser = new DefaultParser(); CommandLine line = parser.parse(options, Arrays.copyOfRange(args, 0, args.length)); if (line.hasOption(typeOption.getOpt())) { type = line.getOptionValue(typeOption.getOpt()); } if (line.hasOption(fileOption.getOpt())) { filename = line.getOptionValue(fileOption.getOpt()); } if (line.hasOption(offsetOption.getOpt())) { offset = Long.parseLong(line.getOptionValue(offsetOption.getOpt())); } if (line.hasOption(lengthOption.getOpt())) { length = Long.parseLong(line.getOptionValue(lengthOption.getOpt())); } if (line.hasOption(storageOption.getOpt())) { storageClass = Integer.parseInt(line.getOptionValue(storageOption.getOpt())); } if (line.hasOption(locationOption.getOpt())) { locationClass = Integer.parseInt(line.getOptionValue(locationOption.getOpt())); } CrailFsck fsck = new CrailFsck(); if (type.equals("getLocations")) { fsck.getLocations(filename, offset, length); } else if (type.equals("directoryDump")) { fsck.directoryDump(filename, randomize); } else if (type.equals("namenodeDump")) { fsck.namenodeDump(); } else if (type.equals("blockStatistics")) { fsck.blockStatistics(filename); } else if (type.equals("ping")) { fsck.ping(); } else if (type.equals("createDirectory")) { fsck.createDirectory(filename, storageClass, locationClass); } else { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("crail fsck", options); System.exit(-1); } }
From source file:co.turnus.analysis.bottlenecks.AlgorithmicBottlenecksCliLauncher.java
public static void main(String[] args) { try {// ww w .j a v a 2 s. c om CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(cliOptions, args); Configuration config = parseCommandLine(cmd); // init models AnalysisActivator.init(); // set logger verbosity if (config.getBoolean(VERBOSE, false)) { TurnusLogger.setLevel(TurnusLevel.ALL); } // load trace project File tDir = new File(config.getString(TRACE_PROJECT)); TraceProject project = TraceProject.load(tDir); // load profiling weights File wFile = new File(config.getString(PROFILING_WEIGHTS)); ProfilingWeights weights = new XmlProfilingWeightsReader().read(project.getNetwork(), wFile); // build the trace weighter StatisticalTraceWeighter tw = new StatisticalTraceWeighter(); tw.configure(weights, ActionWeightsDistribution.class); // run the analysis AlgorithmicBottlenecks ab = new AlgorithmicBottlenecks(project, tw); ab.setConfiguration(config); AlgoBottlenecksData data = ab.run(); TurnusLogger.info("Storing results..."); File outPath = new File(config.getString(OUTPUT_PATH)); // store the analysis report String uuid = UUID.randomUUID().toString(); File rFile = new File(outPath, uuid + "." + TurnusExtension.REPORT); Report report = DataFactory.eINSTANCE.createReport(); report.setDate(new Date()); report.setComment("Report with only Algorithmic Bottlenecks results analysis"); report.getDataSet().add(data); EcoreHelper.storeEObject(report, new ResourceSetImpl(), rFile); TurnusLogger.info("TURNUS report stored in " + rFile); // store formatted reports String xlsName = config.getString(XLS, ""); if (!xlsName.isEmpty()) { File xlsFile = new File(outPath, xlsName + ".xls"); new XlsAlgoBottlenecksDataWriter().write(data, xlsFile); TurnusLogger.info("XLS report stored in " + xlsFile); } TurnusLogger.info("Analysis Done!"); } catch (ParseException e) { TurnusLogger.error(e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(AlgorithmicBottlenecksCliLauncher.class.getSimpleName(), cliOptions); } catch (Exception e) { TurnusLogger.error(e.getMessage()); } }