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

Side by Side Diff: base/process_util_linux.cc

Issue 177024: Linux: about:memory (Closed)
Patch Set: ... Created 11 years, 3 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.h ('k') | chrome/browser/browser_about_handler.cc » ('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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 <ctype.h> 7 #include <ctype.h>
8 #include <dirent.h> 8 #include <dirent.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 have_pss = true; 285 have_pss = true;
286 pss_kb += StringToInt(tokenizer.token()) + kPssAdjust; 286 pss_kb += StringToInt(tokenizer.token()) + kPssAdjust;
287 } 287 }
288 state = KEY_NAME; 288 state = KEY_NAME;
289 break; 289 break;
290 } 290 }
291 } 291 }
292 ws_usage->priv = private_kb; 292 ws_usage->priv = private_kb;
293 // Sharable is not calculated, as it does not provide interesting data. 293 // Sharable is not calculated, as it does not provide interesting data.
294 ws_usage->shareable = 0; 294 ws_usage->shareable = 0;
295 if (have_pss) { 295
296 ws_usage->shared = pss_kb - private_kb; 296 ws_usage->shared = 0;
297 } else { 297 if (have_pss)
298 ws_usage->shared = shared_kb; 298 ws_usage->shared = pss_kb;
299 }
300 return true; 299 return true;
301 } 300 }
302 301
303 // To have /proc/self/io file you must enable CONFIG_TASK_IO_ACCOUNTING 302 // To have /proc/self/io file you must enable CONFIG_TASK_IO_ACCOUNTING
304 // in your kernel configuration. 303 // in your kernel configuration.
305 bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const { 304 bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
306 std::string proc_io_contents; 305 std::string proc_io_contents;
307 FilePath io_file("/proc"); 306 FilePath io_file("/proc");
308 io_file = io_file.Append(IntToString(process_)); 307 io_file = io_file.Append(IntToString(process_));
309 io_file = io_file.Append("io"); 308 io_file = io_file.Append("io");
(...skipping 24 matching lines...) Expand all
334 (*io_counters).WriteTransferCount = StringToInt64(tokenizer.token()); 333 (*io_counters).WriteTransferCount = StringToInt64(tokenizer.token());
335 } 334 }
336 state = KEY_NAME; 335 state = KEY_NAME;
337 break; 336 break;
338 } 337 }
339 } 338 }
340 return true; 339 return true;
341 } 340 }
342 341
343 } // namespace base 342 } // namespace base
OLDNEW
« no previous file with comments | « base/process_util.h ('k') | chrome/browser/browser_about_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698