Background context:go/memory-infra: memory profiling in chrome://tracing
The heap profiler in memory-infra attributes memory allocations to components based on the folder where the tasks are posted from. This is not always accurate since posted from location does not directly relate to the task sometimes. One such case is the mojo services where the tasks are posted always from https://chromium.googlesource.com/chromium/src/+/master/mojo/public/cpp/system/watcher.cc#105 and all services that allocate memory while handling tasks from ipc messages are attributed to "mojo" component. To attribute it right, we need to have the mojo service's name as the component name.
Currently we have a macro in heap profiler to annotate the memory allcoated in a scope to a component name:
TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION.
All the memory allocated in this scope will be attributed to the component in the UI automatically.
A fix for the example above would be adding this macro to Watcher::OnHandleReady:
TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION event(service_name_str);
I am not sure how many other types of message handlers are there in mojo and how do we get the service name.
Comment 1 by mariakho...@chromium.org
, Dec 22 2016Status: Assigned (was: Untriaged)