-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add cachegrind support for php-cgi warmups #14952
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fe517ec
to
dc2f12e
Compare
I had to make a small adjustment for when the cachegrind header is not available, which apparently is a thing. |
configure.ac
Outdated
@@ -751,6 +751,10 @@ AS_VAR_IF([PHP_VALGRIND], [no],, | |||
AC_DEFINE([HAVE_VALGRIND], [1], | |||
[Define to 1 if Valgrind is enabled and supported.])])]) | |||
|
|||
if test "$PHP_VALGRIND" = "yes"; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just my 2 cents, might be possible to check it only when valgrind detection is succesful (above) no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. The configure.ac syntax is so confusing to me that I decided to just create a new if. 😅 If Peter prefers refactoring this, I'll go ahead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree. This Autoconf shell-mixed full-of-portability-concerns syntax is so horrible, that it's not something to keep for too long. Hopefully this will be replaced one day with CMake. Another syntax, but just few levels less horrible :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! 🙏 Thank you for all your work!
For the configure.ac part this can be done to wrap it inside a single "if" check (this To check the Valgrind header, also CFLAGS need to be adjusted a bit because the Valgrind headers might need additional include flags. So this will work: diff --git a/configure.ac b/configure.ac
index 3ba5703871..b7c3e2ce78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -745,11 +745,16 @@ PHP_ARG_WITH([valgrind],
[no],
[no])
-AS_VAR_IF([PHP_VALGRIND], [no],,
- [PKG_CHECK_MODULES([VALGRIND], [valgrind],
+AS_VAR_IF([PHP_VALGRIND], [no],, [
+ PKG_CHECK_MODULES([VALGRIND], [valgrind],
[PHP_EVAL_INCLINE([$VALGRIND_CFLAGS])
AC_DEFINE([HAVE_VALGRIND], [1],
- [Define to 1 if Valgrind is enabled and supported.])])])
+ [Define to 1 if Valgrind is enabled and supported.])])
+ save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $VALGRIND_CFLAGS"
+ AC_CHECK_HEADERS([valgrind/cachegrind.h])
+ CFLAGS=$save_CFLAGS
+]) |
Cachegrind supports cg_annotate --diff, which makes it much easier to compare the performance of two patches. Co-authored-by: Peter Kokot <peterkokot@gmail.com>
dc2f12e
to
d05ead6
Compare
Cachegrind supports cg_annotate --diff, which makes it much easier to compare the performance of two patches.