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

OSZAR »