Major tasks include [but are not limited to]: 1) Expose a UI surface to create dumps. 2) Plumbing for out-of-process profiler for all OSes. 3) Dumping a memlog in a usable format.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/66af016845bb3b464df3dbcedbeaf1a965fd19da commit 66af016845bb3b464df3dbcedbeaf1a965fd19da Author: erikchen <erikchen@chromium.org> Date: Wed Aug 02 19:53:19 2017 Add memlog functionality to dump the memory log to a file. This CL hooks up the plumbing from chrome://memory-internals, so that pressing "dump" causes a message to be sent to the profiling process, with the pid of the process to dump, and a file ScopedHandle ready for writing. For now, the file is always at {USER_DATA_DIR}/memlog_dump, and any existing file is overwitten. Bug: 751302 Change-Id: I1c120aef5c19b67b652aadf2e90c198d577beb7a Reviewed-on: https://chromium-review.googlesource.com/595113 Reviewed-by: Albert J. Wong <ajwong@chromium.org> Reviewed-by: Brett Wilson <brettw@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Erik Chen <erikchen@chromium.org> Cr-Commit-Position: refs/heads/master@{#491473} [modify] https://crrev.com/66af016845bb3b464df3dbcedbeaf1a965fd19da/chrome/browser/ui/webui/memory_internals_ui.cc [modify] https://crrev.com/66af016845bb3b464df3dbcedbeaf1a965fd19da/chrome/common/profiling/memlog.mojom [modify] https://crrev.com/66af016845bb3b464df3dbcedbeaf1a965fd19da/chrome/profiling/allocation_tracker.h [modify] https://crrev.com/66af016845bb3b464df3dbcedbeaf1a965fd19da/chrome/profiling/json_exporter.cc [modify] https://crrev.com/66af016845bb3b464df3dbcedbeaf1a965fd19da/chrome/profiling/json_exporter.h [modify] https://crrev.com/66af016845bb3b464df3dbcedbeaf1a965fd19da/chrome/profiling/memlog_connection_manager.cc [modify] https://crrev.com/66af016845bb3b464df3dbcedbeaf1a965fd19da/chrome/profiling/memlog_connection_manager.h [modify] https://crrev.com/66af016845bb3b464df3dbcedbeaf1a965fd19da/chrome/profiling/memlog_impl.cc [modify] https://crrev.com/66af016845bb3b464df3dbcedbeaf1a965fd19da/chrome/profiling/memlog_impl.h [modify] https://crrev.com/66af016845bb3b464df3dbcedbeaf1a965fd19da/chrome/profiling/memlog_stream_parser.cc [modify] https://crrev.com/66af016845bb3b464df3dbcedbeaf1a965fd19da/chrome/profiling/memlog_stream_parser.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/59d85acb04020ec97ea5b63c8e15fdc77a459e45 commit 59d85acb04020ec97ea5b63c8e15fdc77a459e45 Author: Albert J. Wong <ajwong@chromium.org> Date: Thu Aug 10 00:50:57 2017 Rework communication model for out-of-process heap profiling. Previously, the browser passed a "sender_id" to child processes during startup. The child process would then create a pair of pipes, and send one pipe to the profiling process, along with the "sender_id". This has several flaws: 1) It exposes the profiling process to renderers. 2) It requires the profiling process to trust the "sender_id" sent by the renderer. 3) It requires the renderer to create a PlatformChannelPair, which it cannot do on Windows because of the sandbox. 4) The "sender_id" eventually needs to be mapped back to an actual process. In the new model: 1) Child processes expose a MemlogClient interface. 2) Each child process has an instance of a MemlogClient that listens for a "StartProfiling" request from the browser process. On receiving the request, it begins profiling and sends the data into the handle passed from StartProfiling. 3) The browser process observes creations of all child processes. When a new process is created, the browser process creates a PlatformChannelPair. It passes one pipe to the child via MemlogClient::StartProfiling, and the other to the profiling process via Memlog::AddSender. 4) The browser process also passes the pid of the process to the profiling process. This allows the chrome://memory-internals UI to trigger a dump of the appropriate process. Minor changes include: * Many lifetime semantic improvements. In all child processes, a single MemlogClient [owned by ChromeContentClient] is responsible for owning all profiling-relevant objects. * In the browser process, the MemlogClient in ChromeContentClient does nothing. Instead, ChromeBrowserMainExtraPartsProfiling creates the singleton ProfilingProcessHost, which in turn owns a MemlogClient, which is responsible for all profiling in the process. Yes, this is a second instance of MemlogClient in the browser process. * Removed all code from chrome/common/profiling/memlog_sender.h, which included some duplicate code for connecting to the profiling process, starting profiling in the current process, and a wacky global. * Previously, the "--memlog" switch was not respected. Any binary compiled with enable_oop_heap_profiling would start the profiler. Now, the browser process only creates the ProfilingProcessHost if the "--memlog" switch has been set. Bug: 751302 , 751283 Change-Id: I84c570631ef999f76d3145fe1a9d4387f4d3147d Reviewed-on: https://chromium-review.googlesource.com/602526 Commit-Queue: Albert J. Wong <ajwong@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Albert J. Wong <ajwong@chromium.org> Reviewed-by: Brett Wilson <brettw@chromium.org> Cr-Commit-Position: refs/heads/master@{#493198} [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/browser/chrome_content_browser_client.cc [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/browser/chrome_content_gpu_manifest_overlay.json [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/browser/chrome_content_renderer_manifest_overlay.json [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/browser/chrome_content_utility_manifest_overlay.json [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/browser/profiling_host/BUILD.gn [add] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/browser/profiling_host/chrome_browser_main_extra_parts_profiling.cc [add] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/browser/profiling_host/chrome_browser_main_extra_parts_profiling.h [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/browser/profiling_host/profiling_process_host.cc [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/browser/profiling_host/profiling_process_host.h [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/browser/ui/webui/memory_internals_ui.cc [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/common/chrome_content_client.cc [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/common/chrome_content_client.h [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/common/chrome_switches.cc [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/common/chrome_switches.h [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/common/profiling/BUILD.gn [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/common/profiling/memlog.mojom [add] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/common/profiling/memlog_client.cc [add] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/common/profiling/memlog_client.h [add] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/common/profiling/memlog_client.mojom [delete] https://crrev.com/c81633b02745de3295e97836086dbb7bc3e2f22c/chrome/common/profiling/memlog_sender.cc [delete] https://crrev.com/c81633b02745de3295e97836086dbb7bc3e2f22c/chrome/common/profiling/memlog_sender.h [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/profiling/memlog_connection_manager.cc [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/profiling/memlog_connection_manager.h [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/profiling/memlog_impl.cc [modify] https://crrev.com/59d85acb04020ec97ea5b63c8e15fdc77a459e45/chrome/profiling/memlog_impl.h
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e266c73720424770a2a9001431e5778efb4e7927 commit e266c73720424770a2a9001431e5778efb4e7927 Author: Erik Chen <erikchen@chromium.org> Date: Sat Aug 12 02:27:19 2017 Hook up process memory maps to OOP heap profiling. On memory dump, the profiling service will now communicate with the memory_instrumentation interface on the content_browser service to acquire all process memory maps. The relevant memory maps are then added to the resulting JSON dump. Change-Id: Ide742ae502d59eb6b7f3248085e4065cd42ec825 Bug: 751302 Reviewed-on: https://chromium-review.googlesource.com/602454 Commit-Queue: Erik Chen <erikchen@chromium.org> Reviewed-by: Erik Chen <erikchen@chromium.org> Reviewed-by: Primiano Tucci <primiano@chromium.org> Cr-Commit-Position: refs/heads/master@{#493940} [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/chrome/profiling/BUILD.gn [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/chrome/profiling/DEPS [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/chrome/profiling/json_exporter.cc [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/chrome/profiling/json_exporter.h [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/chrome/profiling/json_exporter_unittest.cc [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/chrome/profiling/memlog_connection_manager.cc [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/chrome/profiling/memlog_connection_manager.h [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/chrome/profiling/memlog_impl.cc [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/chrome/profiling/memlog_impl.h [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/chrome/profiling/profiling_service.h [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_observer.cc [modify] https://crrev.com/e266c73720424770a2a9001431e5778efb4e7927/services/resource_coordinator/public/cpp/memory_instrumentation/tracing_observer.h
Comment 1 by bugdroid1@chromium.org
, Aug 2 2017