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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java (-1 / +89 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 1283-1288 Link Here
1283
	}
1283
	}
1284
}
1284
}
1285
1285
1286
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=331632
1287
public void testReopenSingleProject() throws CoreException {
1288
	tagAsSummary("Reopen a single project in a workspace", false); // do NOT put in fingerprint
1289
1290
	// First close all Eclipse projects
1291
	long startTime = 0;
1292
	if (PRINT) {
1293
		System.out.print("Close all Eclipse projects...");
1294
		startTime = System.currentTimeMillis();
1295
	}
1296
	int length=ALL_PROJECTS.length;
1297
	for (int j=0; j<length; j++) {
1298
		ALL_PROJECTS[j].getProject().close(null);
1299
	}		
1300
	AbstractJavaModelTests.waitUntilIndexesReady();
1301
	AbstractJavaModelTests.waitForAutoBuild();
1302
	if (PRINT) {
1303
		System.out.println((System.currentTimeMillis()-startTime)+"ms");
1304
	}
1305
	
1306
1307
	// Warm-up
1308
	if (PRINT) {
1309
		System.out.print("Warmup test...");
1310
		startTime = System.currentTimeMillis();
1311
	}
1312
	final int warmup = WARMUP_COUNT / 10;
1313
	for (int i=0; i<warmup; i++) {
1314
		BIG_PROJECT.getProject().close(null);
1315
		AbstractJavaModelTests.waitUntilIndexesReady();
1316
		AbstractJavaModelTests.waitForAutoBuild();
1317
		BIG_PROJECT.getProject().open(null);
1318
		AbstractJavaModelTests.waitUntilIndexesReady();
1319
		AbstractJavaModelTests.waitForAutoBuild();
1320
		AbstractJavaModelTests.waitForManualRefresh();
1321
	}
1322
	if (PRINT) {
1323
		System.out.println((System.currentTimeMillis()-startTime)+"ms");
1324
	}
1325
1326
	// Measures
1327
	if (PRINT) {
1328
		System.out.println();
1329
		System.out.println("Start measures:");
1330
		startTime = System.currentTimeMillis();
1331
	}
1332
	for (int i=0; i<MEASURES_COUNT; i++) {
1333
		runGc();
1334
		BIG_PROJECT.getProject().close(null);
1335
		AbstractJavaModelTests.waitUntilIndexesReady();
1336
		AbstractJavaModelTests.waitForAutoBuild();
1337
		startMeasuring();
1338
		BIG_PROJECT.getProject().open(null);
1339
		AbstractJavaModelTests.waitUntilIndexesReady();
1340
		AbstractJavaModelTests.waitForAutoBuild();
1341
		AbstractJavaModelTests.waitForManualRefresh();
1342
		stopMeasuring();
1343
	}
1344
	if (PRINT) {
1345
		System.out.println("	total time: "+((System.currentTimeMillis()-startTime)/1000.0)+"s");
1346
	}
1347
1348
	// Commit
1349
	if (PRINT) {
1350
		System.out.println();
1351
		System.out.println("Commit measures:");
1352
		startTime = System.currentTimeMillis();
1353
	}
1354
	commitMeasurements();
1355
	assertPerformance();
1356
1357
	// Finally reopen all Eclipse projects
1358
	if (PRINT) {
1359
		System.out.print("Reopen Eclipse projects...");
1360
		startTime = System.currentTimeMillis();
1361
	}
1362
	for (int i=0; i<length; i++) {
1363
		ALL_PROJECTS[i].getProject().open(null);
1364
	}
1365
	AbstractJavaModelTests.waitUntilIndexesReady();
1366
	AbstractJavaModelTests.waitForAutoBuild();
1367
	AbstractJavaModelTests.waitForManualRefresh();
1368
	runGc();
1369
	if (PRINT) {
1370
		System.out.println((System.currentTimeMillis()-startTime)+"ms");
1371
	}
1372
}
1373
1286
protected void resetCounters() {
1374
protected void resetCounters() {
1287
	// do nothing
1375
	// do nothing
1288
}
1376
}

Return to bug 331632