summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/test/memory_test/memory_test.cc55
-rw-r--r--chrome/test/perf/mem_usage_linux.cc2
2 files changed, 31 insertions, 26 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
diff --git a/chrome/test/perf/mem_usage_linux.cc b/chrome/test/perf/mem_usage_linux.cc
index 568b4fc..35b5773 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:");
- int result_in_kb;
+ size_t result_in_kb;
result_in_kb = StringToInt(meminfo_fields[kMemTotalIndex]);
result_in_kb -= StringToInt(meminfo_fields[kMemFreeIndex]);
result_in_kb -= StringToInt(meminfo_fields[kMemBuffersIndex]);