summaryrefslogtreecommitdiffstats
path: root/chrome/browser/task_manager.cc
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 01:51:32 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 01:51:32 +0000
commit38b48a844731cd10d69d8e99d476e3dac9e81980 (patch)
treeb73cc4ca2cae009276db4305eac119d080f0381f /chrome/browser/task_manager.cc
parent5ecc992a4bf8546b21db89901f2d87e8b4ae1a94 (diff)
downloadchromium_src-38b48a844731cd10d69d8e99d476e3dac9e81980.zip
chromium_src-38b48a844731cd10d69d8e99d476e3dac9e81980.tar.gz
chromium_src-38b48a844731cd10d69d8e99d476e3dac9e81980.tar.bz2
Adds a 'V8' column to task manager to track amount of memory in JavaScript heap
BUG=27226 TEST=open task manager, enable column, compare with V8 heap profiler Review URL: http://codereview.chromium.org/377037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31641 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager.cc')
-rw-r--r--chrome/browser/task_manager.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index 43e2657..090f626 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -196,6 +196,19 @@ std::wstring TaskManagerModel::GetResourceSqliteMemoryUsed(int index) const {
return GetMemCellText(resources_[index]->SqliteMemoryUsedBytes() / 1024);
}
+std::wstring TaskManagerModel::GetResourceV8MemoryAllocatedSize(
+ int index) const {
+ if (!resources_[index]->ReportsV8MemoryStats())
+ return l10n_util::GetString(IDS_TASK_MANAGER_NA_CELL_TEXT);
+ return l10n_util::GetStringF(IDS_TASK_MANAGER_CACHE_SIZE_CELL_TEXT,
+ FormatBytes(resources_[index]->GetV8MemoryAllocated(),
+ DATA_UNITS_KILOBYTE,
+ false),
+ FormatBytes(resources_[index]->GetV8MemoryUsed(),
+ DATA_UNITS_KILOBYTE,
+ false));
+}
+
bool TaskManagerModel::IsResourceFirstInGroup(int index) const {
DCHECK(index < ResourceCount());
TaskManager::Resource* resource = resources_[index];
@@ -621,6 +634,17 @@ void TaskManagerModel::NotifyResourceTypeStats(
}
}
+void TaskManagerModel::NotifyV8HeapStats(base::ProcessId renderer_id,
+ size_t v8_memory_allocated,
+ size_t v8_memory_used) {
+ for (ResourceList::iterator it = resources_.begin();
+ it != resources_.end(); ++it) {
+ if (base::GetProcId((*it)->GetProcess()) == renderer_id) {
+ (*it)->NotifyV8HeapStats(v8_memory_allocated, v8_memory_used);
+ }
+ }
+}
+
void TaskManagerModel::Refresh() {
DCHECK_NE(IDLE, update_state_);