-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[erts] Implement call_memory tracing #6351
Conversation
CT Test Results 3 files 133 suites 44m 44s ⏱️ Results for commit 3a529f8. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
PR looks good. I pushed minor optimizations and some bug fixes in We probably will retarget the PR for master and OTP 26 as it's a new feature. |
Sounds good! I can rebase it on top of There is a (relatively long) discussion thread on the Erlang forums about this implementation. One undecided question was, how to account memory allocation for messages? There are couple of things that I really don't like about my PR.
So I'm wondering whether @garazdawi suggestion to simply skip message memory makes most sense, or, to account for it immediately. |
I fixed that in 8076592. |
Pushed some more fixes for bugs found by our non-jit test runs. And some refactoring. |
About received messages. I think they either should be included when matched (as it is now) or maybe be totally ignored. Another thing to consider is off-heap binaries. Should they be ignored (as now), included or added as a separate accumulator. |
I has the same questions, but haven't decided which is the proper answer. The thing is, in most cases we start looking into process heaps when we get Hence I decided to open this PR and discuss it with the OTP team input. |
Looks great. Please allow me a few more days to test under some load, and with new |
Is it OK if I squash the commits? Or at least the fixups, so the PR will have 2 commits, with the second containing your changes. |
Sure. I would recommend squashing everything into one commit except
|
03480ca
to
8ff193d
Compare
Testing looks good, I tried it with various production workloads, and it works as expected. Now the only decision to make is if it can be in |
Sorry, we don't think this qualify for maint. We try to keep the risk down on maint by not changing core mechanics of the execution environment. For example, the change in stack frame size (BEAM_RETURN_CALL_ACC_TRACE_FRAME_SZ) has triggered some bug related to max_heap_size that I have not completely understood yet. About messages. The call_memory trace is more a measure of how much GC pressure a function contributes, rather than how much memory it consumes. A function producing X amount of immediate garbage per call will yield the same trace stats as another producing X amount of long lived data per call. Therefore I start thinking messages should not be part of it at all. An enqueued message is not caused by the function that happens to execute at that time and to match a message does not contribute to GC pressure as it's already allocated. |
8ff193d
to
d49a168
Compare
Moved to master branch. Completely hiding messages from accounting is just deleting |
I realised that this PR requires a change in the preloaded file (erlang.beam), to add a spec for Is there anything else needed for this PR to be merged? |
d49a168
to
d9c27aa
Compare
@sverker is it possible to add this to OTP-26RC1? I'd love to bring it to our testing too. |
Yes I will try to do that. This PR had some problem causing debug vm to crash in gc, something related to |
Pushed a fixup that avoids the @max-au Are you ok if I squash my commits into your (with you as author). I see no reason with keeping development history with known bugs. |
Please do! Thanks you! |
Late change. We really don't like the |
There is no reason other than for uniformity (with |
Well you could look at my commit and see if I missed something. |
Confirming that the code still works fine on Linux (64 bit) under significant load. I updated #6639 to remove the unneeded mega-words. |
Similar to call_time, erlang:trace_pattern(..., [call_memory]) accumulates memory allocations, allowing for basic heap profiling.
43eea9a
to
3a529f8
Compare
Merged to master (at last). Proposed release note: New trace feature |
Similar to call_time, erlang:trace_pattern(..., [call_memory]) accumulates memory allocations, allowing for basic heap profiling.
Inspired by @garazdawi's prototype discussed on Erlang Forums. This PR implements only the underlying mechanism. Heap profiler itself (
hprof
) is in works here: 62b1846