diff options
-rw-r--r-- | chrome/chrome.gyp | 9 | ||||
-rw-r--r-- | chrome/test/memory_test/memory_test.cc | 20 | ||||
-rw-r--r-- | chrome/test/perf/mem_usage.h | 10 | ||||
-rw-r--r-- | chrome/test/perf/mem_usage_linux.cc | 26 | ||||
-rw-r--r-- | chrome/test/perf/mem_usage_mac.cc | 28 | ||||
-rw-r--r-- | chrome/test/perf/mem_usage_win.cc (renamed from chrome/test/perf/mem_usage.cc) | 12 |
6 files changed, 72 insertions, 33 deletions
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 8c8a90f..f68ce72 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -3532,7 +3532,9 @@ 'test/chrome_process_util_win.cc', 'test/in_process_browser_test.cc', 'test/in_process_browser_test.h', - 'test/perf/mem_usage.cc', + 'test/perf/mem_usage_linux.cc', + 'test/perf/mem_usage_mac.cc', + 'test/perf/mem_usage_win.cc', 'test/perf/mem_usage.h', 'test/testing_profile.cc', 'test/testing_profile.h', @@ -3549,11 +3551,6 @@ 'include_dirs': [ 'third_party/wtl/include', ], - }, { # OS != "win" - 'sources!': [ - 'test/perf/mem_usage.cc', - 'test/perf/mem_usage.h', - ], }], ], }, diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc index 2bd8d1b..42f66f4 100644 --- a/chrome/test/memory_test/memory_test.cc +++ b/chrome/test/memory_test/memory_test.cc @@ -18,9 +18,7 @@ #include "chrome/test/automation/window_proxy.h" #include "chrome/test/chrome_process_util.h" #include "chrome/test/ui/ui_test.h" -#if defined(OS_WIN) #include "chrome/test/perf/mem_usage.h" -#endif #include "googleurl/src/gurl.h" #include "net/base/net_util.h" @@ -214,9 +212,7 @@ class MemoryTest : public UITest { // Record the initial CommitCharge. This is a system-wide measurement, // so if other applications are running, they can create variance in this // test. -#if defined(OS_WIN) size_t start_size = GetSystemCommitCharge(); -#endif // Cycle through the URLs. scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); @@ -259,14 +255,9 @@ class MemoryTest : public UITest { // To make these tests more reliable, slowing them down a bit. PlatformThread::Sleep(100); } -#if defined(OS_WIN) - size_t stop_size = GetSystemCommitCharge(); + size_t stop_size = GetSystemCommitCharge(); PrintResults(test_name, stop_size - start_size); -#else - NOTIMPLEMENTED() << "need to map SystemCommitCharge"; - PrintResults(test_name, 0); -#endif } void PrintResults(const char* test_name, size_t commit_size) { @@ -330,8 +321,9 @@ class MemoryTest : public UITest { printf("\n"); FilePath data_dir(user_data_dir()); + int browser_process_pid = 0; #if defined(OS_WIN) - int browser_process_pid = ChromeBrowserProcessId(data_dir); + browser_process_pid = ChromeBrowserProcessId(data_dir); #endif ChromeProcessList chrome_processes(GetRunningChromeProcesses(data_dir)); @@ -342,7 +334,6 @@ class MemoryTest : public UITest { size_t num_chrome_processes = 0; ChromeProcessList::const_iterator it; for (it = chrome_processes.begin(); it != chrome_processes.end(); ++it) { -#if defined(OS_WIN) size_t peak_virtual_size; size_t current_virtual_size; size_t peak_working_set_size; @@ -357,11 +348,6 @@ class MemoryTest : public UITest { working_set_size += current_working_set_size; num_chrome_processes++; } -#else - // TODO(port) - NOTIMPLEMENTED() - << "need to port GetMemoryInfo or map it to the existing primitives"; -#endif } std::string trace_name(test_name); diff --git a/chrome/test/perf/mem_usage.h b/chrome/test/perf/mem_usage.h index 7a8041e..7d76a65 100644 --- a/chrome/test/perf/mem_usage.h +++ b/chrome/test/perf/mem_usage.h @@ -5,6 +5,8 @@ #ifndef CHROME_TEST_PERF_MEM_USAGE_H_ #define CHROME_TEST_PERF_MEM_USAGE_H_ +#include "base/basictypes.h" + // Get memory information for the process with given process ID. // // The Windows psapi provides memory information of a process through structure @@ -29,10 +31,10 @@ // and PeakPagefileUsage (returned by peak_virtual_size), Working Set and // Peak working Set. bool GetMemoryInfo(uint32 process_id, - size_t *peak_virtual_size, - size_t *current_virtual_size, - size_t *peak_working_set_size, - size_t *current_working_set_size); + size_t* peak_virtual_size, + size_t* current_virtual_size, + 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. diff --git a/chrome/test/perf/mem_usage_linux.cc b/chrome/test/perf/mem_usage_linux.cc new file mode 100644 index 0000000..0d3b825 --- /dev/null +++ b/chrome/test/perf/mem_usage_linux.cc @@ -0,0 +1,26 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/test/perf/mem_usage.h" + +#include "base/logging.h" + +bool GetMemoryInfo(uint32 process_id, + size_t* peak_virtual_size, + size_t* current_virtual_size, + size_t* peak_working_set_size, + size_t* current_working_set_size) { + NOTIMPLEMENTED(); + return false; +} + +size_t GetSystemCommitCharge() { + NOTIMPLEMENTED(); + return 0; +} + +void PrintChromeMemoryUsageInfo() { + NOTIMPLEMENTED(); +} + diff --git a/chrome/test/perf/mem_usage_mac.cc b/chrome/test/perf/mem_usage_mac.cc new file mode 100644 index 0000000..671c989 --- /dev/null +++ b/chrome/test/perf/mem_usage_mac.cc @@ -0,0 +1,28 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/test/perf/mem_usage.h" + +#include <mach/mach.h> + +#include "base/logging.h" + +bool GetMemoryInfo(uint32 process_id, + size_t* peak_virtual_size, + size_t* current_virtual_size, + size_t* peak_working_set_size, + size_t* current_working_set_size) { + NOTIMPLEMENTED(); + return false; +} + +size_t GetSystemCommitCharge() { + NOTIMPLEMENTED(); + return 0; +} + +void PrintChromeMemoryUsageInfo() { + NOTIMPLEMENTED(); +} + diff --git a/chrome/test/perf/mem_usage.cc b/chrome/test/perf/mem_usage_win.cc index f67e56a..8759c97 100644 --- a/chrome/test/perf/mem_usage.cc +++ b/chrome/test/perf/mem_usage_win.cc @@ -2,23 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/test/perf/mem_usage.h" + #include <windows.h> #include <psapi.h> -#include "base/basictypes.h" #include "base/file_path.h" #include "base/path_service.h" #include "base/process_util.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/chrome_process_util.h" -#include "chrome/test/perf/mem_usage.h" bool GetMemoryInfo(uint32 process_id, - size_t *peak_virtual_size, - size_t *current_virtual_size, - size_t *peak_working_set_size, - size_t *current_working_set_size) { + size_t* peak_virtual_size, + 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; |