Browse Source

Exclude warm-up requests from callgrind profile.

pull/2484/merge
Dmitry Stogov 9 years ago
parent
commit
fc1ae1d1d3
  1. 20
      acinclude.m4
  2. 2
      configure.ac
  3. 12
      sapi/cgi/cgi_main.c

20
acinclude.m4

@ -3224,3 +3224,23 @@ AC_DEFUN([PHP_CHECK_BUILTIN_SSUBLL_OVERFLOW], [
dnl Load the AX_CHECK_COMPILE_FLAG macro from the autoconf archive.
m4_include([build/ax_check_compile_flag.m4])
dnl PHP_CHECK_VALGRIND
AC_DEFUN([PHP_CHECK_VALGRIND], [
AC_MSG_CHECKING([for valgrind])
SEARCH_PATH="/usr/local /usr"
SEARCH_FOR="/include/valgrind/valgrind.h"
for i in $SEARCH_PATH ; do
if test -r $i/$SEARCH_FOR; then
VALGRIND_DIR=$i
fi
done
if test -z "$VALGRIND_DIR"; then
AC_MSG_RESULT([not found])
else
AC_MSG_RESULT(found in $VALGRIND_DIR)
AC_DEFINE(HAVE_VALGRIND, 1, [ ])
fi
])

2
configure.ac

@ -751,6 +751,8 @@ if test "x$php_crypt_r" = "x1"; then
PHP_CRYPT_R_STYLE
fi
PHP_CHECK_VALGRIND
dnl General settings.
dnl -------------------------------------------------------------------------
PHP_CONFIGURE_PART(General settings)

12
sapi/cgi/cgi_main.c

@ -96,6 +96,10 @@ int __riscosify_control = __RISCOSIFY_STRICT_UNIX_SPECS;
# include "openssl/applink.c"
#endif
#ifdef HAVE_VALGRIND
# include "valgrind/callgrind.h"
#endif
#ifndef PHP_WIN32
/* XXX this will need to change later when threaded fastcgi is implemented. shane */
struct sigaction act, old_term, old_quit, old_int;
@ -2246,6 +2250,11 @@ consult the installation file that came with this distribution, or visit \n\
if (comma) {
warmup_repeats = atoi(php_optarg);
repeats = atoi(comma + 1);
#ifdef HAVE_VALGRIND
if (warmup_repeats > 0) {
CALLGRIND_STOP_INSTRUMENTATION;
}
#endif
} else {
repeats = atoi(php_optarg);
}
@ -2667,6 +2676,9 @@ fastcgi_request_done:
gettimeofday(&start, NULL);
#else
time(&start);
#endif
#ifdef HAVE_VALGRIND
CALLGRIND_START_INSTRUMENTATION;
#endif
}
continue;

Loading…
Cancel
Save