Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 159130 Details for
Bug 301563
Fast project import from snapshot data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to org.eclipse.core.tests.resources plugin
org.eclipse.core.tests.resources.patch.txt (text/plain), 5.91 KB, created by
Francis Lynch
on 2010-02-15 17:15:15 EST
(
hide
)
Description:
Patch to org.eclipse.core.tests.resources plugin
Filename:
MIME Type:
Creator:
Francis Lynch
Created:
2010-02-15 17:15:15 EST
Size:
5.91 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.tests.resources >Index: src/org/eclipse/core/tests/internal/localstore/SnapshotImportPerformanceTest.java >=================================================================== >RCS file: src/org/eclipse/core/tests/internal/localstore/SnapshotImportPerformanceTest.java >diff -N src/org/eclipse/core/tests/internal/localstore/SnapshotImportPerformanceTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/tests/internal/localstore/SnapshotImportPerformanceTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,156 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * Francis Lynch (Wind River) - [301563] adapted from >+ * RefreshLocalPerformanceTest >+ *******************************************************************************/ >+package org.eclipse.core.tests.internal.localstore; >+ >+import java.io.File; >+import java.util.Date; >+import junit.framework.Test; >+import junit.framework.TestSuite; >+import org.eclipse.core.resources.*; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.Path; >+import org.eclipse.core.tests.resources.ResourceDeltaVerifier; >+import org.eclipse.core.tests.resources.ResourceTest; >+ >+// >+public class SnapshotImportPerformanceTest extends ResourceTest { >+ /** big site default volume (windows) */ >+ public static final String bigSiteDevice = "d:"; >+ >+ /** big site initial location */ >+ public static final IPath bigSiteLocation = new Path(bigSiteDevice, "/bigsite"); >+ >+ /** settings directory name */ >+ private static final String DIR_NAME = ".settings"; >+ >+ /** benchmark */ >+ public Date startDate; >+ >+ public SnapshotImportPerformanceTest() { >+ super(); >+ } >+ >+ public SnapshotImportPerformanceTest(String name) { >+ super(name); >+ } >+ >+ protected int countChildren(File root) { >+ String[] children = root.list(); >+ if (children == null) >+ return 0; >+ int result = 0; >+ for (int i = 0; i < children.length; i++) { >+ File child = new File(root, children[i]); >+ if (child.isDirectory()) >+ result += countChildren(child); >+ result++; >+ } >+ return result; >+ } >+ >+ public String dispTime(long diff) { >+ return String.valueOf(diff); >+ } >+ >+ public void startClock() { >+ startDate = new Date(); >+ } >+ >+ public long stopClock() { >+ Date stopDate = new Date(); >+ return stopDate.getTime() - startDate.getTime(); >+ } >+ >+ // this test should not be in AllTests because it is only a performance test >+ public static Test suite() { >+ TestSuite suite = new TestSuite(SnapshotImportPerformanceTest.class.getName()); >+ suite.addTest(new SnapshotImportPerformanceTest("testSnapshotImportPerformance")); >+ return suite; >+ } >+ >+ /** >+ * Open a project and export a refresh snapshot. Re-open the project using >+ * the snapshot and compare the times for opening with and without the >+ * snapshot. >+ */ >+ public void testSnapshotImportPerformance() throws Exception { >+ // test if the test can be done in this machine >+ if (!bigSiteLocation.toFile().isDirectory()) >+ return; >+ >+ // create common objects >+ IProject project = getWorkspace().getRoot().getProject("MyTestProject"); >+ IProjectDescription description = getWorkspace().newProjectDescription(project.getName()); >+ description.setLocation(bigSiteLocation); >+ >+ // performance data >+ long originalOpen = 0; >+ long snapshotOpen = 0; >+ long refresh2Open = 0; >+ >+ // report the number of files to be refreshed >+ int numberOfFiles = countChildren(bigSiteLocation.toFile()); >+ System.out.println("Number of local resources: " + numberOfFiles); >+ >+ // create the project from the location >+ project.create(description, null); >+ >+ // open the project, timing the initial refresh >+ startClock(); >+ project.open(null); >+ originalOpen = stopClock(); >+ >+ // dump the snapshot refresh info >+ ensureExistsInWorkspace(project.getFolder(DIR_NAME), true); >+ project.writeRefreshSnapshot(null); >+ >+ // close and delete project but leave contents >+ project.close(null); >+ project.delete(false, false, null); >+ >+ // open the project and import refresh snapshot >+ project.create(description, null); >+ startClock(); >+ project.open(null); >+ snapshotOpen = stopClock(); >+ >+ // now refresh the project, verifying zero resource delta >+ // (except for the creation of .settings/resource-index.zip) >+ ResourceDeltaVerifier verifier = new ResourceDeltaVerifier(); >+ ResourcesPlugin.getWorkspace().addResourceChangeListener(verifier); >+ verifier.reset(); >+ IFolder settings = project.getFolder(DIR_NAME); >+ IFile snapshot = project.getFile(IProject.REFRESH_SNAPSHOT_FILE_LOCATION); >+ verifier.addExpectedChange(settings, IResourceDelta.CHANGED, 0); >+ verifier.addExpectedChange(snapshot, IResourceDelta.ADDED, 0); >+ project.refreshLocal(IResource.DEPTH_INFINITE, null); >+ verifier.verifyDelta(null); >+ assertTrue("2.0 " + verifier.getMessage(), verifier.isDeltaValid()); >+ >+ // close and delete project but leave contents >+ project.close(null); >+ project.delete(false, false, null); >+ IPath snapshotFile = bigSiteLocation.append(IProject.REFRESH_SNAPSHOT_FILE_LOCATION); >+ snapshotFile.toFile().delete(); >+ >+ // open the project again with standard refresh >+ project.create(description, null); >+ startClock(); >+ project.open(null); >+ refresh2Open = stopClock(); >+ >+ System.out.println("Original open: " + originalOpen); >+ System.out.println("Snapshot open: " + snapshotOpen); >+ System.out.println("Second refresh open: " + refresh2Open); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 301563
:
159129
|
159130
|
159396
|
159678
|
160342
|
160343
|
160478
|
160641
|
160898
|
161049