runtime: add memprofile attribution support#1905
Conversation
|
Verification update for commit 622e1e5:\n\n- Root cause: Linux CI could not reliably recover LLGo Go function names from libunwind for memory profile stack attribution; the profile saw frames like |
|
CI update for
At the time of this update, the remaining visible checks are queued macOS jobs; no new failure is showing on the PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Resolved the latest merge conflict with xgo-dev/main (51d665e). The merge keeps main's generic/linkonce and BDWGC MemStats changes while preserving this PR's memprofile attribution instrumentation and heapsampling xfail removal.\n\nLocal verification:\n- go test -timeout 20m ./test/go/memprofile -count=1\n- go test -timeout 20m ./test/go -run 'Test(RuntimeMemProfileAttribution|RuntimeReadMemStatsAfterInitGC)' -count=1\n- (runtime module) go test -timeout 20m ./internal/runtime ./internal/lib/runtime -count=1\n- git diff --check |
|
Added focused coverage for the memprofile attribution instrumentation paths. Changes:
Local verification:
CI note: the previous |
a6f4e51 to
e5ab91c
Compare
e5ab91c to
e6875a7
Compare
| goTyps: pkgTypes, | ||
| goPkg: pkg, | ||
| patches: patches, | ||
| noInlineForMemProfile: packageUsesRuntimeMemProfile(files), |
There was a problem hiding this comment.
这个noinline的决策似乎只影响直接使用了MemProfile的包,间接的堆栈可能还是不准确?inline函数的栈和行号追踪是不是可以考虑像go一样自己建立一个表,在同一个函数内区分出来不同的部分。
There was a problem hiding this comment.
@zhouguangyuan0718 是的,这里是有意的范围控制。
这个 PR 只在直接使用 runtime.MemProfile / MemProfileRate 的包里禁用 inline/tail-call 并加轻量 MemProfileEnter/Exit,目的是稳定当前 heapsampling/MemProfile 的直接归因,同时避免给所有包引入全局 instrumentation 开销。
间接包里的分配目前仍依赖 native stack fallback;如果符号或 inline 信息不足,确实不能保证像 Go 那样还原完整 inline call stack,也不能在同一个函数内区分所有 inlined call site。要做到这一点需要单独的 inline frame / line table 机制,应该放到后续 debug/lineinfo 方向处理,不放进这个 PR 扩大 scope。
e6875a7 to
6bba3b7
Compare
Summary:
Dependency / merge order:
mainand resolve the expected conflicts.runtime/internal/lib/runtime/pprof_runtime_stub_llgo.go,runtime/internal/runtime/memprofile.go,runtime/internal/runtime/z_gc.go, andtest/goroot/xfail.yaml.Tests: