@@ -2233,17 +2233,6 @@ consult the installation file that came with this distribution, or visit \n\
22332233 if (comma ) {
22342234 warmup_repeats = atoi (php_optarg );
22352235 repeats = atoi (comma + 1 );
2236- #ifdef HAVE_VALGRIND
2237- if (warmup_repeats > 0 ) {
2238- CALLGRIND_STOP_INSTRUMENTATION ;
2239- /* We're not interested in measuring startup */
2240- CALLGRIND_ZERO_STATS ;
2241- # ifdef HAVE_VALGRIND_CACHEGRIND_H
2242- CACHEGRIND_STOP_INSTRUMENTATION ;
2243- /* Zeroing stats is not supported for cachegrind. */
2244- # endif
2245- }
2246- #endif
22472236 } else {
22482237 repeats = atoi (php_optarg );
22492238 }
@@ -2285,6 +2274,13 @@ consult the installation file that came with this distribution, or visit \n\
22852274 }
22862275#endif
22872276 while (!fastcgi || fcgi_accept_request (request ) >= 0 ) {
2277+ #ifdef HAVE_VALGRIND
2278+ if (benchmark ) {
2279+ /* measure startup and each benchmark run separately */
2280+ CALLGRIND_DUMP_STATS ;
2281+ }
2282+ #endif
2283+
22882284 SG (server_context ) = fastcgi ? (void * )request : (void * ) 1 ;
22892285 init_request_info (request );
22902286
@@ -2443,15 +2439,6 @@ consult the installation file that came with this distribution, or visit \n\
24432439 }
24442440 } /* end !cgi && !fastcgi */
24452441
2446- #ifdef HAVE_VALGRIND
2447- if (warmup_repeats == 0 ) {
2448- CALLGRIND_START_INSTRUMENTATION ;
2449- # ifdef HAVE_VALGRIND_CACHEGRIND_H
2450- CACHEGRIND_START_INSTRUMENTATION ;
2451- # endif
2452- }
2453- #endif
2454-
24552442 /* request startup only after we've done all we can to
24562443 * get path_translated */
24572444 if (php_request_startup () == FAILURE ) {
@@ -2570,14 +2557,6 @@ consult the installation file that came with this distribution, or visit \n\
25702557 SG (request_info ).query_string = NULL ;
25712558 }
25722559
2573- #ifdef HAVE_VALGRIND
2574- /* We're not interested in measuring shutdown */
2575- CALLGRIND_STOP_INSTRUMENTATION ;
2576- # ifdef HAVE_VALGRIND_CACHEGRIND_H
2577- CACHEGRIND_STOP_INSTRUMENTATION ;
2578- # endif
2579- #endif
2580-
25812560 if (!fastcgi ) {
25822561 if (benchmark ) {
25832562 if (warmup_repeats ) {
@@ -2605,6 +2584,12 @@ consult the installation file that came with this distribution, or visit \n\
26052584 script_file = NULL ;
26062585 goto do_repeat ;
26072586 }
2587+
2588+ #ifdef HAVE_VALGRIND
2589+ /* measure shutdown separately */
2590+ CALLGRIND_DUMP_STATS ;
2591+ #endif
2592+
26082593 break ;
26092594 }
26102595
0 commit comments