public void run(String module, String[] args) throws IOException { if (module.endsWith(".rsc")) { module = module.substring(0, module.length() - 4); } module = module.replaceAll("/", "::"); eval.doImport(null, module); // eval.eval("") IValue v = eval.main(null, module, "main", args); if (v != null) { new StandardTextWriter(true).write(v, eval.getStdOut()); eval.getStdOut().flush(); } return; }
public void report() { List<Map.Entry<AbstractAST, Count>> sortedData = sortData(); int maxURL = 1; long nTicks = 0; for (Map.Entry<AbstractAST, Count> e : sortedData) { URI url = e.getKey().getLocation().getURI(); int sz = url.toString().length(); if (sz > maxURL) maxURL = sz; nTicks += e.getValue().getTicks(); } PrintWriter out = eval.getStdOut(); String URLFormat = "%" + maxURL + "s"; out.printf( "PROFILE: %d data points, %d ticks, tick = %d milliSecs\n", data.size(), nTicks, resolution); out.printf(URLFormat + "%11s%8s%9s %s\n", " Source File", "Lines", "Ticks", "%", "Source"); for (Map.Entry<AbstractAST, Count> e : sortedData) { ISourceLocation L = e.getKey().getLocation(); String uri = L.getURI().toString(); String filePrefix = "file://"; if (uri.startsWith(filePrefix)) uri = uri.substring(filePrefix.length()); int bgn = L.getBeginLine(); int end = L.getEndLine(); String range = (end == bgn) ? Integer.toString(bgn) : bgn + ".." + end; int ticks = e.getValue().getTicks(); double perc = (ticks * 100.0) / nTicks; String source = String.format( "%-30.30s", e.getKey().toString().replaceFirst("^[\\s]+", "").replaceAll("[\\s]+", " ")); out.printf(URLFormat + "%11s%8d%8.1f%% %s\n", uri, range, ticks, perc, source); } // Make sure that our output is seen: out.flush(); }
private void report(String title, Map<ISourceLocation, Count> data) { List<Map.Entry<ISourceLocation, Count>> sortedData = sortData(data); int maxName = 1; long nTicks = 0; for (Map.Entry<ISourceLocation, Count> e : sortedData) { int sz = names.get(e.getKey()).length(); if (sz > maxName) { maxName = sz; } nTicks += e.getValue().getTicks(); } PrintWriter out = eval.getStdOut(); String nameFormat = "%" + maxName + "s"; out.printf( title + " PROFILE: %d data points, %d ticks, tick = %d milliSecs\n", ast.size(), nTicks, resolution); out.printf(nameFormat + "%8s%9s %s\n", " Scope", "Ticks", "%", "Source"); for (Map.Entry<ISourceLocation, Count> e : sortedData) { String L = e.getKey().toString(); String name = names.get(e.getKey()); int ticks = e.getValue().getTicks(); double perc = (ticks * 100.0) / nTicks; if (perc < 1.0) { break; } String source = String.format("%s", L); out.printf(nameFormat + "%8d%8.1f%% %s\n", name, ticks, perc, source); } // Make sure that our output is seen: out.flush(); }
public void report() { report("FRAMES", frame); eval.getStdOut().println(); report("ASTS", ast); }