24
24
*/
25
25
package org .graalvm .polybench ;
26
26
27
- import org .graalvm .launcher .AbstractLanguageLauncher ;
28
- import org .graalvm .options .OptionCategory ;
29
- import org .graalvm .polyglot .Context ;
30
- import org .graalvm .polyglot .Engine ;
31
- import org .graalvm .polyglot .Source ;
32
- import org .graalvm .polyglot .Value ;
33
- import org .graalvm .polyglot .proxy .ProxyArray ;
34
-
35
27
import java .io .File ;
36
28
import java .io .IOException ;
37
29
import java .io .InputStream ;
47
39
import java .util .function .BiConsumer ;
48
40
import java .util .logging .Handler ;
49
41
42
+ import org .graalvm .launcher .AbstractLanguageLauncher ;
43
+ import org .graalvm .options .OptionCategory ;
44
+ import org .graalvm .polyglot .Context ;
45
+ import org .graalvm .polyglot .Engine ;
46
+ import org .graalvm .polyglot .Source ;
47
+ import org .graalvm .polyglot .Value ;
48
+ import org .graalvm .polyglot .proxy .ProxyArray ;
49
+
50
50
/**
51
51
* See help.txt.
52
52
*/
@@ -493,13 +493,15 @@ private void runHarness(Context.Builder contextBuilder, boolean evalSourceOnly,
493
493
if (evalSourceOnly ) {
494
494
log ("::: Iterations skipped :::" );
495
495
} else {
496
+ Workload workload = lookup (context , evalResult .languageId , evalResult .value , "run" );
497
+
496
498
log ("::: Running warmup :::" );
497
- repeatIterations (context , evalResult . languageId , evalResult .sourceName , evalResult . value , true , config .warmupIterations );
499
+ repeatIterations (context , workload , evalResult .sourceName , true , config .warmupIterations );
498
500
log ("" );
499
501
500
502
log ("::: Running :::" );
501
503
config .metric .reset ();
502
- repeatIterations (context , evalResult . languageId , evalResult .sourceName , evalResult . value , false , config .iterations );
504
+ repeatIterations (context , workload , evalResult .sourceName , false , config .iterations );
503
505
log ("" );
504
506
}
505
507
@@ -520,8 +522,7 @@ private static String round(double v) {
520
522
return String .format ("%.2f" , v );
521
523
}
522
524
523
- private void repeatIterations (Context context , String languageId , String name , Object evalSource , boolean warmup , int iterations ) {
524
- Workload workload = lookup (context , languageId , evalSource , "run" );
525
+ private void repeatIterations (Context context , Workload workload , String name , boolean warmup , int iterations ) {
525
526
// Enter explicitly to avoid context switches for each iteration.
526
527
context .enter ();
527
528
try {
0 commit comments