diff options
author | sgk@chromium.org <sgk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-08 06:56:57 +0000 |
---|---|---|
committer | sgk@chromium.org <sgk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-08 06:56:57 +0000 |
commit | d4104109bee8967a047254ec82afa6ee1f70ba86 (patch) | |
tree | 853ff2e3e931c3c3d239268b5f640bd0f9150625 /chrome/renderer/render_thread.cc | |
parent | 9b2a18d8d24244eb1834ce54ac1e82a6dbfc13bc (diff) | |
download | chromium_src-d4104109bee8967a047254ec82afa6ee1f70ba86.zip chromium_src-d4104109bee8967a047254ec82afa6ee1f70ba86.tar.gz chromium_src-d4104109bee8967a047254ec82afa6ee1f70ba86.tar.bz2 |
Display tcmalloc debug output from renderer processes in about:tcmalloc.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/255080
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28384 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_thread.cc')
-rw-r--r-- | chrome/renderer/render_thread.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 09b043a..241ce45 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -12,6 +12,7 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/nullable_string16.h" +#include "base/process_util.h" #include "base/shared_memory.h" #include "base/stats_table.h" #include "base/string_util.h" @@ -277,6 +278,10 @@ void RenderThread::OnControlMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewMsg_SetCacheCapacities, OnSetCacheCapacities) IPC_MESSAGE_HANDLER(ViewMsg_GetRendererHistograms, OnGetRendererHistograms) +#if defined(USE_TCMALLOC) + IPC_MESSAGE_HANDLER(ViewMsg_GetRendererTcmalloc, + OnGetRendererTcmalloc) +#endif IPC_MESSAGE_HANDLER(ViewMsg_GetCacheResourceStats, OnGetCacheResourceStats) IPC_MESSAGE_HANDLER(ViewMsg_UserScripts_UpdatedScripts, @@ -363,6 +368,17 @@ void RenderThread::OnGetRendererHistograms(int sequence_number) { SendHistograms(sequence_number); } +#if defined(USE_TCMALLOC) +void RenderThread::OnGetRendererTcmalloc() { + std::string result; + char buffer[1024 * 32]; + int pid = base::GetCurrentProcId(); + MallocExtension::instance()->GetStats(buffer, sizeof(buffer)); + result.append(buffer); + Send(new ViewHostMsg_RendererTcmalloc(pid, result)); +} +#endif + void RenderThread::InformHostOfCacheStats() { EnsureWebKitInitialized(); WebCache::UsageStats stats; |