diff options
author | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-07 00:06:09 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-07 00:06:09 +0000 |
commit | 1b24910060de853baf83173faf3c1cab2f4c4617 (patch) | |
tree | 3b60d9bf81c56cea298c16271f637be6d015a1c1 /chrome/test/memory_test/memory_test.cc | |
parent | 7e786822892d2e10c75c3ddc47df057d5fc275c2 (diff) | |
download | chromium_src-1b24910060de853baf83173faf3c1cab2f4c4617.zip chromium_src-1b24910060de853baf83173faf3c1cab2f4c4617.tar.gz chromium_src-1b24910060de853baf83173faf3c1cab2f4c4617.tar.bz2 |
For memory_test:
Change the RESULT output format.
Add an option to collect memory statistics after each navigation.
Fix a type error in Linux CommitCharge calculation.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/376005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31333 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/memory_test/memory_test.cc')
-rw-r--r-- | chrome/test/memory_test/memory_test.cc | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc index 3c55d9a..91042a2 100644 --- a/chrome/test/memory_test/memory_test.cc +++ b/chrome/test/memory_test/memory_test.cc @@ -128,7 +128,8 @@ class MemoryTest : public UITest { // new tab. // <PAUSE> is a special URL that informs the loop to pause before proceeding // to the next URL. - void RunTest(const char* test_name, int num_target_tabs) { + void RunTest(const char* test_name, int num_target_tabs, + bool print_progressive_memory_stats) { std::string* urls; size_t urls_length = GetUrlList(&urls); @@ -142,6 +143,7 @@ class MemoryTest : public UITest { int active_window = 0; // The index of the window we are currently using. scoped_refptr<TabProxy> tab(window->GetActiveTab()); int expected_tab_count = 1; + int navigation_count = 0; for (unsigned counter = 0; counter < urls_length; ++counter) { std::string url = urls[counter]; @@ -219,19 +221,19 @@ class MemoryTest : public UITest { // The automation crashes periodically if we cycle too quickly. // To make these tests more reliable, slowing them down a bit. PlatformThread::Sleep(100); - } - size_t stop_size = GetSystemCommitCharge(); - PrintResults(test_name, stop_size - start_size); - } + if (print_progressive_memory_stats) { + char buf[10]; + snprintf(buf, sizeof(buf), "%d", navigation_count); + size_t cur_size = GetSystemCommitCharge(); + PrintMemoryUsageInfo(test_name, buf, cur_size - start_size); + } - void PrintResults(const char* test_name, size_t commit_size) { - PrintMemoryUsageInfo(test_name); - std::string trace_name(test_name); - trace_name.append("_cc"); + navigation_count++; + } - PrintResult("commit_charge", "", trace_name, - commit_size / 1024, "kb", true /* important */); + size_t stop_size = GetSystemCommitCharge(); + PrintMemoryUsageInfo(test_name, "final", stop_size - start_size); } void PrintIOPerfInfo(const char* test_name) { @@ -291,7 +293,9 @@ class MemoryTest : public UITest { } } - void PrintMemoryUsageInfo(const char* test_name) { + void PrintMemoryUsageInfo(const std::string& test_name, + const std::string& trace_name, + size_t commit_size) { printf("\n"); int browser_process_pid = ChromeBrowserProcessId(user_data_dir_); @@ -332,22 +336,24 @@ class MemoryTest : public UITest { working_set_size += current_working_set_size; } - std::string trace_name(test_name); - PrintResult("vm_final_browser", "", trace_name + "_vm_b", + PrintResult("browser_vm_", test_name, trace_name, browser_virtual_size / 1024, "kb", false /* not important */); - PrintResult("ws_final_browser", "", trace_name + "_ws_b", + PrintResult("browser_ws_", test_name, trace_name, browser_working_set_size / 1024, "kb", false /* not important */); - PrintResult("vm_final_total", "", trace_name + "_vm", + PrintResult("total_vm_", test_name, trace_name, virtual_size / 1024, "kb", false /* not important */); - PrintResult("ws_final_total", "", trace_name + "_ws", + PrintResult("total_ws_", test_name, trace_name, working_set_size / 1024, "kb", true /* important */); - PrintResult("processes", "", trace_name + "_proc", + PrintResult("processes_", test_name, trace_name, chrome_processes.size(), "", false /* not important */); + PrintResult("commit_charge_", test_name, trace_name, + commit_size / 1024, "kb", + true /* important */); } private: @@ -635,20 +641,19 @@ size_t MembusterMemoryTest::urls_length_ = arraysize(MembusterMemoryTest::source_urls_); TEST_F(GeneralMixMemoryTest, SingleTabTest) { - RunTest("1t", 1); + RunTest("1t", 1, false); } TEST_F(GeneralMixMemoryTest, FiveTabTest) { - RunTest("5t", 5); + RunTest("5t", 5, false); } TEST_F(GeneralMixMemoryTest, TwelveTabTest) { - RunTest("12t", 12); + RunTest("12t", 12, false); } -// Commented out until the recorded cache data is added. -//TEST_F(MembusterMemoryTest, Windows) { -// RunTest("membuster", 0); -//} +TEST_F(MembusterMemoryTest, Windows) { + RunTest("membuster", 0, true); +} } // namespace |