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

Side by Side Diff: base/process_util_win.cc

Issue 113217: Add memory stats for linux page cycler. On linux, we collect (Closed)
Patch Set: close process Created 11 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_util_mac.mm ('k') | chrome/chrome.gyp » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_util.h" 5 #include "base/process_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <winternl.h> 8 #include <winternl.h>
9 #include <psapi.h> 9 #include <psapi.h>
10 10
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 513
514 // Returns the current working set size, in bytes. 514 // Returns the current working set size, in bytes.
515 size_t ProcessMetrics::GetWorkingSetSize() const { 515 size_t ProcessMetrics::GetWorkingSetSize() const {
516 PROCESS_MEMORY_COUNTERS pmc; 516 PROCESS_MEMORY_COUNTERS pmc;
517 if (GetProcessMemoryInfo(process_, &pmc, sizeof(pmc))) { 517 if (GetProcessMemoryInfo(process_, &pmc, sizeof(pmc))) {
518 return pmc.WorkingSetSize; 518 return pmc.WorkingSetSize;
519 } 519 }
520 return 0; 520 return 0;
521 } 521 }
522 522
523 // Returns the peak working set size, in bytes.
524 size_t ProcessMetrics::GetPeakWorkingSetSize() const {
525 PROCESS_MEMORY_COUNTERS pmc;
526 if (GetProcessMemoryInfo(process_, &pmc, sizeof(pmc))) {
527 return pmc.PeakWorkingSetSize;
528 }
529 return 0;
530 }
531
523 size_t ProcessMetrics::GetPrivateBytes() const { 532 size_t ProcessMetrics::GetPrivateBytes() const {
524 // PROCESS_MEMORY_COUNTERS_EX is not supported until XP SP2. 533 // PROCESS_MEMORY_COUNTERS_EX is not supported until XP SP2.
525 // GetProcessMemoryInfo() will simply fail on prior OS. So the requested 534 // GetProcessMemoryInfo() will simply fail on prior OS. So the requested
526 // information is simply not available. Hence, we will return 0 on unsupported 535 // information is simply not available. Hence, we will return 0 on unsupported
527 // OSes. Unlike most Win32 API, we don't need to initialize the "cb" member. 536 // OSes. Unlike most Win32 API, we don't need to initialize the "cb" member.
528 PROCESS_MEMORY_COUNTERS_EX pmcx; 537 PROCESS_MEMORY_COUNTERS_EX pmcx;
529 if (GetProcessMemoryInfo(process_, 538 if (GetProcessMemoryInfo(process_,
530 reinterpret_cast<PROCESS_MEMORY_COUNTERS*>(&pmcx), 539 reinterpret_cast<PROCESS_MEMORY_COUNTERS*>(&pmcx),
531 sizeof(pmcx))) { 540 sizeof(pmcx))) {
532 return pmcx.PrivateUsage; 541 return pmcx.PrivateUsage;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 void EnableTerminationOnHeapCorruption() { 766 void EnableTerminationOnHeapCorruption() {
758 // Ignore the result code. Supported on XP SP3 and Vista. 767 // Ignore the result code. Supported on XP SP3 and Vista.
759 HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); 768 HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
760 } 769 }
761 770
762 void RaiseProcessToHighPriority() { 771 void RaiseProcessToHighPriority() {
763 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); 772 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
764 } 773 }
765 774
766 } // namespace base 775 } // namespace base
OLDNEW
« no previous file with comments | « base/process_util_mac.mm ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698