Java Code Examples for org.eclipse.xtext.util.internal.Stopwatches#resetAll()
The following examples show how to use
org.eclipse.xtext.util.internal.Stopwatches#resetAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StopwatchRule.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Override public Statement apply(final Statement base, final Description description) { if (!watchAll && description.getAnnotation(Timed.class) == null) return base; return new Statement() { @Override public void evaluate() throws Throwable { long timeSpend = -1; try { Stopwatches.setEnabled(true); Stopwatches.resetAll(); long before = System.currentTimeMillis(); base.evaluate(); timeSpend = System.currentTimeMillis()-before; } finally { printStopwatchData(description, Stopwatches.allNumbers(), timeSpend); Stopwatches.resetAll(); Stopwatches.setEnabled(false); } } }; }
Example 2
Source File: StopwatchRule.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Override public Statement apply(final Statement base, final Description description) { if (!watchAll && description.getAnnotation(Timed.class) == null) return base; return new Statement() { @Override public void evaluate() throws Throwable { long timeSpend = -1; try { Stopwatches.setEnabled(true); Stopwatches.resetAll(); long before = System.currentTimeMillis(); base.evaluate(); timeSpend = System.currentTimeMillis()-before; } finally { printStopwatchData(description, Stopwatches.allNumbers(), timeSpend); Stopwatches.resetAll(); Stopwatches.setEnabled(false); } } }; }
Example 3
Source File: StopwatchRule.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public Statement apply(final Statement base, final Description description) { if (!watchAll && description.getAnnotation(Timed.class) == null) return base; return new Statement() { @Override public void evaluate() throws Throwable { long timeSpend = -1; try { Stopwatches.setEnabled(true); Stopwatches.resetAll(); long before = System.currentTimeMillis(); base.evaluate(); timeSpend = System.currentTimeMillis()-before; } finally { printStopwatchData(description, Stopwatches.allNumbers(), timeSpend); Stopwatches.resetAll(); Stopwatches.setEnabled(false); } } }; }
Example 4
Source File: StopwatchRule.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Override public Statement apply(final Statement base, final Description description) { if (!watchAll && description.getAnnotation(Timed.class) == null) return base; return new Statement() { @Override public void evaluate() throws Throwable { long timeSpend = -1; try { Stopwatches.setEnabled(true); Stopwatches.resetAll(); long before = System.currentTimeMillis(); base.evaluate(); timeSpend = System.currentTimeMillis()-before; } finally { printStopwatchData(description, Stopwatches.allNumbers(), timeSpend); Stopwatches.resetAll(); Stopwatches.setEnabled(false); } } }; }
Example 5
Source File: PerformanceTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void testCleanBuild() throws Exception { final IProject project = PerformanceTestProjectSetup.testProject.getProject(); project.build(IncrementalProjectBuilder.CLEAN_BUILD, null); project.build(IncrementalProjectBuilder.CLEAN_BUILD, null); Stopwatches.resetAll(); project.build(IncrementalProjectBuilder.CLEAN_BUILD, null); }
Example 6
Source File: PerformanceTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void testIncrementalBuild() throws Exception { this.internalTestIncrementalBuild(); this.internalTestIncrementalBuild(); Stopwatches.resetAll(); this.internalTestIncrementalBuild(); }
Example 7
Source File: PerformanceTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void testFullBuild() throws Exception { final IProject project = PerformanceTestProjectSetup.testProject.getProject(); project.build(IncrementalProjectBuilder.FULL_BUILD, null); project.build(IncrementalProjectBuilder.FULL_BUILD, null); Stopwatches.resetAll(); project.build(IncrementalProjectBuilder.FULL_BUILD, null); }
Example 8
Source File: PerformanceTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Test public void testCleanFullBuild() throws Exception { final IProject project = PerformanceTestProjectSetup.testProject.getProject(); project.build(IncrementalProjectBuilder.CLEAN_BUILD, null); project.build(IncrementalProjectBuilder.FULL_BUILD, null); project.build(IncrementalProjectBuilder.CLEAN_BUILD, null); project.build(IncrementalProjectBuilder.FULL_BUILD, null); Stopwatches.resetAll(); project.build(IncrementalProjectBuilder.CLEAN_BUILD, null); project.build(IncrementalProjectBuilder.FULL_BUILD, null); }
Example 9
Source File: BuilderPerformanceTest.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
private void printAndClearStopwatchData() { if (doPrint) { System.out.println(Stopwatches.getPrintableStopwatchData()); } Stopwatches.resetAll(); }
Example 10
Source File: PerformanceTest.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Test public void testBuildOfDownstreamProject() throws Exception { final IJavaProject project = PerformanceTestProjectSetup.testProject; final IJavaProject downStreamProject = PerformanceTestProjectSetup.createJavaProject("performance.test.project.downstream", new String[] { JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature" }); JavaProjectSetupUtil.addProjectReference(downStreamProject, project); new ToggleXtextNatureCommand().toggleNature(downStreamProject.getProject()); final IFolder sourceFolder = JavaProjectSetupUtil.addSourceFolder(downStreamProject, "src"); JavaProjectSetupUtil.addSourceFolder(downStreamProject, "xtend-gen"); sourceFolder.getFolder("foo").create(true, true, null); final IFile sourceFile = sourceFolder.getFile("foo/MyFile.xtend"); StringConcatenation _builder = new StringConcatenation(); _builder.append("package foo"); _builder.newLine(); _builder.newLine(); _builder.append("import org.eclipse.xtext.xbase.formatting.BasicFormatterPreferenceKeys"); _builder.newLine(); _builder.append("import org.eclipse.xtext.xbase.formatting.FormattableDocument"); _builder.newLine(); _builder.append("import org.eclipse.xtext.xbase.formatting.HiddenLeafAccess"); _builder.newLine(); _builder.append("import org.eclipse.xtext.xbase.formatting.NodeModelAccess"); _builder.newLine(); _builder.append("import org.eclipse.xtext.xbase.formatting.XbaseFormatter2"); _builder.newLine(); _builder.newLine(); _builder.append("class MyFile extends XbaseFormatter2 {"); _builder.newLine(); _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("def a(BasicFormatterPreferenceKeys keys) {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("BasicFormatterPreferenceKeys::indentation"); _builder.newLine(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("def b(FormattableDocument doc) {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("doc.cfg.get(BasicFormatterPreferenceKeys::indentation)"); _builder.newLine(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("def c(HiddenLeafAccess x) {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("x.getHiddenLeafsAfter(null).newLines"); _builder.newLine(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append("\t"); _builder.newLine(); _builder.append("\t"); _builder.append("def d(NodeModelAccess x) {"); _builder.newLine(); _builder.append("\t\t"); _builder.append("x.nodeForEObject(null).asTreeIterable"); _builder.newLine(); _builder.append("\t"); _builder.append("}"); _builder.newLine(); _builder.append("}"); _builder.newLine(); StringInputStream _stringInputStream = new StringInputStream(_builder.toString()); sourceFile.create(_stringInputStream, true, null); final IProject p = downStreamProject.getProject(); p.build(IncrementalProjectBuilder.FULL_BUILD, null); p.build(IncrementalProjectBuilder.FULL_BUILD, null); Stopwatches.resetAll(); p.build(IncrementalProjectBuilder.FULL_BUILD, null); }