com php-src: Exclude warm-up requests from callgrind profile.: acinclude.m4 configure.ac sapi/cgi/cgi_main.c
| From: | Dmitry Stogov | Date: | Wed, 31 May 2017 13:16:56 +0000 |
| Subject: | com php-src: Exclude warm-up requests from callgrind profile.: acinclude.m4 configure.ac sapi/cgi/cgi_main.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97969@lists.php.net to get a copy of this message | ||
Commit: fc1ae1d1d3b1752c581e258fd3fcc3a184631baa
Author: Dmitry Stogov <dmitry@zend.com> Wed, 31 May 2017 16:16:56 +0300
Parents: b54e0dc3217a1e0771f2ba7dff9d26974a9f83ef
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fc1ae1d1d3b1752c581e258fd3fcc3a184631baa
Log:
Exclude warm-up requests from callgrind profile.
Changed paths:
M acinclude.m4
M configure.ac
M sapi/cgi/cgi_main.c
Diff:
diff --git a/acinclude.m4 b/acinclude..m4
index bc0e792..07ae363 100644
--- a/acinclude.m4
+++ b/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
+])
diff --git a/configure.ac b/configure.ac
index 598418f..9937a4c 100644
--- a/configure.ac
+++ b/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)
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 2cf1644..8639027 100644
--- a/sapi/cgi/cgi_main.c
+++ b/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);
}
@@ -2668,6 +2677,9 @@ fastcgi_request_done:
#else
time(&start);
#endif
+#ifdef HAVE_VALGRIND
+ CALLGRIND_START_INSTRUMENTATION;
+#endif
}
continue;
} else {