Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's changed
Update
Makefile
and other build scripts to enable frame pointer & re-compile Rust std.Details
The stack backtrace implementation of
pprof-rs
which we currently depends on is based onlibunwind
, which may trigger segmentation faults in some scenarios (especially on ARM architecture).Here are some related issues:
This PR prepares for the introduction of a new version of
pprof-rs
. The newpprof-rs
provides frame-pointer-based stack backtrace.Performance overhead
Enabling the frame pointer will use the
RBP/x29
register to hold the frame address, one less general purpose register means there may be a performance regression.Here is a simple measurement. In general, the frame-pointer-based stack backtrace has no performance regression compared to the original DWARF-based stack backtrace.
In other words, for scenes with CPU Profiling (or Continuous Profiling) enabled, the overall overhead based on frame pointers is much lower than that based on DWARF. But for scenes that don't use profiling, there is a little extra overhead at all times for frame pointers.
Default behavior and manual control
There are now two additional environment variables that control compilation behavior:
PROXY_FRAME_POINTER
andPROXY_BUILD_STD
. We set them all to1
by default in theMakefile
, which means they are enabled by default.If you want to disable frame-pointer, please manually set the environment variable
PROXY_FRAME_POINTER=0 make
(this will cause CPU Profiling to get only the top function and not the full call stack after we upgradepprof-rs
).If you want to avoid recompiling the Rust standard library, please manually set the environment variable
PROXY_BUILD_STD=0 make
(this will lose CPU Profiling samples related to Rust std functions after we upgradepprof-rs
).If you avoid run
make
and just usecargo build
, the frame pointer will not be enabled and std will not be recompiled.Release note