use of org.eclipse.xtext.util.StopWatch in project xtext-eclipse by eclipse.
the class ProfilerAbstractBuilderTest method testLotsOfFiles.
@Test
public void testLotsOfFiles() throws Exception {
IJavaProject project = workspace.createJavaProject("foo");
workspace.addNature(project.getProject(), XtextProjectHelper.NATURE_ID);
IFolder folder = project.getProject().getFolder("src");
int NUM_FILES = 10;
IFile[] files = new IFile[NUM_FILES];
StopWatch timer = new StopWatch();
for (int i = 0; i < NUM_FILES; i++) {
IFile file = folder.getFile("Test_" + i + "_" + F_EXT);
files[i] = file;
String contents = "object Foo" + i + " references Foo" + (i + 1);
if (i == NUM_FILES)
contents = "object Foo" + i;
file.create(new StringInputStream(contents), true, workspace.monitor());
}
logAndReset("Creating files", timer);
workspace.build();
logAndReset("Auto build", timer);
for (int x = 0; x < 20; x++) {
for (int i = 0; i < NUM_FILES; i++) {
IFile file = files[i];
String contents = "object Foo" + i + " references Foo" + (i + 1);
if (i == NUM_FILES)
contents = "object Foo" + i;
file.setContents(new StringInputStream(contents), true, true, workspace.monitor());
workspace.build();
}
logAndReset("updating all " + NUM_FILES + " files", timer);
}
assertEquals(NUM_FILES, countResourcesInIndex());
}
use of org.eclipse.xtext.util.StopWatch in project xtext-eclipse by eclipse.
the class ProfilerAbstractBuilderTest method testFullBuildBigProject.
@Test
public void testFullBuildBigProject() throws Exception {
IJavaProject project = workspace.createJavaProject("foo");
workspace.addNature(project.getProject(), XtextProjectHelper.NATURE_ID);
IFolder folder = project.getProject().getFolder("src");
int NUM_FILES = 200;
IFile[] files = new IFile[NUM_FILES];
StopWatch timer = new StopWatch();
for (int i = 0; i < NUM_FILES; i++) {
IFile file = folder.getFile("Test_" + i + "_" + F_EXT);
files[i] = file;
String contents = "object Foo" + i + " references Foo" + (i + 1);
if (i == NUM_FILES)
contents = "object Foo" + i;
file.create(new StringInputStream(contents), true, workspace.monitor());
}
logAndReset("Creating files", timer);
workspace.build();
logAndReset("Auto build", timer);
}
use of org.eclipse.xtext.util.StopWatch in project xtext-eclipse by eclipse.
the class ProfilerAbstractBuilderTest method testIncrementalBuildWithBigLibraryFile.
@Test
public void testIncrementalBuildWithBigLibraryFile() throws Exception {
IJavaProject project = workspace.createJavaProject("foo");
workspace.addNature(project.getProject(), XtextProjectHelper.NATURE_ID);
IFolder folder = project.getProject().getFolder("src");
int NUM_OBJECTS = 40000;
StopWatch timer = new StopWatch();
IFile file = folder.getFile("Test_Library" + F_EXT);
String contents = "namespace x { ";
for (int i = 0; i < NUM_OBJECTS; i++) {
contents += " object Foo" + i;
}
contents += "}";
file.create(new StringInputStream(contents), true, workspace.monitor());
logAndReset("Creating files", timer);
workspace.build();
for (int i = 0; i < 5; i++) {
IFile f = folder.getFile("Referencing_" + i + F_EXT);
logAndReset("Creating library file", timer);
f.create(new StringInputStream("object Bar" + i + " references x.Foo1"), true, null);
logAndReset("Auto build", timer);
workspace.build();
}
}
use of org.eclipse.xtext.util.StopWatch in project xtext-eclipse by eclipse.
the class ProfilerAbstractBuilderTest method testFullBuildBigProjectWithSyntaxErrors.
@Test
public void testFullBuildBigProjectWithSyntaxErrors() throws Exception {
IJavaProject project = workspace.createJavaProject("foo");
workspace.addNature(project.getProject(), XtextProjectHelper.NATURE_ID);
IFolder folder = project.getProject().getFolder("src");
int NUM_FILES = 500;
IFile[] files = new IFile[NUM_FILES];
StopWatch timer = new StopWatch();
for (int i = 0; i < NUM_FILES; i++) {
IFile file = folder.getFile("Test_" + i + "_" + F_EXT);
files[i] = file;
String contents = "object Foo" + i + " references Foo" + (i * 1000);
if (i == NUM_FILES)
contents = "object Foo" + i;
file.create(new StringInputStream(contents), true, workspace.monitor());
}
logAndReset("Creating files", timer);
workspace.build();
logAndReset("Auto build", timer);
IMarker[] iMarkers = folder.findMarkers(EValidator.MARKER, true, IResource.DEPTH_INFINITE);
assertEquals(NUM_FILES - 1, iMarkers.length);
}
use of org.eclipse.xtext.util.StopWatch in project xtext-xtend by eclipse.
the class XtendQuickfixProvider method getResolutions.
@Override
public List<IssueResolution> getResolutions(Issue issue) {
StopWatch stopWatch = new StopWatch(logger);
try {
if (LINKING_ISSUE_CODES.contains(issue.getCode())) {
List<IssueResolution> result = new ArrayList<IssueResolution>();
result.addAll(getResolutionsForLinkingIssue(issue));
if (!result.isEmpty())
return result;
}
return super.getResolutions(issue);
} finally {
stopWatch.resetAndLog("#getResolutions");
}
}
Aggregations