tree: 0bb5c24d8de88742926e669914846fb58a54d034 [path history] [tgz]
  1. BUILD.gn
  2. DEPS
  3. OWNERS
  4. README.md
  5. address.h
  6. allocation_event.cc
  7. allocation_event.h
  8. allocation_tracker.cc
  9. allocation_tracker.h
  10. backtrace.cc
  11. backtrace.h
  12. backtrace_storage.cc
  13. backtrace_storage.h
  14. backtrace_storage_unittest.cc
  15. json_exporter.cc
  16. json_exporter.h
  17. json_exporter_unittest.cc
  18. memlog_connection_manager.cc
  19. memlog_connection_manager.h
  20. memlog_impl.cc
  21. memlog_impl.h
  22. memlog_receiver.h
  23. memlog_receiver_pipe.cc
  24. memlog_receiver_pipe.h
  25. memlog_receiver_pipe_posix.cc
  26. memlog_receiver_pipe_posix.h
  27. memlog_receiver_pipe_win.cc
  28. memlog_receiver_pipe_win.h
  29. memlog_stream_parser.cc
  30. memlog_stream_parser.h
  31. memlog_stream_parser_unittest.cc
  32. memlog_stream_receiver.h
  33. profiling_browsertest.cc
  34. profiling_manifest.json
  35. profiling_service.cc
  36. profiling_service.h
chrome/profiling/README.md

chrome/profiling

This document describes the architecture for the profiling process, which tracks memory allocations in other processes.

Design doc: https://docs.google.com/document/d/1eRAgOFgHwYEPge8G1_5UEvu8TJs5VkYCxd6aFU8AIKY

How To Enable Out of Process Heap Profiling

On Windows, build a static, release binary.

When starting Chrome, pass the command line flag --memlog=browser to profile just the browser process, or --memlog=all to profile all processes. Navigate to chrome://memory-internals, and press the “Dump” button to trigger a memory dump for a given process. This creates a dump called memlog_dump.json.gz in the profile directory.

The --memlog flag is also exposed in chrome://flags/#memlog

Communication Model

When profiling is enabled, the browser process will spawn the profiling service. The services lives in a sandboxed, utility process, and its interface is at chrome/common/profiling/memlog.mojom.

All other processes, including the browser process, are MemlogClients. See memlog_client.mojom. Depending on the profiling mode, the browser process will start profiling for just itself [--memlog=browser] , or itself and all child processes [--memlog=all].

The browser process creates a pair of pipes for each MemlogClient. The sending pipe is sent to the MemlogClient, and the receiving pipe is sent to the profiling service. Each MemlogClient then sends memory allocation information via its endpoint to the profiling service.

Code Locations

//chrome/common/profiling - Logic for MemlogClient. //chrome/browser/profiling_host - Logic in browser process for starting profiling service, and connecting MemlogClients to the profiling service. //chrome/profiling - Profiling service.