@Override public void perform(GraphRewrite event, EvaluationContext context) { if (event.shouldWindupStop()) { throw new WindupStopException("Request to stop detected during iteration related to: " + messagePrefix); } if (totalIterations == -1) { @SuppressWarnings("unchecked") Iterable<WindupVertexFrame> frames = (Iterable<WindupVertexFrame>) event.getRewriteContext().get(Iteration.DEFAULT_VARIABLE_LIST_STRING); totalIterations = Iterators.asList(frames).size(); progressEstimate = new ProgressEstimate(totalIterations); } progressEstimate.addWork(1); if (progressEstimate.getWorked() % interval == 0) { if (estimateTimeRemaining) { long remainingTimeMillis = progressEstimate.getTimeRemainingInMillis(); if (remainingTimeMillis > 1000) event.ruleEvaluationProgress(messagePrefix, progressEstimate.getWorked(), totalIterations, (int) remainingTimeMillis / 1000); } LOG.info(messagePrefix + ": " + progressEstimate.getWorked() + " / " + totalIterations); } }
private void printProgressEstimate(GraphRewrite event, ProgressEstimate estimate) { if (estimate.getWorked() % LOG_INTERVAL != 0) return; int timeRemainingInMillis = (int) estimate.getTimeRemainingInMillis(); if (timeRemainingInMillis > 0) { boolean windupStopRequested = event.ruleEvaluationProgress("Analyze Java", estimate.getWorked(), estimate.getTotal(), timeRemainingInMillis / 1000); if (windupStopRequested) { throw new WindupStopException(Util.WINDUP_BRAND_NAME_ACRONYM + " stop requested through ruleEvaluationProgress() during " + AnalyzeJavaFilesRuleProvider.class.getName()); } } LOG.info("Analyzed Java File: " + estimate.getWorked() + " / " + estimate.getTotal()); }
progressEstimate.addWork(1); if (progressEstimate.getWorked() % 250 == 0) long remainingTimeMillis = progressEstimate.getTimeRemainingInMillis(); if (remainingTimeMillis > 1000) event.ruleEvaluationProgress("Decompilation", progressEstimate.getWorked(), progressEstimate.getTotal(), (int) remainingTimeMillis / 1000);
@Override public void decompilationFailed(List<String> inputPath, String message) { progressEstimate.addWork(1); }
@Override public void perform(final GraphRewrite event, final EvaluationContext context) { ExecutionStatistics.get().begin("ProcyonDecompilationOperation.perform"); int threads = WindupExecutors.getDefaultThreadCount(); LOG.info("Decompiling with " + threads + " threads"); WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); Iterable<JavaClassFileModel> allClasses = getFilesToDecompile(event.getGraphContext()); List<ClassDecompileRequest> classesToDecompile = new ArrayList<>(10000); // Just a guess as to the average size for (JavaClassFileModel classFileModel : allClasses) { if (configurationService.shouldScanPackage(classFileModel.getPackageName())) { File outputDir = DecompilerUtil.getOutputDirectoryForClass(event.getGraphContext(), classFileModel); classesToDecompile.add(new ClassDecompileRequest(outputDir.toPath(), classFileModel.asFile().toPath(), outputDir.toPath())); } } Collections.sort(classesToDecompile, (ClassDecompileRequest o1, ClassDecompileRequest o2) -> o1.getOutputDirectory().toAbsolutePath().toString().compareTo(o2.getOutputDirectory().toString())); ProgressEstimate progressEstimate = new ProgressEstimate(classesToDecompile.size()); AddDecompiledItemsToGraph addDecompiledItemsToGraph = new AddDecompiledItemsToGraph(progressEstimate, event); ProcyonDecompiler decompiler = new ProcyonDecompiler(new ProcyonConfiguration().setIncludeNested(false)); decompiler.setExecutorService(WindupExecutors.newFixedThreadPool(threads), threads); decompiler.decompileClassFiles(classesToDecompile, addDecompiledItemsToGraph); decompiler.close(); ExecutionStatistics.get().end("ProcyonDecompilationOperation.perform"); }
progressEstimate.addWork(1); if (progressEstimate.getWorked() % 250 == 0) long remainingTimeMillis = progressEstimate.getTimeRemainingInMillis(); if (remainingTimeMillis > 1000) event.ruleEvaluationProgress("Decompilation", progressEstimate.getWorked(), progressEstimate.getTotal(), (int) remainingTimeMillis / 1000);
@Override public void decompilationFailed(List<String> inputPath, String message) { progressEstimate.addWork(1); }
-> o1.getOutputDirectory().toAbsolutePath().toString().compareTo(o2.getOutputDirectory().toString())); ProgressEstimate progressEstimate = new ProgressEstimate(totalWork);
progressEstimate.addWork(1); if (progressEstimate.getWorked() % 250 == 0) long remainingTimeMillis = progressEstimate.getTimeRemainingInMillis(); if (remainingTimeMillis > 1000) { event.ruleEvaluationProgress("Decompilation", progressEstimate.getWorked(), progressEstimate.getTotal(), (int) remainingTimeMillis / 1000);
@Override public void perform(GraphRewrite event, EvaluationContext context) { if (event.shouldWindupStop()) { throw new WindupStopException("Request to stop detected during iteration related to: " + messagePrefix); } if (totalIterations == -1) { @SuppressWarnings("unchecked") Iterable<WindupVertexFrame> frames = (Iterable<WindupVertexFrame>) event.getRewriteContext().get(Iteration.DEFAULT_VARIABLE_LIST_STRING); totalIterations = Iterators.asList(frames).size(); progressEstimate = new ProgressEstimate(totalIterations); } progressEstimate.addWork(1); if (progressEstimate.getWorked() % interval == 0) { if (estimateTimeRemaining) { long remainingTimeMillis = progressEstimate.getTimeRemainingInMillis(); if (remainingTimeMillis > 1000) event.ruleEvaluationProgress(messagePrefix, progressEstimate.getWorked(), totalIterations, (int) remainingTimeMillis / 1000); } LOG.info(messagePrefix + ": " + progressEstimate.getWorked() + " / " + totalIterations); } }
private void printProgressEstimate(GraphRewrite event, ProgressEstimate estimate) { if (estimate.getWorked() % LOG_INTERVAL != 0) return; int timeRemainingInMillis = (int) estimate.getTimeRemainingInMillis(); if (timeRemainingInMillis > 0) { boolean windupStopRequested = event.ruleEvaluationProgress("Analyze Java", estimate.getWorked(), estimate.getTotal(), timeRemainingInMillis / 1000); if (windupStopRequested) { throw new WindupStopException(Util.WINDUP_BRAND_NAME_ACRONYM + " stop requested through ruleEvaluationProgress() during " + AnalyzeJavaFilesRuleProvider.class.getName()); } } LOG.info("Analyzed Java File: " + estimate.getWorked() + " / " + estimate.getTotal()); }
@Override public void decompilationFailed(List<String> inputPath, String message) { ClassDecompileRequest request = requestMap.get(inputPath); ProcyonDecompiler procyon = new ProcyonDecompiler(); DecompilationResult result = procyon.decompileClassFile(request.getRootDirectory(), request.getClassFile(), request.getOutputDirectory()); if (!result.getFailures().isEmpty()) { LOG.warning("Failsafe Procyon decompilation of " + inputPath + " failed!"); progressEstimate.addWork(1); } else { for (Map.Entry<String, String> decompiledFile : result.getDecompiledFiles().entrySet()) { LOG.info("Failsafe Procyon decompilation of " + inputPath + " successful!"); fileDecompiled(Collections.singletonList(decompiledFile.getKey()), decompiledFile.getValue()); } } }
@Override public void perform(final GraphRewrite event, final EvaluationContext context) { ExecutionStatistics.get().begin("ProcyonDecompilationOperation.perform"); int threads = WindupExecutors.getDefaultThreadCount(); LOG.info("Decompiling with " + threads + " threads"); WindupJavaConfigurationService configurationService = new WindupJavaConfigurationService(event.getGraphContext()); Iterable<JavaClassFileModel> allClasses = getFilesToDecompile(event.getGraphContext()); List<ClassDecompileRequest> classesToDecompile = new ArrayList<>(10000); // Just a guess as to the average size for (JavaClassFileModel classFileModel : allClasses) { if (configurationService.shouldScanPackage(classFileModel.getPackageName())) { File outputDir = DecompilerUtil.getOutputDirectoryForClass(event.getGraphContext(), classFileModel); classesToDecompile.add(new ClassDecompileRequest(outputDir.toPath(), classFileModel.asFile().toPath(), outputDir.toPath())); } } Collections.sort(classesToDecompile, (ClassDecompileRequest o1, ClassDecompileRequest o2) -> o1.getOutputDirectory().toAbsolutePath().toString().compareTo(o2.getOutputDirectory().toString())); ProgressEstimate progressEstimate = new ProgressEstimate(classesToDecompile.size()); AddDecompiledItemsToGraph addDecompiledItemsToGraph = new AddDecompiledItemsToGraph(progressEstimate, event); ProcyonDecompiler decompiler = new ProcyonDecompiler(new ProcyonConfiguration().setIncludeNested(false)); decompiler.setExecutorService(WindupExecutors.newFixedThreadPool(threads), threads); decompiler.decompileClassFiles(classesToDecompile, addDecompiledItemsToGraph); decompiler.close(); ExecutionStatistics.get().end("ProcyonDecompilationOperation.perform"); }
progressEstimate.addWork(1); if (progressEstimate.getWorked() % 250 == 0) long remainingTimeMillis = progressEstimate.getTimeRemainingInMillis(); if (remainingTimeMillis > 1000) { event.ruleEvaluationProgress("Decompilation", progressEstimate.getWorked(), progressEstimate.getTotal(), (int) remainingTimeMillis / 1000);
@Override public void decompilationFailed(List<String> inputPath, String message) { ClassDecompileRequest request = requestMap.get(inputPath); ProcyonDecompiler procyon = new ProcyonDecompiler(); DecompilationResult result = procyon.decompileClassFile(request.getRootDirectory(), request.getClassFile(), request.getOutputDirectory()); if (!result.getFailures().isEmpty()) { LOG.warning("Failsafe Procyon decompilation of " + inputPath + " failed!"); progressEstimate.addWork(1); } else { for (Map.Entry<String, String> decompiledFile : result.getDecompiledFiles().entrySet()) { LOG.info("Failsafe Procyon decompilation of " + inputPath + " successful!"); fileDecompiled(Collections.singletonList(decompiledFile.getKey()), decompiledFile.getValue()); } } }
-> o1.getOutputDirectory().toAbsolutePath().toString().compareTo(o2.getOutputDirectory().toString())); ProgressEstimate progressEstimate = new ProgressEstimate(totalWork);
ProgressEstimate estimate = new ProgressEstimate(sourceFileCount); for (JavaAnalysisBatch batch : batchMap.values())
ProgressEstimate estimate = new ProgressEstimate(sourceFileCount); for (JavaAnalysisBatch batch : batchMap.values())