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

Side by Side Diff: chrome/browser/task_manager/task_manager.cc

Issue 15779007: Use totmaps if available on chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review nits Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « base/process/process_metrics_linux.cc ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/task_manager/task_manager.h" 5 #include "chrome/browser/task_manager/task_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/i18n/number_formatting.h" 8 #include "base/i18n/number_formatting.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/prefs/pref_registry_simple.h" 10 #include "base/prefs/pref_registry_simple.h"
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 base::ProcessHandle handle = GetResource(index)->GetProcess(); 579 base::ProcessHandle handle = GetResource(index)->GetProcess();
580 PerProcessValues& values(per_process_cache_[handle]); 580 PerProcessValues& values(per_process_cache_[handle]);
581 581
582 if (!values.is_physical_memory_valid) { 582 if (!values.is_physical_memory_valid) {
583 base::WorkingSetKBytes ws_usage; 583 base::WorkingSetKBytes ws_usage;
584 MetricsMap::const_iterator iter = metrics_map_.find(handle); 584 MetricsMap::const_iterator iter = metrics_map_.find(handle);
585 if (iter == metrics_map_.end() || 585 if (iter == metrics_map_.end() ||
586 !iter->second->GetWorkingSetKBytes(&ws_usage)) 586 !iter->second->GetWorkingSetKBytes(&ws_usage))
587 return false; 587 return false;
588 588
589 values.is_physical_memory_valid = true;
590 #if defined(OS_LINUX)
591 // On Linux private memory is also resident. Just use it.
592 values.physical_memory = ws_usage.priv * 1024;
593 #else
589 // Memory = working_set.private + working_set.shareable. 594 // Memory = working_set.private + working_set.shareable.
590 // We exclude the shared memory. 595 // We exclude the shared memory.
591 values.is_physical_memory_valid = true;
592 values.physical_memory = iter->second->GetWorkingSetSize(); 596 values.physical_memory = iter->second->GetWorkingSetSize();
593 values.physical_memory -= ws_usage.shared * 1024; 597 values.physical_memory -= ws_usage.shared * 1024;
598 #endif
594 } 599 }
595 *result = values.physical_memory; 600 *result = values.physical_memory;
596 return true; 601 return true;
597 } 602 }
598 603
599 void TaskManagerModel::GetGDIHandles(int index, 604 void TaskManagerModel::GetGDIHandles(int index,
600 size_t* current, 605 size_t* current,
601 size_t* peak) const { 606 size_t* peak) const {
602 *current = 0; 607 *current = 0;
603 *peak = 0; 608 *peak = 0;
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 } 1582 }
1578 return count; 1583 return count;
1579 } 1584 }
1580 1585
1581 TaskManager::TaskManager() 1586 TaskManager::TaskManager()
1582 : model_(new TaskManagerModel(this)) { 1587 : model_(new TaskManagerModel(this)) {
1583 } 1588 }
1584 1589
1585 TaskManager::~TaskManager() { 1590 TaskManager::~TaskManager() {
1586 } 1591 }
OLDNEW
« no previous file with comments | « base/process/process_metrics_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698