Skip to content
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

Support MemoryInfra heap profiling #169

Open
SuibianP opened this issue Nov 26, 2024 · 4 comments
Open

Support MemoryInfra heap profiling #169

SuibianP opened this issue Nov 26, 2024 · 4 comments

Comments

@SuibianP
Copy link

The current allocation tracing in UIforETW cannot track the new PartitionAlloc allocator. Chromium supports heap profiling that optionally dumps with stack traces with MemoryInfra currently.

It would be very useful to capture the memlog tracing category in UIforETW and generate symbolicated flame graphs all within WPA.

@randomascii
Copy link
Contributor

I'm not sure that this is possible. UIforETW can configure ETW providers to emit events. WPA can analyze ETW events from the Windows heap. However I don't think that Chrome's PartitionAlloc allocator emits the right type of events for ETW heap analysis. Or, to put it another way, I don't think that WPA has any support for PartitionAlloc.

@SuibianP
Copy link
Author

SuibianP commented Nov 29, 2024

There is indeed no native support for PartitionAlloc in WPA, but I suppose the heap profiling information readily available in Chrome can be reused, even though it is not a native win32 heap allocation.

  • The stack information is already available inside Chrome MemoryInfra tracing category. In other words, all data is already there in some form.
  • Chrome is already capable of emitting ETW events for tracing categories. This means that the event is in the right form and can be picked up by xperf. (edit: patches to chrome may be needed as per Can ETW capture Task Queue events related to Chrome? #128 (comment))
  • There must already be some sort of internal representation for stack traces in etl files, the way stackwalk events are stored currently. This means that it should be possible for the data to be interpreted by WPA.

The missing piece here seems to be how to get Chrome to emit the allocation events with stack traces as the payload, as noted in #128 (comment). I believe should be possible, but I am not familiar with the capture procedure and might as well be wrong.

@randomascii
Copy link
Contributor

Since the details of how the Windows native heap emits its events are not, to my knowledge, documented, and since the Windows native heap's behavior may not line up with PartitionAlloc's behavior, I suspect that this will actually be a very challenging task.

And, this task seems to primarily be a Chrome task, rather than a UIforETW task. Or perhaps it is a WPA task. Or perhaps both. Filing a Chromium bug and CCing some Microsoft developers is probably the best way to get traction on this. Unfortunately I think that for now this request is out of scope for UIforETW.

@SuibianP
Copy link
Author

SuibianP commented Dec 3, 2024

Thanks for the reply. Created https://crbug.com/381999800. Feel free to chime in there to supplement where I failed to describe correctly enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants