diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-07 00:27:05 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-07 00:27:05 +0000 |
commit | 4d507cb452633af4b5ebc5226839d0fc3e214489 (patch) | |
tree | 6da4d425b76bb32f42fbe704d9a6d5be57f666aa /chrome/test | |
parent | 84bbb2b55d8ae1a517b16cb358803ccf1de745c1 (diff) | |
download | chromium_src-4d507cb452633af4b5ebc5226839d0fc3e214489.zip chromium_src-4d507cb452633af4b5ebc5226839d0fc3e214489.tar.gz chromium_src-4d507cb452633af4b5ebc5226839d0fc3e214489.tar.bz2 |
Revert 31333 - 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
TBR=vandebo@chromium.org
Review URL: http://codereview.chromium.org/374020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r-- | chrome/test/memory_test/memory_test.cc | 55 | ||||
-rw-r--r-- | chrome/test/perf/mem_usage_linux.cc | 2 |
2 files changed, 26 insertions, 31 deletions
diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc index 91042a2..3c55d9a 100644 --- a/chrome/test/memory_test/memory_test.cc +++ b/chrome/test/memory_test/memory_test.cc @@ -128,8 +128,7 @@ 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, - bool print_progressive_memory_stats) { + void RunTest(const char* test_name, int num_target_tabs) { std::string* urls; size_t urls_length = GetUrlList(&urls); @@ -143,7 +142,6 @@ 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]; @@ -221,19 +219,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); - - 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); - } - - navigation_count++; } size_t stop_size = GetSystemCommitCharge(); - PrintMemoryUsageInfo(test_name, "final", stop_size - start_size); + PrintResults(test_name, stop_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"); + + PrintResult("commit_charge", "", trace_name, + commit_size / 1024, "kb", true /* important */); } void PrintIOPerfInfo(const char* test_name) { @@ -293,9 +291,7 @@ class MemoryTest : public UITest { } } - void PrintMemoryUsageInfo(const std::string& test_name, - const std::string& trace_name, - size_t commit_size) { + void PrintMemoryUsageInfo(const char* test_name) { printf("\n"); int browser_process_pid = ChromeBrowserProcessId(user_data_dir_); @@ -336,24 +332,22 @@ class MemoryTest : public UITest { working_set_size += current_working_set_size; } - PrintResult("browser_vm_", test_name, trace_name, + std::string trace_name(test_name); + PrintResult("vm_final_browser", "", trace_name + "_vm_b", browser_virtual_size / 1024, "kb", false /* not important */); - PrintResult("browser_ws_", test_name, trace_name, + PrintResult("ws_final_browser", "", trace_name + "_ws_b", browser_working_set_size / 1024, "kb", false /* not important */); - PrintResult("total_vm_", test_name, trace_name, + PrintResult("vm_final_total", "", trace_name + "_vm", virtual_size / 1024, "kb", false /* not important */); - PrintResult("total_ws_", test_name, trace_name, + PrintResult("ws_final_total", "", trace_name + "_ws", working_set_size / 1024, "kb", true /* important */); - PrintResult("processes_", test_name, trace_name, + PrintResult("processes", "", trace_name + "_proc", chrome_processes.size(), "", false /* not important */); - PrintResult("commit_charge_", test_name, trace_name, - commit_size / 1024, "kb", - true /* important */); } private: @@ -641,19 +635,20 @@ size_t MembusterMemoryTest::urls_length_ = arraysize(MembusterMemoryTest::source_urls_); TEST_F(GeneralMixMemoryTest, SingleTabTest) { - RunTest("1t", 1, false); + RunTest("1t", 1); } TEST_F(GeneralMixMemoryTest, FiveTabTest) { - RunTest("5t", 5, false); + RunTest("5t", 5); } TEST_F(GeneralMixMemoryTest, TwelveTabTest) { - RunTest("12t", 12, false); + RunTest("12t", 12); } -TEST_F(MembusterMemoryTest, Windows) { - RunTest("membuster", 0, true); -} +// Commented out until the recorded cache data is added. +//TEST_F(MembusterMemoryTest, Windows) { +// RunTest("membuster", 0); +//} } // namespace diff --git a/chrome/test/perf/mem_usage_linux.cc b/chrome/test/perf/mem_usage_linux.cc index 35b5773..568b4fc 100644 --- a/chrome/test/perf/mem_usage_linux.cc +++ b/chrome/test/perf/mem_usage_linux.cc @@ -45,7 +45,7 @@ size_t GetSystemCommitCharge() { DCHECK_EQ(meminfo_fields[kMemBuffersIndex-1], "Buffers:"); DCHECK_EQ(meminfo_fields[kMemCacheIndex-1], "Cached:"); - size_t result_in_kb; + int result_in_kb; result_in_kb = StringToInt(meminfo_fields[kMemTotalIndex]); result_in_kb -= StringToInt(meminfo_fields[kMemFreeIndex]); result_in_kb -= StringToInt(meminfo_fields[kMemBuffersIndex]); |