diff options
author | Frederic Fusier | 2007-06-01 17:17:15 +0000 |
---|---|---|
committer | Frederic Fusier | 2007-06-01 17:17:15 +0000 |
commit | 59494b92019a41aaf08831ba907eac79046f1bb1 (patch) | |
tree | 8d4b1f45bb80bfd8f5dc1f2e2ed7ddfe46f84696 | |
parent | e2e0cd286786b3754198313f2cde1737a89bf7ba (diff) | |
download | eclipse.jdt.core-perf_32x.tar.gz eclipse.jdt.core-perf_32x.tar.xz eclipse.jdt.core-perf_32x.zip |
perf_32x - 189456, 189852v_671_perf_32xhperf_32x
9 files changed, 186 insertions, 39 deletions
diff --git a/org.eclipse.jdt.core.tests.performance/build.properties b/org.eclipse.jdt.core.tests.performance/build.properties index 7d4a54da73..762724c9fa 100644 --- a/org.eclipse.jdt.core.tests.performance/build.properties +++ b/org.eclipse.jdt.core.tests.performance/build.properties @@ -13,6 +13,7 @@ bin.includes = plugin.xml,\ about.html,\ jdtcoretestsperf.jar,\ *.zip/,\ - local_test.xml + local_test.xml,\ + GenericTypeTest.java src.includes = about.html source.jdtcoretestsperf.jar = src diff --git a/org.eclipse.jdt.core.tests.performance/plugin.xml b/org.eclipse.jdt.core.tests.performance/plugin.xml index 8ea71cdabb..9edd9b4d99 100644 --- a/org.eclipse.jdt.core.tests.performance/plugin.xml +++ b/org.eclipse.jdt.core.tests.performance/plugin.xml @@ -21,6 +21,7 @@ <import plugin="org.eclipse.jdt.core.tests.model"/> <import plugin="org.junit"/> <import plugin="org.eclipse.test.performance"/> + <import plugin="org.eclipse.text"/> </requires> </plugin> diff --git a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/AllPerformanceTests.java b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/AllPerformanceTests.java index af5df85038..274a602086 100644 --- a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/AllPerformanceTests.java +++ b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/AllPerformanceTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 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 @@ -38,6 +38,7 @@ public class AllPerformanceTests extends junit.framework.TestCase { FullSourceWorkspaceTypeHierarchyTests.class, FullSourceWorkspaceModelTests.class, FullSourceWorkspaceCompletionTests.class, + FullSourceWorkspaceFormatterTests.class, }; } diff --git a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceASTTests.java b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceASTTests.java index d7fe6e9b1a..0353651902 100644 --- a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceASTTests.java +++ b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceASTTests.java @@ -583,7 +583,7 @@ public class FullSourceWorkspaceASTTests extends FullSourceWorkspaceTests { * @deprecated To reduce deprecated warnings */ public void testPerfDomAstCreationJLS2() throws JavaModelException { - tagAsSummary("DOM AST tree for one file using JLS2", true); // put in fingerprint + tagAsSummary("DOM AST tree for one file using JLS2", false); // do NOT put in fingerprint ICompilationUnit unit = getCompilationUnit("org.eclipse.jdt.core", "org.eclipse.jdt.internal.compiler.parser", "Parser.java"); Hashtable options = JavaCore.getOptions(); @@ -596,7 +596,7 @@ public class FullSourceWorkspaceASTTests extends FullSourceWorkspaceTests { * Performance DOM/AST creation on the entire workspace using JLS3. */ public void testPerfDomAstCreationJLS3() throws JavaModelException { - tagAsSummary("DOM AST tree for one file using JLS3", false); // put in fingerprint + tagAsSummary("DOM AST tree for one file using JLS3", false); // do NOT put in fingerprint ICompilationUnit unit = getCompilationUnit("org.eclipse.jdt.core", "org.eclipse.jdt.internal.compiler.parser", "Parser.java"); createAST(unit, AST.JLS3); @@ -655,7 +655,7 @@ public class FullSourceWorkspaceASTTests extends FullSourceWorkspaceTests { * @deprecated To reduce deprecated warnings */ public void testWkspDomAstCreationJLS2() throws JavaModelException { - tagAsSummary("DOM AST tree for workspace files (JLS2)", true); // put in fingerprint + tagAsSummary("DOM AST tree for workspace files (JLS2)", false); // do NOT put in fingerprint runAllProjectsAstCreation(AST.JLS2); } diff --git a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceBuildTests.java b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceBuildTests.java index 0351819d11..d1d7c55cee 100644 --- a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceBuildTests.java +++ b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceBuildTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2007 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 @@ -636,7 +636,7 @@ public class FullSourceWorkspaceBuildTests extends FullSourceWorkspaceTests { * @since 3.2 M6 */ public void testFullBuildProjectNoWarning() throws CoreException, IOException { - tagAsSummary("Build JDT/Core project (no warning)", true); // put in fingerprint + tagAsSummary("Build JDT/Core project (no warning)", false); // do NOT put in fingerprint build(JDT_CORE_PROJECT, warningOptions(-1/*no warning*/), true); } @@ -660,7 +660,7 @@ public class FullSourceWorkspaceBuildTests extends FullSourceWorkspaceTests { * @since 3.2 M6 */ public void testFullBuildProjectAllWarnings() throws CoreException, IOException { - tagAsSummary("Build JDT/Core project (all warnings)", true); // put in fingerprint + tagAsSummary("Build JDT/Core project (all warnings)", false); // do NOT put in fingerprint build(JDT_CORE_PROJECT, warningOptions(1/*all warnings*/), false); } @@ -671,7 +671,6 @@ public class FullSourceWorkspaceBuildTests extends FullSourceWorkspaceTests { * before put it in builds performance results. * * @throws IOException - * TODO (frederic) remove for 3.2 RC1 */ public void testBatchCompilerNoWarning() throws IOException, CoreException { tagAsSummary("Compile folders using cmd line (no warn)", false); // do NOT put in fingerprint @@ -684,7 +683,7 @@ public class FullSourceWorkspaceBuildTests extends FullSourceWorkspaceTests { * @throws IOException */ public void testCompileJDTCoreProjectNoWarning() throws IOException, CoreException { - tagAsSummary("Compile JDT/Core with cmd line (no warn)", true); // put in fingerprint + tagAsSummary("Compile JDT/Core with cmd line (no warn)", false); // do NOT put in fingerprint compile(JavaCore.PLUGIN_ID, "-nowarn", false/*no log*/, JDT_CORE_SRC_PATHS); } @@ -704,7 +703,7 @@ public class FullSourceWorkspaceBuildTests extends FullSourceWorkspaceTests { * @throws IOException */ public void testCompileJDTCoreProjectJavadoc() throws IOException, CoreException { - tagAsSummary("Compile JDT/Core with cmd line (javadoc)", true); // put in fingerprint + tagAsSummary("Compile JDT/Core with cmd line (javadoc)", false); // do NOT put in fingerprint compile(JavaCore.PLUGIN_ID, "-warn:javadoc", false/*no log*/, JDT_CORE_SRC_PATHS); } @@ -715,7 +714,7 @@ public class FullSourceWorkspaceBuildTests extends FullSourceWorkspaceTests { * @since 3.2 M6 */ public void testCompileJDTCoreProjectAllWarnings() throws IOException, CoreException { - tagAsSummary("Compile JDT/Core with cmd line (all)", true); // put in fingerprint + tagAsSummary("Compile JDT/Core with cmd line (all)", false); // do NOT put in fingerprint compile(JavaCore.PLUGIN_ID, ALL_OPTIONS, false/*no log*/, JDT_CORE_SRC_PATHS); } @@ -726,7 +725,7 @@ public class FullSourceWorkspaceBuildTests extends FullSourceWorkspaceTests { * @since 3.2 M6 */ public void testCompileSWTProjectDefault() throws IOException, CoreException { - tagAsSummary("Compile SWT with command line", true); // put in fingerprint + tagAsSummary("Compile SWT with command line", false); // do NOT put in fingerprint String[] sourcePaths = { "Eclipse SWT/win32", "Eclipse SWT/common", diff --git a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceFormatterTests.java b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceFormatterTests.java new file mode 100644 index 0000000000..58e26bd777 --- /dev/null +++ b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceFormatterTests.java @@ -0,0 +1,163 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 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 + *******************************************************************************/ +package org.eclipse.jdt.core.tests.performance; + +import java.io.File; +import java.io.PrintStream; + +import junit.framework.Test; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.formatter.CodeFormatter; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.formatter.DefaultCodeFormatter; + +/** + */ +public class FullSourceWorkspaceFormatterTests extends FullSourceWorkspaceTests { + + // Tests counters + static int TESTS_COUNT = 0; + private final static int WARMUP_COUNT = 5; + static int TESTS_LENGTH; + + // Log file streams + private static PrintStream[] LOG_STREAMS = new PrintStream[DIM_NAMES.length]; + + // Type path + static IPath FORMAT_TYPE_PATH; + static String FORMAT_TYPE_SOURCE; + +/** + * @param name + */ +public FullSourceWorkspaceFormatterTests(String name) { + super(name); +} + +static { +// TESTS_NAMES = new String[] { +// }; +} +public static Test suite() { + Test suite = buildSuite(testClass()); + TESTS_LENGTH = TESTS_COUNT = suite.countTestCases(); + createPrintStream(testClass(), LOG_STREAMS, TESTS_COUNT, null); + return suite; +} + +private static Class testClass() { + return FullSourceWorkspaceFormatterTests.class; +} + +protected void setUp() throws Exception { + super.setUp(); + + // Read big file + System.out.print(" - Read big file source..."); + long start = System.currentTimeMillis(); + FORMAT_TYPE_SOURCE = Util.fileContent(getPluginDirectoryPath()+File.separator+"GenericTypeTest.java"); + System.out.println("("+(System.currentTimeMillis()-start)+"ms)"); +} + +/* (non-Javadoc) + * @see junit.framework.TestCase#tearDown() + */ +protected void tearDown() throws Exception { + + // End of execution => one test less + TESTS_COUNT--; + + // Log perf result + if (LOG_DIR != null) { + logPerfResult(LOG_STREAMS, TESTS_COUNT); + } + + // Print statistics + if (TESTS_COUNT == 0) { +// System.out.println("-------------------------------------"); +// System.out.println("Format performance test statistics:"); +// NumberFormat intFormat = NumberFormat.getIntegerInstance(); +// System.out.println("-------------------------------------\n"); + } + super.tearDown(); +} + +/** + * Format file (Parser.java - 225176 chars) using code formatter default options. + */ +public void testFormatDefault() throws JavaModelException { + tagAsSummary("Format file with default options", false); // do NOT put in fingerprint + + // Warm up + String source = PARSER_WORKING_COPY.getSource(); + int warmup = WARMUP_COUNT; + for (int i=0; i<warmup; i++) { + long start = System.currentTimeMillis(); + new DefaultCodeFormatter().format(CodeFormatter.K_COMPILATION_UNIT, source, 0, source.length(), 0, null); + if (i==0) { + System.out.println(" Time to format file ("+source.length()+" chars) = "+(System.currentTimeMillis()-start)+"ms"); + } + } + + // Measures + resetCounters(); + int measures = MEASURES_COUNT; + for (int i=0; i<measures; i++) { + runGc(); + startMeasuring(); + for (int j=1; j<10; j++) + new DefaultCodeFormatter().format(CodeFormatter.K_COMPILATION_UNIT, source, 0, source.length(), 0, null); + stopMeasuring(); + } + + // Commit + commitMeasurements(); + assertPerformance(); +} + +/** + * Format big file (GenericTypeTest.java - 1297242 chars) using code formatter default options. + */ +public void testFormatDefaultBigFile() { + tagAsSummary("Format big file with default options", false); // do NOT put in fingerprint yet... + + // Warm up + String source = FORMAT_TYPE_SOURCE; + int warmup = WARMUP_COUNT; + for (int i=0; i<warmup; i++) { + long start = System.currentTimeMillis(); + new DefaultCodeFormatter().format(CodeFormatter.K_COMPILATION_UNIT, source, 0, source.length(), 0, null); + if (i==0) { + System.out.println(" Time to format big file ("+source.length()+" chars) = "+(System.currentTimeMillis()-start)+"ms"); + } + } + + // Measures + resetCounters(); + int measures = MEASURES_COUNT; + for (int i=0; i<measures; i++) { + runGc(); + startMeasuring(); + new DefaultCodeFormatter().format(CodeFormatter.K_COMPILATION_UNIT, source, 0, source.length(), 0, null); + stopMeasuring(); + } + + // Commit + commitMeasurements(); + assertPerformance(); +} + +protected void resetCounters() { + // do nothing +} +} diff --git a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java index 90770693e0..5d4ef77461 100644 --- a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java +++ b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceModelTests.java @@ -82,11 +82,7 @@ private static Class testClass() { protected void setUp() throws Exception { super.setUp(); - if (BIG_PROJECT == null) { - setUpBigProject(); - } else if (BIG_PROJECT_TYPE_PATH == null) { - setUpBigProjectInfo(); - } + setUpBigProject(); } private void setUpBigProject() throws CoreException, IOException { try { @@ -137,12 +133,9 @@ private void setUpBigProject() throws CoreException, IOException { } System.out.println("("+(System.currentTimeMillis()-start)+"ms)"); - // Print for log in case of project creation troubles... - System.out.println("("+(System.currentTimeMillis()-start)+"ms)"); - start = System.currentTimeMillis(); - System.out.print(" - Create compilation unit with secondary type..."); - // Add CU with secondary type + System.out.print(" - Create compilation unit with secondary type..."); + start = System.currentTimeMillis(); BIG_PROJECT_TYPE_PATH = new Path("/BigProject/src" + (FOLDERS_COUNT-1) + "/org/eclipse/jdt/core/tests" + (FOLDERS_COUNT-1) + "/performance" + (PACKAGES_COUNT-1) + "/TestBigProject.java"); IFile file = workspaceRoot.getFile(BIG_PROJECT_TYPE_PATH); if (!file.exists()) { @@ -178,16 +171,6 @@ private void setUpBigProject() throws CoreException, IOException { } } -private void setUpBigProjectInfo() { - // Set up type path - BIG_PROJECT_TYPE_PATH = new Path("/BigProject/src" + (FOLDERS_COUNT-1) + "/org/eclipse/jdt/core/tests" + (FOLDERS_COUNT-1) + "/performance" + (PACKAGES_COUNT-1) + "/TestBigProject.java"); - - // Set up working copy - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IWorkspaceRoot workspaceRoot = workspace.getRoot(); - IFile file = workspaceRoot.getFile(BIG_PROJECT_TYPE_PATH); - WORKING_COPY = (ICompilationUnit)JavaCore.create(file); -} /* (non-Javadoc) * @see junit.framework.TestCase#tearDown() */ @@ -632,7 +615,7 @@ public void testPerfReconcile() throws CoreException { * (regression test for bug 135083 RangeUtil#isInInterval(...) takes significant amount of time while editing) */ public void testPerfReconcileBigFileWithSyntaxError() throws JavaModelException { - tagAsSummary("Reconcile editor change on big file with syntax error", true); // put in fingerprint + tagAsSummary("Reconcile editor change on big file with syntax error", false); // do NOT put in fingerprint // build big file contents String method = @@ -802,7 +785,7 @@ public void testSeekPackageFragments() throws CoreException { } public void testCloseProjects() throws JavaModelException { - tagAsSummary("Close all workspace projects", true); // put in fingerprint + tagAsSummary("Close all workspace projects", false); // do NOT put in fingerprint // Warm-up int length=ALL_PROJECTS.length; diff --git a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java index ccc797b0ba..f0576fd8d1 100644 --- a/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java +++ b/org.eclipse.jdt.core.tests.performance/src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java @@ -647,10 +647,9 @@ public abstract class FullSourceWorkspaceTests extends TestCase { int length = ALL_PROJECTS.length; for (int i = 0; i < length; i++) { String projectName = ALL_PROJECTS[i].getElementName(); + if (BIG_PROJECT_NAME.equals(projectName)) continue; // will be set later if (JavaCore.PLUGIN_ID.equals(projectName)) { JDT_CORE_PROJECT = ALL_PROJECTS[i]; - } else if (BIG_PROJECT_NAME.equals(projectName)) { - BIG_PROJECT = (JavaProject) ALL_PROJECTS[i]; // } else if (JUNIT_PROJECT_NAME.equals(projectName)) { // JUNIT_PROJECT = ALL_PROJECTS[i]; } @@ -746,8 +745,8 @@ public abstract class FullSourceWorkspaceTests extends TestCase { if (fingerprint) super.tagAsSummary(shortName, dimensions); } public void startMeasuring() { - super.startMeasuring(); this.startMeasuring = System.currentTimeMillis(); + super.startMeasuring(); } public void stopMeasuring() { super.stopMeasuring(); diff --git a/org.eclipse.jdt.core.tests.performance/test.xml b/org.eclipse.jdt.core.tests.performance/test.xml index c20fc831fe..c619d424b8 100644 --- a/org.eclipse.jdt.core.tests.performance/test.xml +++ b/org.eclipse.jdt.core.tests.performance/test.xml @@ -57,7 +57,7 @@ <property name="data-dir" value="${jdt-core-perf-folder}/data"/> <property name="plugin-name" value="${plugin-name}"/> <property name="classname" value="org.eclipse.jdt.core.tests.performance.AllPerformanceTests"/> - <property name="timeout" value="9000000" /> + <property name="timeout" value="12000000" /> </ant> </target> |