View | Details | Raw Unified | Return to bug 174920 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java (+49 lines)
Lines 804-809 Link Here
804
	assertPerformance();
804
	assertPerformance();
805
}
805
}
806
806
807
public void testCloseProjects() throws JavaModelException {
808
	// store current settings
809
	long oldSnapInterval = ENV.getWorkspace().getDescription().getSnapshotInterval();
810
	boolean oldAutoBuildPolicy = ENV.isAutoBuilding();
811
	
812
	// prevent snapshots and autobuilds from disturbing our measures
813
	ENV.getWorkspace().getDescription().setSnapshotInterval(100000);
814
	ENV.getWorkspace().getDescription().setAutoBuilding(false);
815
	
816
	try {
817
		int length=ALL_PROJECTS.length;
818
		// Warm-up
819
		for (int i=0; i<WARMUP_COUNT; i++) {
820
			for (int j=0; j<length; j++) {
821
				ENV.closeProject(ALL_PROJECTS[j].getPath());
822
			}
823
			for (int j=0; j<length; j++) {
824
				ENV.openProject(ALL_PROJECTS[j].getPath());
825
			}
826
		}
827
	
828
		// Measures
829
		for (int i=0; i<MEASURES_COUNT; i++) {
830
			AbstractJavaModelTests.waitUntilIndexesReady();
831
			// should not be autobuilding...
832
			if (ENV.isAutoBuilding()) {
833
				ENV.waitForAutoBuild();
834
			}
835
			runGc();
836
			startMeasuring();
837
			for (int j=0; j<length; j++) {
838
				ENV.closeProject(ALL_PROJECTS[j].getPath());
839
			}
840
			stopMeasuring();
841
			for (int j=0; j<length; j++) {
842
				ENV.openProject(ALL_PROJECTS[j].getPath());
843
			}
844
		}
845
		// Commit
846
		commitMeasurements();
847
		assertPerformance();
848
	}
849
	finally {
850
		// restore previous settings
851
		ENV.getWorkspace().getDescription().setSnapshotInterval(oldSnapInterval);
852
		ENV.getWorkspace().getDescription().setAutoBuilding(oldAutoBuildPolicy);
853
	}
854
}
855
807
protected void resetCounters() {
856
protected void resetCounters() {
808
	// do nothing
857
	// do nothing
809
}
858
}

Return to bug 174920