Lines 29-36
Link Here
|
29 |
// Log files |
29 |
// Log files |
30 |
private static PrintStream[] LOG_STREAMS = new PrintStream[LOG_TYPES.length]; |
30 |
private static PrintStream[] LOG_STREAMS = new PrintStream[LOG_TYPES.length]; |
31 |
|
31 |
|
32 |
static int[] COUNTERS = new int[1]; |
|
|
33 |
|
34 |
/** |
32 |
/** |
35 |
* @param name |
33 |
* @param name |
36 |
*/ |
34 |
*/ |
Lines 38-46
Link Here
|
38 |
super(name); |
36 |
super(name); |
39 |
} |
37 |
} |
40 |
|
38 |
|
41 |
// static { |
39 |
static { |
42 |
// TESTS_NAMES = new String[] { "testPerfAllTypes" }; |
40 |
// TESTS_NAMES = new String[] { "testPerfClassWithPotentialSubinterfaces" }; |
43 |
// } |
41 |
} |
44 |
public static Test suite() { |
42 |
public static Test suite() { |
45 |
Test suite = buildSuite(testClass()); |
43 |
Test suite = buildSuite(testClass()); |
46 |
TESTS_COUNT = suite.countTestCases(); |
44 |
TESTS_COUNT = suite.countTestCases(); |
Lines 72-87
Link Here
|
72 |
logPerfResult(LOG_STREAMS, TESTS_COUNT); |
70 |
logPerfResult(LOG_STREAMS, TESTS_COUNT); |
73 |
} |
71 |
} |
74 |
|
72 |
|
75 |
// Print statistics |
|
|
76 |
if (TESTS_COUNT == 0) { |
77 |
// Print statistics |
78 |
System.out.println("-------------------------------------"); |
79 |
System.out.println("Type Hierarchy test statistics:"); |
80 |
NumberFormat intFormat = NumberFormat.getIntegerInstance(); |
81 |
System.out.println(" - "+intFormat.format(COUNTERS[0])+" all types found."); |
82 |
System.out.println("-------------------------------------\n"); |
83 |
} |
84 |
|
85 |
// Call super at the end as it close print streams |
73 |
// Call super at the end as it close print streams |
86 |
super.tearDown(); |
74 |
super.tearDown(); |
87 |
} |
75 |
} |
Lines 121-127
Link Here
|
121 |
commitMeasurements(); |
109 |
commitMeasurements(); |
122 |
assertPerformance(); |
110 |
assertPerformance(); |
123 |
|
111 |
|
124 |
// Store counter |
112 |
// Print statistics |
125 |
COUNTERS[0] = length; |
113 |
if (TESTS_COUNT == 0) { |
|
|
114 |
// Print statistics |
115 |
System.out.println("-------------------------------------"); |
116 |
System.out.println("Type Hierarchy test statistics:"); |
117 |
NumberFormat intFormat = NumberFormat.getIntegerInstance(); |
118 |
System.out.println(" - "+intFormat.format(length)+" all types found."); |
119 |
System.out.println("-------------------------------------\n"); |
120 |
} |
121 |
|
122 |
} |
123 |
|
124 |
/* |
125 |
* A direct subclass of org.eclipse.jface.text.templates.TemplateVariableResolver is called Collection. |
126 |
* Collection is also an interface that is the root of a deep hierarchy in java.util. |
127 |
* This test proves that the interface and all its potential subtypes are not injected while computing |
128 |
* the hierarchy. |
129 |
* (test for bug 108820 Index based type hierarchy should not consider interfaces in index when focus is a class) |
130 |
*/ |
131 |
public void testPerfClassWithPotentialSubinterfaces() throws CoreException { |
132 |
ICompilationUnit unit = getCompilationUnit("org.eclipse.text", "org.eclipse.jface.text.templates", "TemplateVariableResolver.java"); |
133 |
assertNotNull("TemplateVariableResolver not found!", unit); |
134 |
|
135 |
// Warm up |
136 |
IType type = unit.getType("TemplateVariableResolver"); |
137 |
type.newTypeHierarchy(null); |
138 |
|
139 |
// Clean memory |
140 |
runGc(); |
141 |
|
142 |
// Measures |
143 |
for (int i=0; i<MEASURES_COUNT; i++) { |
144 |
startMeasuring(); |
145 |
type.newTypeHierarchy(null); |
146 |
stopMeasuring(); |
147 |
} |
148 |
|
149 |
// Commit |
150 |
commitMeasurements(); |
151 |
assertPerformance(); |
152 |
|
126 |
} |
153 |
} |
|
|
154 |
|
127 |
} |
155 |
} |