summaryrefslogtreecommitdiffstats
path: root/chrome/test/perf
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-05 01:54:22 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-05 01:54:22 +0000
commit45a50a9165965ed284bb49559bb27fa4b31e56fd (patch)
tree1bb8d7741e12c4f467a5472a69be599bf124b1be /chrome/test/perf
parent75e0513eb4adf3b2f12923eff4898c4f0eadcb53 (diff)
downloadchromium_src-45a50a9165965ed284bb49559bb27fa4b31e56fd.zip
chromium_src-45a50a9165965ed284bb49559bb27fa4b31e56fd.tar.gz
chromium_src-45a50a9165965ed284bb49559bb27fa4b31e56fd.tar.bz2
Initial version of a chrome memory test. This is not yet done; as it still
causes intermittent chrome crashes. But, checking in an intermediate step so that others can play with it too. Basic concept is to have a pre-loaded replay cache with interesting data. This test then drives chrome through automation, simulating a sequence of pages in each tab in a way that a user might also do so; this allows us to get per-tab caching of data similar to what the user would see. Includes a logged in gmail session, a few pages that exercise some javascript, several languages, and pages from many mainstream sites. Lots more can be done with this test going forward; for now the goal is to just measure and track memory. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@361 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/perf')
-rw-r--r--chrome/test/perf/mem_usage.cc16
-rw-r--r--chrome/test/perf/mem_usage.h6
2 files changed, 18 insertions, 4 deletions
diff --git a/chrome/test/perf/mem_usage.cc b/chrome/test/perf/mem_usage.cc
index c8ec78c..369295e 100644
--- a/chrome/test/perf/mem_usage.cc
+++ b/chrome/test/perf/mem_usage.cc
@@ -41,7 +41,6 @@ bool GetMemoryInfo(uint32 process_id,
size_t *current_virtual_size,
size_t *peak_working_set_size,
size_t *current_working_set_size) {
-
if (!peak_virtual_size || !current_virtual_size)
return false;
@@ -67,14 +66,25 @@ bool GetMemoryInfo(uint32 process_id,
return result;
}
+size_t GetSystemCommitCharge() {
+ // Get the System Page Size.
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+
+ PERFORMANCE_INFORMATION info;
+ if (GetPerformanceInfo(&info, sizeof(info)))
+ return info.CommitTotal * system_info.dwPageSize;
+ return -1;
+}
+
void PrintChromeMemoryUsageInfo() {
printf("\n");
- BrowserProcessFilter chrome_filter;
+ BrowserProcessFilter chrome_filter(L"");
process_util::NamedProcessIterator
chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter);
const PROCESSENTRY32* chrome_entry;
- while(chrome_entry = chrome_process_itr.NextProcessEntry()) {
+ while (chrome_entry = chrome_process_itr.NextProcessEntry()) {
uint32 pid = chrome_entry->th32ProcessID;
size_t peak_virtual_size;
size_t current_virtual_size;
diff --git a/chrome/test/perf/mem_usage.h b/chrome/test/perf/mem_usage.h
index 940a0d1..467bb94 100644
--- a/chrome/test/perf/mem_usage.h
+++ b/chrome/test/perf/mem_usage.h
@@ -59,6 +59,10 @@ bool GetMemoryInfo(uint32 process_id,
size_t *peak_working_set_size,
size_t *current_working_set_size);
+// Get the number of bytes currently committed by the system.
+// Returns -1 on failure.
+size_t GetSystemCommitCharge();
+
// Get and print memory usage information for running chrome processes.
void PrintChromeMemoryUsageInfo();
-#endif // CHROME_TEST_PERF_MEM_USAGE_H__
+#endif // CHROME_TEST_PERF_MEM_USAGE_H__