-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Build: Add build support for profiling. #12373
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
Should this mention in the help message that this is specifically for profiling with Added @theuni as reviewer because of build system change. |
On 2/15/2018 8:14 AM, Wladimir J. van der Laan wrote:
Should this mention in the help message that this is specifically for
profiling with |gprof|? E.g. Valgrind is also used quite frequently for
profiling.
Yes, it should. I will make the change.
Murray
|
configure.ac
Outdated
@@ -1330,6 +1348,7 @@ echo " with bench = $use_bench" | |||
echo " with upnp = $use_upnp" | |||
echo " use asm = $use_asm" | |||
echo " debug enabled = $enable_debug" | |||
echo " profiling enabled = $enable_profiling" |
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.
nit: alignment
configure.ac
Outdated
@@ -224,6 +231,17 @@ AC_ARG_ENABLE([werror], | |||
AC_LANG_PUSH([C++]) | |||
AX_CHECK_COMPILE_FLAG([-Werror],[CXXFLAG_WERROR="-Werror"],[CXXFLAG_WERROR=""]) | |||
|
|||
if test "x$enable_gprof" = xyes; then | |||
LDFLAGS="$LDFLAGS -pg" |
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.
Please use AX_CHECK_LINK_FLAG here to make sure that it actually works. Also, let's stash -pg in PROFILE_LDFLAGS rather than LDFLAGS. Otherwise, the rest of the configure checks will be linked with -pg. So something like:
Something like:
AX_CHECK_LINK_FLAG([[-pg]],[PROFILE_LDFLAGS="$PROFILE_LDFLAGS -pg"],[AC_MSG_ERROR("profiling requested but not available"])
Then the same for CXXFLAGS.
Unsure if this is working with clang; getting some warnings:
Edit: my mistake, clang doesn't accept |
@jamesob The suggestion above should take care of it. |
@theuni If this latest change (or any related assignment to LDFLAGS as was done with CXXFLAGS) occurs later in configure.ac, gprof profiling fails. Perhaps there is some order of arguments issue with ld. |
@murrayn Please try this on top of yours: theuni@bb91da4. Works for me. |
@theuni This doesn't work for me. It compiles, and the binaries run, but if you look at the gprof output, it is empty. My test case: $ make |
@murrayn turns out the problem is that -pg is incompatible with -pie. Could you please give theuni@38450db a try on top of yours? I believe that now accounts for everything. |
Works for me now. |
@murrayn Could you please squash all of our changes into your first commit? |
Thanks for sticking with this! utACK cfaac2a |
cfaac2a Add build support for 'gprof' profiling. (murrayn) Pull request description: Support for profiling build: `./configure --enable-profiling` Tree-SHA512: ea983cfce385f1893bb4ab7f94ac141b7d620951dc430da3bbc92ae1357fb05521eac689216e66dc87040171a8a57e76dd7ad98036e12a2896cfe5ab544347f0
./configure updates Includes code cherry-picked from the following upstream Bitcoin Core PRs: - bitcoin/bitcoin#6748 - bitcoin/bitcoin#12373 - bitcoin/bitcoin#12692 - bitcoin/bitcoin#12901 - bitcoin/bitcoin#13005 - bitcoin/bitcoin#13445 - bitcoin/bitcoin#12686 - bitcoin/bitcoin#16435 Part of #2074.
cfaac2a Add build support for 'gprof' profiling. (murrayn) Pull request description: Support for profiling build: `./configure --enable-profiling` Tree-SHA512: ea983cfce385f1893bb4ab7f94ac141b7d620951dc430da3bbc92ae1357fb05521eac689216e66dc87040171a8a57e76dd7ad98036e12a2896cfe5ab544347f0
cfaac2a Add build support for 'gprof' profiling. (murrayn) Pull request description: Support for profiling build: `./configure --enable-profiling` Tree-SHA512: ea983cfce385f1893bb4ab7f94ac141b7d620951dc430da3bbc92ae1357fb05521eac689216e66dc87040171a8a57e76dd7ad98036e12a2896cfe5ab544347f0
cfaac2a Add build support for 'gprof' profiling. (murrayn) Pull request description: Support for profiling build: `./configure --enable-profiling` Tree-SHA512: ea983cfce385f1893bb4ab7f94ac141b7d620951dc430da3bbc92ae1357fb05521eac689216e66dc87040171a8a57e76dd7ad98036e12a2896cfe5ab544347f0
cfaac2a Add build support for 'gprof' profiling. (murrayn) Pull request description: Support for profiling build: `./configure --enable-profiling` Tree-SHA512: ea983cfce385f1893bb4ab7f94ac141b7d620951dc430da3bbc92ae1357fb05521eac689216e66dc87040171a8a57e76dd7ad98036e12a2896cfe5ab544347f0
cfaac2a Add build support for 'gprof' profiling. (murrayn) Pull request description: Support for profiling build: `./configure --enable-profiling` Tree-SHA512: ea983cfce385f1893bb4ab7f94ac141b7d620951dc430da3bbc92ae1357fb05521eac689216e66dc87040171a8a57e76dd7ad98036e12a2896cfe5ab544347f0
cfaac2a Add build support for 'gprof' profiling. (murrayn) Pull request description: Support for profiling build: `./configure --enable-profiling` Tree-SHA512: ea983cfce385f1893bb4ab7f94ac141b7d620951dc430da3bbc92ae1357fb05521eac689216e66dc87040171a8a57e76dd7ad98036e12a2896cfe5ab544347f0
Support for profiling build:
./configure --enable-profiling