Chromium Code Reviews

Issue 6052005: Proposal: Use /usr/bin/top in about:memory... (Closed)

Created:
10 years ago by sail
Modified:
9 years, 7 months ago
Reviewers:
Mark Mentovai, viettrungluu
CC:
chromium-reviews, arv (Not doing code reviews), pam+watch_chromium.org, Paweł Hajdan Jr., Nico
Visibility:
Public.

Description

Use /usr/bin/top in about:memory Currently we get memory information for about:memory using /bin/ps. Unfortuantely ps doesn't give us information about shared and private memory. Also, it's total virtual memory value doesn't match Activity Monitor's. This change adds code to get memory information using /usr/bin/top. The new code falls back to ps if there's a parsing error. Once about:memory displays all the information we need there are still a couple of things left to do: - refactor ProcessInfoSnapshot to use ProcessMetrics where possible - do a better job of detecting shared objects between our child processes and show it some how BUG=25454 TEST=Opened about:memory and verified that the values matched those in Activity Monitor. Tested on both 10.6 and 10.5. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=71114

Patch Set 1 #

Total comments: 64

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 5

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 7

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : '' #

Patch Set 10 : '' #

Total comments: 3

Patch Set 11 : '' #

Unified diffs Side-by-side diffs Stats (+430 lines, -55 lines)
M chrome/browser/process_info_snapshot.h View 4 chunks +21 lines, -11 lines 0 comments
M chrome/browser/process_info_snapshot_mac.cc View 6 chunks +331 lines, -36 lines 0 comments
M chrome/browser/process_info_snapshot_mac_unittest.cc View 4 chunks +29 lines, -3 lines 0 comments
M chrome/browser/resources/about_memory_mac.html View 9 chunks +49 lines, -5 lines 0 comments

Messages

Total messages: 19 (0 generated)
sail
10 years ago (2010-12-23 23:53:52 UTC) #1
Mark Mentovai
Overall nice first cut. http://codereview.chromium.org/6052005/diff/1/chrome/browser/process_info_snapshot.h File chrome/browser/process_info_snapshot.h (right): http://codereview.chromium.org/6052005/diff/1/chrome/browser/process_info_snapshot.h#newcode53 chrome/browser/process_info_snapshot.h:53: // We explicitly use uint64_t ...
9 years, 11 months ago (2011-01-04 20:09:30 UTC) #2
sail
I tested this on thakis's 10.5 laptop and it seems to work well. The only ...
9 years, 11 months ago (2011-01-06 00:22:59 UTC) #3
Mark Mentovai
http://codereview.chromium.org/6052005/diff/2002/chrome/browser/process_info_snapshot_mac.cc File chrome/browser/process_info_snapshot_mac.cc (right): http://codereview.chromium.org/6052005/diff/2002/chrome/browser/process_info_snapshot_mac.cc#newcode70 chrome/browser/process_info_snapshot_mac.cc:70: executable_name->resize(end_pos + 1); Don’t you want end_pos - 1? ...
9 years, 11 months ago (2011-01-06 18:56:05 UTC) #4
sail
http://codereview.chromium.org/6052005/diff/2002/chrome/browser/process_info_snapshot_mac.cc File chrome/browser/process_info_snapshot_mac.cc (right): http://codereview.chromium.org/6052005/diff/2002/chrome/browser/process_info_snapshot_mac.cc#newcode70 chrome/browser/process_info_snapshot_mac.cc:70: executable_name->resize(end_pos + 1); > Don’t you want end_pos - ...
9 years, 11 months ago (2011-01-06 19:20:16 UTC) #5
Mark Mentovai
sail@chromium.org wrote: > http://codereview.chromium.org/6052005/diff/2002/chrome/browser/process_info_snapshot_mac.cc#newcode70 > chrome/browser/process_info_snapshot_mac.cc:70: > executable_name->resize(end_pos + 1); >> >> Don’t you want ...
9 years, 11 months ago (2011-01-06 19:24:32 UTC) #6
sail
http://codereview.chromium.org/6052005/diff/1/chrome/browser/resources/about_memory_mac.html File chrome/browser/resources/about_memory_mac.html (right): http://codereview.chromium.org/6052005/diff/1/chrome/browser/resources/about_memory_mac.html#newcode186 chrome/browser/resources/about_memory_mac.html:186: Shared On 2011/01/04 20:09:31, Mark Mentovai wrote: > What ...
9 years, 11 months ago (2011-01-06 19:48:26 UTC) #7
sail
http://codereview.chromium.org/6052005/diff/2002/chrome/browser/process_info_snapshot_mac.cc File chrome/browser/process_info_snapshot_mac.cc (right): http://codereview.chromium.org/6052005/diff/2002/chrome/browser/process_info_snapshot_mac.cc#newcode70 chrome/browser/process_info_snapshot_mac.cc:70: executable_name->resize(end_pos + 1); On 2011/01/06 18:56:06, Mark Mentovai wrote: ...
9 years, 11 months ago (2011-01-06 19:48:50 UTC) #8
Mark Mentovai
LGTM
9 years, 11 months ago (2011-01-06 19:50:38 UTC) #9
sail
Thanks for the review. What do you think of removing the uid vs euid unit ...
9 years, 11 months ago (2011-01-06 21:31:29 UTC) #10
Mark Mentovai
sail@chromium.org wrote: > Thanks for the review. What do you think of removing the uid ...
9 years, 11 months ago (2011-01-06 21:36:56 UTC) #11
Mark Mentovai
http://codereview.chromium.org/6052005/diff/33001/chrome/browser/process_info_snapshot_mac.cc File chrome/browser/process_info_snapshot_mac.cc (right): http://codereview.chromium.org/6052005/diff/33001/chrome/browser/process_info_snapshot_mac.cc#newcode130 chrome/browser/process_info_snapshot_mac.cc:130: argv.push_back("pid=,rss=,vsz="); Why did you take the ruid and uid ...
9 years, 11 months ago (2011-01-06 21:50:04 UTC) #12
sail
http://codereview.chromium.org/6052005/diff/33001/chrome/browser/process_info_snapshot_mac.cc File chrome/browser/process_info_snapshot_mac.cc (right): http://codereview.chromium.org/6052005/diff/33001/chrome/browser/process_info_snapshot_mac.cc#newcode130 chrome/browser/process_info_snapshot_mac.cc:130: argv.push_back("pid=,rss=,vsz="); On 2011/01/06 21:50:04, Mark Mentovai wrote: > Why ...
9 years, 11 months ago (2011-01-06 23:29:20 UTC) #13
Mark Mentovai
>> Why did you take the ruid and uid out for ps? > > I'm ...
9 years, 11 months ago (2011-01-07 18:42:42 UTC) #14
sail
> I found that if the pid doesn’t exist, sysctl will still return 0 > ...
9 years, 11 months ago (2011-01-07 22:20:57 UTC) #15
Mark Mentovai
sail@chromium.org wrote: > So it looks like top is being launched by calling fork() then ...
9 years, 11 months ago (2011-01-07 22:45:28 UTC) #16
sail
> For example, you could use the base::LaunchApp variant that accepts a file_handle_mapping_vector, assign one ...
9 years, 11 months ago (2011-01-11 22:16:33 UTC) #17
Mark Mentovai
LGTM! http://codereview.chromium.org/6052005/diff/52001/chrome/browser/process_info_snapshot_mac_unittest.cc File chrome/browser/process_info_snapshot_mac_unittest.cc (right): http://codereview.chromium.org/6052005/diff/52001/chrome/browser/process_info_snapshot_mac_unittest.cc#newcode96 chrome/browser/process_info_snapshot_mac_unittest.cc:96: // uid this test runs top. top should ...
9 years, 11 months ago (2011-01-11 22:33:07 UTC) #18
sail
9 years, 11 months ago (2011-01-11 22:41:52 UTC) #19
Thanks for the review. Will submit once the try request succeeds.

Powered by Google App Engine