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

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

Issue 2865653003: One perf test for windows VirtualQueryEx calls.
Patch Set: add many test cases Created 3 years, 7 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') | no next file » | 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 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return GetProcessIoCounters(process_.Get(), io_counters) != FALSE; 318 return GetProcessIoCounters(process_.Get(), io_counters) != FALSE;
319 } 319 }
320 320
321 ProcessMetrics::ProcessMetrics(ProcessHandle process) 321 ProcessMetrics::ProcessMetrics(ProcessHandle process)
322 : processor_count_(SysInfo::NumberOfProcessors()), last_system_time_(0) { 322 : processor_count_(SysInfo::NumberOfProcessors()), last_system_time_(0) {
323 if (process) { 323 if (process) {
324 HANDLE duplicate_handle; 324 HANDLE duplicate_handle;
325 BOOL result = ::DuplicateHandle(::GetCurrentProcess(), process, 325 BOOL result = ::DuplicateHandle(::GetCurrentProcess(), process,
326 ::GetCurrentProcess(), &duplicate_handle, 326 ::GetCurrentProcess(), &duplicate_handle,
327 PROCESS_QUERY_INFORMATION, FALSE, 0); 327 PROCESS_QUERY_INFORMATION, FALSE, 0);
328 DCHECK(result); 328 DPCHECK(result);
329 process_.Set(duplicate_handle); 329 process_.Set(duplicate_handle);
330 } 330 }
331 } 331 }
332 332
333 size_t GetSystemCommitCharge() { 333 size_t GetSystemCommitCharge() {
334 // Get the System Page Size. 334 // Get the System Page Size.
335 SYSTEM_INFO system_info; 335 SYSTEM_INFO system_info;
336 GetSystemInfo(&system_info); 336 GetSystemInfo(&system_info);
337 337
338 PERFORMANCE_INFORMATION info; 338 PERFORMANCE_INFORMATION info;
(...skipping 22 matching lines...) Expand all
361 361
362 meminfo->total = mem_status.ullTotalPhys / 1024; 362 meminfo->total = mem_status.ullTotalPhys / 1024;
363 meminfo->avail_phys = mem_status.ullAvailPhys / 1024; 363 meminfo->avail_phys = mem_status.ullAvailPhys / 1024;
364 meminfo->swap_total = mem_status.ullTotalPageFile / 1024; 364 meminfo->swap_total = mem_status.ullTotalPageFile / 1024;
365 meminfo->swap_free = mem_status.ullAvailPageFile / 1024; 365 meminfo->swap_free = mem_status.ullAvailPageFile / 1024;
366 366
367 return true; 367 return true;
368 } 368 }
369 369
370 } // namespace base 370 } // namespace base
OLDNEW
« no previous file with comments | « base/process/process_metrics.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698