From 98947a0beaa29f997e77e010cfaec72666e045e2 Mon Sep 17 00:00:00 2001 From: "erg@chromium.org" Date: Tue, 11 May 2010 17:46:08 +0000 Subject: Speed up the Task Manager on linux. - Unify the calls to get shared memory and private memory. On Linux, these call the same API and on Linux, it takes >10ms to fetch both values each time it is called. - Cache the returned memory values. While sorting the task manager by memory, it would make the expensive memory call for each row on each sort operation. BUG=40033 TEST=Existing task manager tests. Review URL: http://codereview.chromium.org/2047009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46938 0039d316-1c4b-4281-b951-d872f2087c98 --- base/process_util.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'base/process_util.h') diff --git a/base/process_util.h b/base/process_util.h index ec3510a..b8bcfd4 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -481,10 +481,12 @@ class ProcessMetrics { size_t GetWorkingSetSize() const; // Returns the peak working set size, in bytes. size_t GetPeakWorkingSetSize() const; - // Returns private usage, in bytes. Private bytes is the amount - // of memory currently allocated to a process that cannot be shared. - // Note: returns 0 on unsupported OSes: prior to XP SP2. - size_t GetPrivateBytes() const; + // Returns private and sharedusage, in bytes. Private bytes is the amount of + // memory currently allocated to a process that cannot be shared. Returns + // false on platform specific error conditions. Note: |private_bytes| + // returns 0 on unsupported OSes: prior to XP SP2. + bool GetMemoryBytes(size_t* private_bytes, + size_t* shared_bytes); // Fills a CommittedKBytes with both resident and paged // memory usage as per definition of CommittedBytes. void GetCommittedKBytes(CommittedKBytes* usage) const; -- cgit v1.1