diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-09 22:44:57 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-09 22:44:57 +0000 |
commit | 6aa9349ef5c1110d9c096945840e6a105e8a8295 (patch) | |
tree | 8afce0e1f3aae77e05105cfbe0d24ea3bdae9106 /chrome/test/perf/mem_usage.cc | |
parent | b61236c6679615af0811d59d130c91397d8c6be7 (diff) | |
download | chromium_src-6aa9349ef5c1110d9c096945840e6a105e8a8295.zip chromium_src-6aa9349ef5c1110d9c096945840e6a105e8a8295.tar.gz chromium_src-6aa9349ef5c1110d9c096945840e6a105e8a8295.tar.bz2 |
Replace chrome_process_filter with chrome_process_util.
- move code only used by tests to chrome/test
- make a better, more portable abstraction
For now, it still only works on Windows. But this is the first step
to porting this part of code.
Patch by phajdan.jr@chromium.org: <http://codereview.chromium.org/54003>
Review URL: http://codereview.chromium.org/67004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/perf/mem_usage.cc')
-rw-r--r-- | chrome/test/perf/mem_usage.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/chrome/test/perf/mem_usage.cc b/chrome/test/perf/mem_usage.cc index 853bfac..f67e56a 100644 --- a/chrome/test/perf/mem_usage.cc +++ b/chrome/test/perf/mem_usage.cc @@ -6,9 +6,12 @@ #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_process_filter.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, @@ -80,20 +83,21 @@ size_t GetSystemCommitCharge() { void PrintChromeMemoryUsageInfo() { printf("\n"); - BrowserProcessFilter chrome_filter(L""); - base::NamedProcessIterator - chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); - const PROCESSENTRY32* chrome_entry; - while (chrome_entry = chrome_process_itr.NextProcessEntry()) { - uint32 pid = chrome_entry->th32ProcessID; + FilePath data_dir; + PathService::Get(chrome::DIR_USER_DATA, &data_dir); + int browser_process_pid = ChromeBrowserProcessId(data_dir); + ChromeProcessList chrome_processes(GetRunningChromeProcesses(data_dir)); + + ChromeProcessList::const_iterator it; + for (it = chrome_processes.begin(); it != chrome_processes.end(); ++it) { size_t peak_virtual_size; size_t current_virtual_size; size_t peak_working_set_size; size_t current_working_set_size; - if (GetMemoryInfo(pid, &peak_virtual_size, ¤t_virtual_size, + if (GetMemoryInfo(*it, &peak_virtual_size, ¤t_virtual_size, &peak_working_set_size, ¤t_working_set_size)) { - if (pid == chrome_filter.browser_process_id()) { + if (*it == browser_process_pid) { wprintf(L"browser_vm_peak = %d\n", peak_virtual_size); wprintf(L"browser_vm_current = %d\n", current_virtual_size); wprintf(L"browser_ws_peak = %d\n", peak_working_set_size); |