Skip to content

Commit ac1d473

Browse files
committed
Don't profile PHP startup and shutdown in cgi with valgrind
1 parent 825404e commit ac1d473

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

sapi/cgi/cgi_main.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,6 +2219,8 @@ consult the installation file that came with this distribution, or visit \n\
22192219
#ifdef HAVE_VALGRIND
22202220
if (warmup_repeats > 0) {
22212221
CALLGRIND_STOP_INSTRUMENTATION;
2222+
/* We're not interested in measuring startup */
2223+
CALLGRIND_ZERO_STATS;
22222224
}
22232225
#endif
22242226
} else {
@@ -2427,6 +2429,12 @@ consult the installation file that came with this distribution, or visit \n\
24272429
}
24282430
} /* end !cgi && !fastcgi */
24292431

2432+
#ifdef HAVE_VALGRIND
2433+
if (warmup_repeats == 0) {
2434+
CALLGRIND_START_INSTRUMENTATION;
2435+
}
2436+
#endif
2437+
24302438
/* request startup only after we've done all we can to
24312439
* get path_translated */
24322440
if (php_request_startup() == FAILURE) {
@@ -2546,6 +2554,11 @@ consult the installation file that came with this distribution, or visit \n\
25462554
SG(request_info).query_string = NULL;
25472555
}
25482556

2557+
#ifdef HAVE_VALGRIND
2558+
/* We're not interested in measuring shutdown */
2559+
CALLGRIND_STOP_INSTRUMENTATION;
2560+
#endif
2561+
25492562
if (!fastcgi) {
25502563
if (benchmark) {
25512564
if (warmup_repeats) {
@@ -2555,9 +2568,6 @@ consult the installation file that came with this distribution, or visit \n\
25552568
gettimeofday(&start, NULL);
25562569
#else
25572570
time(&start);
2558-
#endif
2559-
#ifdef HAVE_VALGRIND
2560-
CALLGRIND_START_INSTRUMENTATION;
25612571
#endif
25622572
}
25632573
continue;

0 commit comments

Comments
 (0)