Loading de.ugoe.cs.swe.T3Q/src/de/ugoe/cs/swe/T3Q/Resolver.java 0 → 100644 +41 −0 Original line number Diff line number Diff line package de.ugoe.cs.swe.T3Q; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtext.EcoreUtil2; import com.google.common.base.Stopwatch; import de.ugoe.cs.swe.common.MiscTools; import de.ugoe.cs.swe.common.logging.LoggingInterface; import de.ugoe.cs.swe.common.logging.LoggingInterface.LogLevel; public class Resolver implements Callable<String> { private final Resource resource; private final LoggingInterface logger; public Resolver(Resource resource, LoggingInterface logger) { this.resource = resource; this.logger = logger; } private String analyze() { Stopwatch stopwatch = Stopwatch.createStarted(); EcoreUtil2.resolveAll(resource); if (T3Q.getLogLevel().equals(LogLevel.DEBUG)) { System.out.print("Resolving "+resource.getURI().path().substring(1)+"..."); System.out.println("\tdone in " + stopwatch.elapsed(TimeUnit.MILLISECONDS) + " ms (" + MiscTools.secondsToString(stopwatch.elapsed(TimeUnit.SECONDS)) + " minutes)."); } stopwatch.stop(); return "Done"; } @Override public String call() throws Exception { return analyze(); } } de.ugoe.cs.swe.T3Q/src/de/ugoe/cs/swe/T3Q/TTCN3ResourceProvider.java +48 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,54 @@ public class TTCN3ResourceProvider { TTCN3StatisticsProvider.getInstance().setParsingCompleted(true); System.out.println("Test suite parsed in " + MiscTools.msToString(stopwatch.elapsed(TimeUnit.MILLISECONDS)) + " minutes." + '\n'); stopwatch.reset(); stopwatch.start(); System.out.println("Resolving references..."); //TODO: process multicore? // for (Resource r : TTCN3GlobalScopeProvider.RESOURCES) { // //TODO: make INFORMATION / DEBUG // System.out.print("Resolving "+r.getURI().path().substring(1)+"..."); // long start = stopwatch.elapsed(TimeUnit.MILLISECONDS); // EcoreUtil2.resolveAll(r); // long end = stopwatch.elapsed(TimeUnit.MILLISECONDS); // long duration = end - start; // System.out.println("\tdone in " + duration + " ms (" // + MiscTools.secondsToString(duration) // + "/"+ MiscTools.secondsToString(stopwatch.elapsed(TimeUnit.MILLISECONDS))+" minutes)."); // } ExecutorService resolverPool = Executors.newFixedThreadPool(getCores()); ArrayList<Resolver> resolver = new ArrayList<Resolver>(); for (Resource r : TTCN3GlobalScopeProvider.RESOURCES) { resolver.add(new Resolver(r, logger)); } try { List<Future<String>> output = resolverPool.invokeAll(resolver); resolverPool.shutdown(); System.out.print('\n'); for (Future<String> f : output) { String o = f.get(); // System.out.println("Validation output of " + o.getResource().getURI().lastSegment()); // for (FeatureBasedDiagnostic d : o.getOutput()) { // printOutput(o.getResource(), d); // } } } catch (InterruptedException | ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } //TODO: make INFORMATION / DEBUG System.out.println("References resolved in " + MiscTools.msToString(stopwatch.elapsed(TimeUnit.MILLISECONDS)) + " minutes." + '\n'); stopwatch.stop(); } public void analyzeResources() { Loading Loading
de.ugoe.cs.swe.T3Q/src/de/ugoe/cs/swe/T3Q/Resolver.java 0 → 100644 +41 −0 Original line number Diff line number Diff line package de.ugoe.cs.swe.T3Q; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtext.EcoreUtil2; import com.google.common.base.Stopwatch; import de.ugoe.cs.swe.common.MiscTools; import de.ugoe.cs.swe.common.logging.LoggingInterface; import de.ugoe.cs.swe.common.logging.LoggingInterface.LogLevel; public class Resolver implements Callable<String> { private final Resource resource; private final LoggingInterface logger; public Resolver(Resource resource, LoggingInterface logger) { this.resource = resource; this.logger = logger; } private String analyze() { Stopwatch stopwatch = Stopwatch.createStarted(); EcoreUtil2.resolveAll(resource); if (T3Q.getLogLevel().equals(LogLevel.DEBUG)) { System.out.print("Resolving "+resource.getURI().path().substring(1)+"..."); System.out.println("\tdone in " + stopwatch.elapsed(TimeUnit.MILLISECONDS) + " ms (" + MiscTools.secondsToString(stopwatch.elapsed(TimeUnit.SECONDS)) + " minutes)."); } stopwatch.stop(); return "Done"; } @Override public String call() throws Exception { return analyze(); } }
de.ugoe.cs.swe.T3Q/src/de/ugoe/cs/swe/T3Q/TTCN3ResourceProvider.java +48 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,54 @@ public class TTCN3ResourceProvider { TTCN3StatisticsProvider.getInstance().setParsingCompleted(true); System.out.println("Test suite parsed in " + MiscTools.msToString(stopwatch.elapsed(TimeUnit.MILLISECONDS)) + " minutes." + '\n'); stopwatch.reset(); stopwatch.start(); System.out.println("Resolving references..."); //TODO: process multicore? // for (Resource r : TTCN3GlobalScopeProvider.RESOURCES) { // //TODO: make INFORMATION / DEBUG // System.out.print("Resolving "+r.getURI().path().substring(1)+"..."); // long start = stopwatch.elapsed(TimeUnit.MILLISECONDS); // EcoreUtil2.resolveAll(r); // long end = stopwatch.elapsed(TimeUnit.MILLISECONDS); // long duration = end - start; // System.out.println("\tdone in " + duration + " ms (" // + MiscTools.secondsToString(duration) // + "/"+ MiscTools.secondsToString(stopwatch.elapsed(TimeUnit.MILLISECONDS))+" minutes)."); // } ExecutorService resolverPool = Executors.newFixedThreadPool(getCores()); ArrayList<Resolver> resolver = new ArrayList<Resolver>(); for (Resource r : TTCN3GlobalScopeProvider.RESOURCES) { resolver.add(new Resolver(r, logger)); } try { List<Future<String>> output = resolverPool.invokeAll(resolver); resolverPool.shutdown(); System.out.print('\n'); for (Future<String> f : output) { String o = f.get(); // System.out.println("Validation output of " + o.getResource().getURI().lastSegment()); // for (FeatureBasedDiagnostic d : o.getOutput()) { // printOutput(o.getResource(), d); // } } } catch (InterruptedException | ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } //TODO: make INFORMATION / DEBUG System.out.println("References resolved in " + MiscTools.msToString(stopwatch.elapsed(TimeUnit.MILLISECONDS)) + " minutes." + '\n'); stopwatch.stop(); } public void analyzeResources() { Loading