@@ -55,7 +55,7 @@ function runSymfonyDemo(bool $jit): array {
5555 cloneRepo ($ dir , 'https://github.com/php/benchmarking-symfony-demo-2.2.3.git ' );
5656 runPhpCommand ([$ dir . '/bin/console ' , 'cache:clear ' ]);
5757 runPhpCommand ([$ dir . '/bin/console ' , 'cache:warmup ' ]);
58- return runValgrindPhpCgiCommand ([$ dir . '/public/index.php ' ], cwd: $ dir , jit: $ jit , warmup: 50 );
58+ return runValgrindPhpCgiCommand ([$ dir . '/public/index.php ' ], cwd: $ dir , jit: $ jit , warmup: 50 , repeat: 50 );
5959}
6060
6161function runWordpress (bool $ jit ): array {
@@ -78,7 +78,7 @@ function runWordpress(bool $jit): array {
7878
7979 // Warmup
8080 runPhpCommand ([$ dir . '/index.php ' ], $ dir );
81- return runValgrindPhpCgiCommand ([$ dir . '/index.php ' ], cwd: $ dir , jit: $ jit , warmup: 50 );
81+ return runValgrindPhpCgiCommand ([$ dir . '/index.php ' ], cwd: $ dir , jit: $ jit , warmup: 50 , repeat: 50 );
8282}
8383
8484function runPhpCommand (array $ args , ?string $ cwd = null ): ProcessResult {
@@ -90,6 +90,7 @@ function runValgrindPhpCgiCommand(
9090 ?string $ cwd = null ,
9191 bool $ jit = false ,
9292 int $ warmup = 0 ,
93+ int $ repeat = 1 ,
9394): array {
9495 global $ phpCgi ;
9596 $ process = runCommand ([
@@ -99,13 +100,17 @@ function runValgrindPhpCgiCommand(
99100 '--callgrind-out-file=/dev/null ' ,
100101 '-- ' ,
101102 $ phpCgi ,
102- '-T ' . ($ warmup ? $ warmup . ', ' : '' ) . ' 1 ' ,
103+ '-T ' . ($ warmup ? $ warmup . ', ' : '' ) . $ repeat ,
103104 '-d max_execution_time=0 ' ,
104105 '-d opcache.enable=1 ' ,
105106 '-d opcache.jit_buffer_size= ' . ($ jit ? '128M ' : '0 ' ),
107+ '-d opcache.validate_timestamps=0 ' ,
106108 ...$ args ,
107109 ]);
108110 $ instructions = extractInstructionsFromValgrindOutput ($ process ->stderr );
111+ if ($ repeat > 1 ) {
112+ $ instructions = gmp_strval (gmp_div_q ($ instructions , $ repeat ));
113+ }
109114 return ['instructions ' => $ instructions ];
110115}
111116
0 commit comments