-
Notifications
You must be signed in to change notification settings - Fork 375
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
[NO-TICKET] Fix profiler inline
helpers not working when optimization disabled
#3856
Conversation
…on disabled **What does this PR do?** This PR makes sure that every `inline` helper in the profile is marked as `static inline`. As documented in <https://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline>: > When a function is both inline and static, if all calls to the function > are integrated into the caller, and the function’s address is never > used, then the function’s own assembler code is never referenced. this is different from just `inline`: > When an inline function is not static, then the compiler must assume > that there may be calls from other source files; since a global > symbol can be defined only once in any program, the function must not > be defined in the other source files, so the calls therein cannot > be integrated. Therefore, a non-static inline function is always > compiled on its own in the usual fashion. In practice, this manifested as errors such as > symbol lookup error: datadog_profiling_native_extension.3.4.0_x86_64-linux.so: > undefined symbol: monotonic_wall_time_now_ns when building Ruby or the profiler with optimization disabled (`-O0`). With this fix, these errors no longer show up when building with optimization disabled. **Motivation:** Avoid runtime failures in the profiler on Ruby builds with optimization disabled / when debugging the profiler. **Additional Notes:** Most of these methods with only `inline` were still unreleased to customers so hopefully nobody was impacted by this issue. For consistency, I've also made sure that all methods are `static inline` as we had a mix of `inline static` as well. **How to test the change?** I was able to trigger the issue by running ``` $ DDTRACE_DEBUG=true bundle exec rake clean compile $ bundle exec rspec spec/datadog/profiling/ ```
This change was a very poor early attempt at working around the `inline` function issue, and is no longer needed (and was not successful anyway).
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3856 +/- ##
==========================================
- Coverage 97.86% 97.85% -0.02%
==========================================
Files 1271 1271
Lines 75975 75975
Branches 3739 3739
==========================================
- Hits 74352 74343 -9
- Misses 1623 1632 +9 ☔ View full report in Codecov by Sentry. |
BenchmarksBenchmark execution time: 2024-08-21 14:07:23 Comparing candidate commit 0ca54ec in PR branch Found 0 performance improvements and 2 performance regressions! Performance is the same for 21 metrics, 2 unstable metrics. scenario:profiler - sample timeline=false
scenario:profiler - stack collector
|
What does this PR do?
This PR makes sure that every
inline
helper in the profile is marked asstatic inline
.As documented in https://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline:
this is different from just
inline
:In practice, this manifested as errors such as
when building Ruby or the profiler with optimization disabled (
-O0
).With this fix, these errors no longer show up when building with optimization disabled.
Motivation:
Avoid runtime failures in the profiler on Ruby builds with optimization disabled / when debugging the profiler.
Additional Notes:
Most of these methods with only
inline
were still unreleased to customers so hopefully nobody was impacted by this issue.For consistency, I've also made sure that all methods are
static inline
as we had a mix ofinline static
as well.How to test the change?
I was able to trigger the issue by running