google / google/pprof

profile: Support merge of slightly different but similar Profiles.

Open
#147 4 comments 0 reactions 0 assignees View on GitHub
Priority: p3 type: feat
Dominant language
Go
Stars
9.3k
Forks
671
Avg merge
1d 11h
Merged PRs (30d)
10

Description

I want a way to combine memory profiles collected by different languages on the same process. (e.g. Go and C++)

profile.Merge provides merging of multiple profile.Profiles, but the merge operation is allowed only when the Profiles contain the same types and the period type.
Go's and C++'s memory profiles have the same period type, but the sample types are different, so profile.Merge is unhappy about it.

* Go
PeriodType: space bytes
Period: 524288
Samples: alloc_objects/count alloc_space/bytes inuse_objects/count inuse_space/bytes

* C++
PeriodType: space bytes
Period: 2097152
Samples: objects/count space/bytes[dflt]

I see two options:

1) Extend or provide a variation of profile.Merge that accepts slightly different profiles, maps sample types, and outputs the intersection.
a) Must be careful about handling of the different Periods. (may need normalization. I am afraid the current Merge doesn't do anything complex other than choosing max Period and adding up values.)
b) Handling of Duration/Time should be carefully done.
c) Also, it's possible the one profile may include symbolization info while another doesn't. Does the final output have to drop all symbols in this case?

2) Extend the http endpoint or profile output format to include multiple profile proto messages, and let the pprof tool visualize and analyze the multiple profiles separately. For example, layout Go and C++ allocation graphs in separate groups, but in the same svg graph.

If the normalization required by 1) can't be done correctly, I'd prefer the option 2).

@rauls5382 @aalexand

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.