@@ -35,11 +35,14 @@ public class PerformanceTests extends TestBase
35
35
private final static int PAUSE_TIME = 2000 ; // milliseconds to wait for indexer
36
36
private final static boolean INCLUDE_APT_DISABLED = true ;
37
37
38
- private final static String CMD_PROFILER_PREFIX = "java -jar c:/opt/yourkit-8.0.13/lib/yjp-controller-api-redist.jar localhost 10001" ;
39
- private final static String CMD_START_CPU_PROFILING = CMD_PROFILER_PREFIX + " start-cpu-sampling noj2ee" ;
40
- private final static String CMD_STOP_CPU_PROFILING = CMD_PROFILER_PREFIX + " stop-cpu-profiling" ;
41
- private final static String CMD_PERF_SNAPSHOT = CMD_PROFILER_PREFIX + " capture-performance-snapshot" ;
42
- private final static String CMD_HEAP_SNAPSHOT = CMD_PROFILER_PREFIX + " capture-memory-snapshot" ;
38
+ private final static String JAVA = "java" ;
39
+ private final static String JAR = "-jar" ;
40
+ private final static String YOURKIT_CMD = "c:/opt/yourkit-8.0.13/lib/yjp-controller-api-redist.jar localhost 10001" ;
41
+
42
+ private final static String [] CMD_START_CPU_PROFILING_AS_ARRAY = new String []{JAVA , JAR , YOURKIT_CMD , "start-cpu-sampling noj2ee" };
43
+ private final static String [] CMD_STOP_CPU_PROFILING_AS_ARRAY = new String []{JAVA , JAR , YOURKIT_CMD , "stop-cpu-profiling" };
44
+ private final static String [] CMD_PERF_SNAPSHOT_AS_ARRAY = new String []{JAVA , JAR , YOURKIT_CMD , "capture-performance-snapshot" };
45
+ private final static String [] CMD_HEAP_SNAPSHOT_AS_ARRAY = new String []{JAVA , JAR , YOURKIT_CMD , "capture-memory-snapshot" };
43
46
44
47
public PerformanceTests (String name ) {
45
48
super (name );
@@ -158,14 +161,14 @@ public void testBoringFiles() throws Exception
158
161
if (INCLUDE_APT_DISABLED ) {
159
162
AptConfig .setEnabled (jproj , false );
160
163
startNanos = System .nanoTime ();
161
- run .exec (CMD_START_CPU_PROFILING ).waitFor ();
164
+ run .exec (CMD_START_CPU_PROFILING_AS_ARRAY ).waitFor ();
162
165
fullBuild ( project .getFullPath () );
163
166
if (VERBOSE ) {
164
167
System .out
165
168
.println ("APT disabled: full build took " + ((System .nanoTime () - startNanos ) / 1_000_000L ) + " ms" );
166
169
}
167
- run .exec (CMD_PERF_SNAPSHOT ).waitFor ();
168
- run .exec (CMD_STOP_CPU_PROFILING ).waitFor ();
170
+ run .exec (CMD_PERF_SNAPSHOT_AS_ARRAY ).waitFor ();
171
+ run .exec (CMD_STOP_CPU_PROFILING_AS_ARRAY ).waitFor ();
169
172
expectingNoProblems ();
170
173
}
171
174
@@ -181,7 +184,7 @@ public void testBoringFiles() throws Exception
181
184
System .out .println ("full build took " + ((System .nanoTime () - startNanos ) / 1_000_000L ) + " ms" );
182
185
System .out .println ("Taking heap snapshot" );
183
186
}
184
- run .exec (CMD_HEAP_SNAPSHOT ).waitFor ();
187
+ run .exec (CMD_HEAP_SNAPSHOT_AS_ARRAY ).waitFor ();
185
188
expectingNoProblems ();
186
189
187
190
System .gc ();
@@ -191,13 +194,13 @@ public void testBoringFiles() throws Exception
191
194
startNanos = System .nanoTime ();
192
195
if (VERBOSE )
193
196
System .out .println ("APT enabled: starting full build" );
194
- run .exec (CMD_START_CPU_PROFILING ).waitFor ();
197
+ run .exec (CMD_START_CPU_PROFILING_AS_ARRAY ).waitFor ();
195
198
fullBuild ( project .getFullPath () );
196
199
if (VERBOSE ) {
197
200
System .out .println ("full build took " + ((System .nanoTime () - startNanos ) / 1_000_000L ) + " ms" );
198
201
}
199
- run .exec (CMD_PERF_SNAPSHOT ).waitFor ();
200
- run .exec (CMD_STOP_CPU_PROFILING ).waitFor ();
202
+ run .exec (CMD_PERF_SNAPSHOT_AS_ARRAY ).waitFor ();
203
+ run .exec (CMD_STOP_CPU_PROFILING_AS_ARRAY ).waitFor ();
201
204
expectingNoProblems ();
202
205
203
206
System .gc ();
@@ -207,13 +210,13 @@ public void testBoringFiles() throws Exception
207
210
startNanos = System .nanoTime ();
208
211
if (VERBOSE )
209
212
System .out .println ("APT enabled: starting full build" );
210
- run .exec (CMD_START_CPU_PROFILING ).waitFor ();
213
+ run .exec (CMD_START_CPU_PROFILING_AS_ARRAY ).waitFor ();
211
214
fullBuild ( project .getFullPath () );
212
215
if (VERBOSE ) {
213
216
System .out .println ("full build took " + ((System .nanoTime () - startNanos ) / 1_000_000L ) + " ms" );
214
217
}
215
- run .exec (CMD_PERF_SNAPSHOT ).waitFor ();
216
- run .exec (CMD_STOP_CPU_PROFILING ).waitFor ();
218
+ run .exec (CMD_PERF_SNAPSHOT_AS_ARRAY ).waitFor ();
219
+ run .exec (CMD_STOP_CPU_PROFILING_AS_ARRAY ).waitFor ();
217
220
expectingNoProblems ();
218
221
219
222
// Now delete the project!
@@ -241,13 +244,13 @@ public void _testInterestingFilesWithJ6() throws Exception
241
244
if (INCLUDE_APT_DISABLED ) {
242
245
AptConfig .setEnabled (jproj , false );
243
246
long startNanos = System .nanoTime ();
244
- run .exec (CMD_START_CPU_PROFILING ).waitFor ();
247
+ run .exec (CMD_START_CPU_PROFILING_AS_ARRAY ).waitFor ();
245
248
fullBuild ( project .getFullPath () );
246
249
if (VERBOSE )
247
250
System .out .println (
248
251
"APT disabled: full build took " + ((System .nanoTime () - startNanos ) / 1_000_000L ) + " ms" );
249
- run .exec (CMD_PERF_SNAPSHOT ).waitFor ();
250
- run .exec (CMD_STOP_CPU_PROFILING ).waitFor ();
252
+ run .exec (CMD_PERF_SNAPSHOT_AS_ARRAY ).waitFor ();
253
+ run .exec (CMD_STOP_CPU_PROFILING_AS_ARRAY ).waitFor ();
251
254
expectingNoProblems ();
252
255
}
253
256
@@ -258,12 +261,12 @@ public void _testInterestingFilesWithJ6() throws Exception
258
261
long startNanos = System .nanoTime ();
259
262
if (VERBOSE )
260
263
System .out .println ("APT enabled: starting full build" );
261
- run .exec (CMD_START_CPU_PROFILING ).waitFor ();
264
+ run .exec (CMD_START_CPU_PROFILING_AS_ARRAY ).waitFor ();
262
265
fullBuild ( project .getFullPath () );
263
266
if (VERBOSE )
264
267
System .out .println ("full build took " + ((System .nanoTime () - startNanos ) / 1_000_000L ) + " ms" );
265
- run .exec (CMD_PERF_SNAPSHOT ).waitFor ();
266
- run .exec (CMD_STOP_CPU_PROFILING ).waitFor ();
268
+ run .exec (CMD_PERF_SNAPSHOT_AS_ARRAY ).waitFor ();
269
+ run .exec (CMD_STOP_CPU_PROFILING_AS_ARRAY ).waitFor ();
267
270
expectingNoProblems ();
268
271
269
272
// Now delete the project!
0 commit comments