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

Unified Diff: chrome/browser/process_info_snapshot.h

Issue 6052005: Proposal: Use /usr/bin/top in about:memory... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/process_info_snapshot.h
===================================================================
--- chrome/browser/process_info_snapshot.h (revision 69842)
+++ chrome/browser/process_info_snapshot.h (working copy)
@@ -17,12 +17,7 @@
// A class which captures process information at a given point in time when its
// |Sample()| method is called. This information can then be probed by PID.
// |Sample()| may take a while to complete, so if calling from the browser
-// process, only do so from the file thread. The current implementation, only on
-// Mac, pulls information from /bin/ps. /usr/bin/top provides much more
-// information about memory, but it has changed greatly from Mac OS 10.5.x to
-// 10.6.x, thereby raising future compatibility concerns. Moreover, the 10.6.x
-// version is less capable in terms of configuring output and its output is
-// harder to parse.
+// process, only do so from the file thread.
// TODO(viettrungluu): This is currently only implemented and used on Mac, so
// things are very Mac-specific. If this is ever implemented for other
// platforms, we should subclass and add opaqueness (probably |ProcInfoEntry|
@@ -36,7 +31,7 @@
// |Sample()| below.
static const size_t kMaxPidListSize;
- // Capture a snapshot of process memory information (by running ps) for the
+ // Capture a snapshot of process memory information for the
// given list of PIDs. Call only from the file thread.
// |pid_list| - list of |ProcessId|s on which to capture information; must
// have no more than |kMaxPidListSize| (above) entries,
@@ -55,9 +50,24 @@
base::ProcessId ppid;
uid_t uid;
uid_t euid;
- size_t rss;
- size_t vsize;
+ // We explicitly use uint64_t instead of size_t incase the process we're
Mark Mentovai 2011/01/04 20:09:31 in case is two words. Avoid using “we,” “our” in
sail 2011/01/06 00:22:59 Done.
+ // measure is 64bit but we're not.
Mark Mentovai 2011/01/04 20:09:31 measure -> measuring 64-bit is not a single word.
sail 2011/01/06 00:22:59 Done.
+ uint64_t rss;
+ uint64_t rshrd;
+ uint64_t rprvt;
+ uint64_t vsize;
std::string command;
+
+ ProcInfoEntry()
+ : pid(0),
Mark Mentovai 2011/01/04 20:09:31 Odd formatting. Initializer lists ought to be inde
sail 2011/01/06 00:22:59 Done.
+ ppid(0),
+ uid(0),
+ euid(0),
+ rss(0),
+ rshrd(0),
+ rprvt(0),
+ vsize(0) {
+ }
};
// Get process information for a given PID.
@@ -85,9 +95,9 @@
// Fills a |WorkingSetKBytes| containing resident private and shared memory,
// as per its definition (or as close as we can manage). In the current (Mac)
// implementation, we map:
- // 0 --> ws_priv,
+ // rprvt --> ws_priv,
// rss --> ws_shareable,
- // 0 --> ws_shared;
+ // rshrd --> ws_shared;
// in about:memory: res:private = ws_priv + ws_shareable - ws_shared,
// res:shared = ws_shared / num_procs,
// res:total = res:private + res:shared.
« no previous file with comments | « no previous file | chrome/browser/process_info_snapshot_mac.cc » ('j') | chrome/browser/process_info_snapshot_mac.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698