Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: base/process/process_metrics_win.cc

Issue 1181263005: Make task manager memory data more efficient and meaningful. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust high threshold so it works with Dr Memory. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/process/process_metrics.h ('k') | chrome/browser/private_working_set_snapshot.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "base/process/process_metrics.h" 5 #include "base/process/process_metrics.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <psapi.h> 8 #include <psapi.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 static BOOL InternalGetPerformanceInfo( 253 static BOOL InternalGetPerformanceInfo(
254 PPERFORMANCE_INFORMATION pPerformanceInformation, DWORD cb) { 254 PPERFORMANCE_INFORMATION pPerformanceInformation, DWORD cb) {
255 static GetPerformanceInfoFunction GetPerformanceInfo_func = NULL; 255 static GetPerformanceInfoFunction GetPerformanceInfo_func = NULL;
256 if (!GetPerformanceInfo_func) { 256 if (!GetPerformanceInfo_func) {
257 HMODULE psapi_dll = ::GetModuleHandle(kPsapiDllName); 257 HMODULE psapi_dll = ::GetModuleHandle(kPsapiDllName);
258 if (psapi_dll) 258 if (psapi_dll)
259 GetPerformanceInfo_func = reinterpret_cast<GetPerformanceInfoFunction>( 259 GetPerformanceInfo_func = reinterpret_cast<GetPerformanceInfoFunction>(
260 GetProcAddress(psapi_dll, "GetPerformanceInfo")); 260 GetProcAddress(psapi_dll, "GetPerformanceInfo"));
261 261
262 if (!GetPerformanceInfo_func) { 262 if (!GetPerformanceInfo_func) {
263 // The function could be loaded! 263 // The function could not be loaded!
264 memset(pPerformanceInformation, 0, cb); 264 memset(pPerformanceInformation, 0, cb);
265 return FALSE; 265 return FALSE;
266 } 266 }
267 } 267 }
268 return GetPerformanceInfo_func(pPerformanceInformation, cb); 268 return GetPerformanceInfo_func(pPerformanceInformation, cb);
269 } 269 }
270 270
271 size_t GetSystemCommitCharge() { 271 size_t GetSystemCommitCharge() {
272 // Get the System Page Size. 272 // Get the System Page Size.
273 SYSTEM_INFO system_info; 273 SYSTEM_INFO system_info;
274 GetSystemInfo(&system_info); 274 GetSystemInfo(&system_info);
275 275
276 PERFORMANCE_INFORMATION info; 276 PERFORMANCE_INFORMATION info;
277 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { 277 if (!InternalGetPerformanceInfo(&info, sizeof(info))) {
278 DLOG(ERROR) << "Failed to fetch internal performance info."; 278 DLOG(ERROR) << "Failed to fetch internal performance info.";
279 return 0; 279 return 0;
280 } 280 }
281 return (info.CommitTotal * system_info.dwPageSize) / 1024; 281 return (info.CommitTotal * system_info.dwPageSize) / 1024;
282 } 282 }
283 283
284 size_t GetPageSize() { 284 size_t GetPageSize() {
285 return PAGESIZE_KB * 1024; 285 return PAGESIZE_KB * 1024;
286 } 286 }
287 287
288 } // namespace base 288 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_metrics.h ('k') | chrome/browser/private_working_set_snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698