Skip to content

Commit fe517ec

Browse files
committed
Add cachegrind support for php-cgi warmups
Cachegrind supports cg_annotate --diff, which makes it much easier to compare the performance of two patches.
1 parent 5586d0c commit fe517ec

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sapi/cgi/cgi_main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS;
9393

9494
#ifdef HAVE_VALGRIND
9595
# include "valgrind/callgrind.h"
96+
# include "valgrind/cachegrind.h"
9697
#endif
9798

9899
#ifndef PHP_WIN32
@@ -2247,8 +2248,10 @@ consult the installation file that came with this distribution, or visit \n\
22472248
#ifdef HAVE_VALGRIND
22482249
if (warmup_repeats > 0) {
22492250
CALLGRIND_STOP_INSTRUMENTATION;
2251+
CACHEGRIND_STOP_INSTRUMENTATION;
22502252
/* We're not interested in measuring startup */
22512253
CALLGRIND_ZERO_STATS;
2254+
/* Zeroing stats is not supported for cachegrind. */
22522255
}
22532256
#endif
22542257
} else {
@@ -2461,6 +2464,7 @@ consult the installation file that came with this distribution, or visit \n\
24612464
#ifdef HAVE_VALGRIND
24622465
if (warmup_repeats == 0) {
24632466
CALLGRIND_START_INSTRUMENTATION;
2467+
CACHEGRIND_START_INSTRUMENTATION;
24642468
}
24652469
#endif
24662470

@@ -2585,6 +2589,7 @@ consult the installation file that came with this distribution, or visit \n\
25852589
#ifdef HAVE_VALGRIND
25862590
/* We're not interested in measuring shutdown */
25872591
CALLGRIND_STOP_INSTRUMENTATION;
2592+
CACHEGRIND_STOP_INSTRUMENTATION;
25882593
#endif
25892594

25902595
if (!fastcgi) {

0 commit comments

Comments
 (0)