OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <windows.h> | 5 #include <windows.h> |
6 #include <psapi.h> | 6 #include <psapi.h> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "chrome/common/chrome_constants.h" | 10 #include "chrome/common/chrome_constants.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 PERFORMANCE_INFORMATION info; | 75 PERFORMANCE_INFORMATION info; |
76 if (InternalGetPerformanceInfo(&info, sizeof(info))) | 76 if (InternalGetPerformanceInfo(&info, sizeof(info))) |
77 return info.CommitTotal * system_info.dwPageSize; | 77 return info.CommitTotal * system_info.dwPageSize; |
78 return -1; | 78 return -1; |
79 } | 79 } |
80 | 80 |
81 void PrintChromeMemoryUsageInfo() { | 81 void PrintChromeMemoryUsageInfo() { |
82 printf("\n"); | 82 printf("\n"); |
83 BrowserProcessFilter chrome_filter(L""); | 83 BrowserProcessFilter chrome_filter(L""); |
84 process_util::NamedProcessIterator | 84 base::NamedProcessIterator |
85 chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); | 85 chrome_process_itr(chrome::kBrowserProcessExecutableName, &chrome_filter); |
86 | 86 |
87 const PROCESSENTRY32* chrome_entry; | 87 const PROCESSENTRY32* chrome_entry; |
88 while (chrome_entry = chrome_process_itr.NextProcessEntry()) { | 88 while (chrome_entry = chrome_process_itr.NextProcessEntry()) { |
89 uint32 pid = chrome_entry->th32ProcessID; | 89 uint32 pid = chrome_entry->th32ProcessID; |
90 size_t peak_virtual_size; | 90 size_t peak_virtual_size; |
91 size_t current_virtual_size; | 91 size_t current_virtual_size; |
92 size_t peak_working_set_size; | 92 size_t peak_working_set_size; |
93 size_t current_working_set_size; | 93 size_t current_working_set_size; |
94 if (GetMemoryInfo(pid, &peak_virtual_size, ¤t_virtual_size, | 94 if (GetMemoryInfo(pid, &peak_virtual_size, ¤t_virtual_size, |
95 &peak_working_set_size, ¤t_working_set_size)) { | 95 &peak_working_set_size, ¤t_working_set_size)) { |
96 if (pid == chrome_filter.browser_process_id()) { | 96 if (pid == chrome_filter.browser_process_id()) { |
97 wprintf(L"browser_vm_peak = %d\n", peak_virtual_size); | 97 wprintf(L"browser_vm_peak = %d\n", peak_virtual_size); |
98 wprintf(L"browser_vm_current = %d\n", current_virtual_size); | 98 wprintf(L"browser_vm_current = %d\n", current_virtual_size); |
99 wprintf(L"browser_ws_peak = %d\n", peak_working_set_size); | 99 wprintf(L"browser_ws_peak = %d\n", peak_working_set_size); |
100 wprintf(L"browser_ws_final = %d\n", current_working_set_size); | 100 wprintf(L"browser_ws_final = %d\n", current_working_set_size); |
101 } else { | 101 } else { |
102 wprintf(L"render_vm_peak = %d\n", peak_virtual_size); | 102 wprintf(L"render_vm_peak = %d\n", peak_virtual_size); |
103 wprintf(L"render_vm_current = %d\n", current_virtual_size); | 103 wprintf(L"render_vm_current = %d\n", current_virtual_size); |
104 wprintf(L"render_ws_peak = %d\n", peak_working_set_size); | 104 wprintf(L"render_ws_peak = %d\n", peak_working_set_size); |
105 wprintf(L"render_ws_final = %d\n", current_working_set_size); | 105 wprintf(L"render_ws_final = %d\n", current_working_set_size); |
106 } | 106 } |
107 } | 107 } |
108 }; | 108 }; |
109 } | 109 } |
110 | 110 |
OLD | NEW |