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

Side by Side Diff: chrome/browser/task_management/sampling/task_group_sampler.cc

Issue 1845893002: [ChromeOS] Add Swapped Memory to TaskManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_management/sampling/task_group_sampler.h" 5 #include "chrome/browser/task_management/sampling/task_group_sampler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // Memory = working_set.private which is working set minus shareable. This 138 // Memory = working_set.private which is working set minus shareable. This
139 // avoids the unpredictable counting that occurs when calculating memory as 139 // avoids the unpredictable counting that occurs when calculating memory as
140 // working set minus shared (renderer code counted when one tab is open and 140 // working set minus shared (renderer code counted when one tab is open and
141 // not counted when two or more are open) and it is much more efficient to 141 // not counted when two or more are open) and it is much more efficient to
142 // calculate on Windows. 142 // calculate on Windows.
143 memory_usage.physical_bytes = 143 memory_usage.physical_bytes =
144 static_cast<int64_t>(process_metrics_->GetWorkingSetSize()); 144 static_cast<int64_t>(process_metrics_->GetWorkingSetSize());
145 memory_usage.physical_bytes -= 145 memory_usage.physical_bytes -=
146 static_cast<int64_t>(ws_usage.shareable * 1024); 146 static_cast<int64_t>(ws_usage.shareable * 1024);
147 #endif 147 #endif
148 #if defined(OS_CHROMEOS)
149 memory_usage.swapped_bytes = ws_usage.swapped * 1024;
150 #endif
148 } 151 }
149 152
150 return memory_usage; 153 return memory_usage;
151 } 154 }
152 155
153 int TaskGroupSampler::RefreshIdleWakeupsPerSecond() { 156 int TaskGroupSampler::RefreshIdleWakeupsPerSecond() {
154 DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequencedThread()); 157 DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequencedThread());
155 158
156 return process_metrics_->GetIdleWakeupsPerSecond(); 159 return process_metrics_->GetIdleWakeupsPerSecond();
157 } 160 }
158 161
159 #if defined(OS_LINUX) 162 #if defined(OS_LINUX)
160 int TaskGroupSampler::RefreshOpenFdCount() { 163 int TaskGroupSampler::RefreshOpenFdCount() {
161 DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequencedThread()); 164 DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequencedThread());
162 165
163 return process_metrics_->GetOpenFdCount(); 166 return process_metrics_->GetOpenFdCount();
164 } 167 }
165 #endif // defined(OS_LINUX) 168 #endif // defined(OS_LINUX)
166 169
167 bool TaskGroupSampler::RefreshProcessPriority() { 170 bool TaskGroupSampler::RefreshProcessPriority() {
168 DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequencedThread()); 171 DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequencedThread());
169 172
170 return process_.IsProcessBackgrounded(); 173 return process_.IsProcessBackgrounded();
171 } 174 }
172 175
173 } // namespace task_management 176 } // namespace task_management
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698