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

Issue 333008: Mac: Implement about:memory. (Closed)

Created:
11 years, 2 months ago by viettrungluu
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

Mac: Implement about:memory. This implements about:memory on Mac. It calls /bin/ps to obtain information about processes (this is Apple's officially supported "API"). Unfortunately, ps provides fairly minimal information (rss and vsize); top is better, but not a stable API -- it has changed greatly between Mac OS 10.5 and 10.6, and moreover the 10.6 version is more limited in its output formatting. BUG=9653 TEST=Go to about:memory under a variety of conditions (with a variety of browsers loaded). Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=31168

Patch Set 1 #

Total comments: 56

Patch Set 2 : Fixed per (re^n-)reviews. #

Total comments: 8

Patch Set 3 : Merged ToT, fixed html file (had swapped values), updated unit test per TVL's comments. #

Patch Set 4 : Merged ToT. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1405 lines, -51 lines) Patch
M base/mac_util.h View 2 1 chunk +8 lines, -0 lines 0 comments Download
M base/mac_util.mm View 2 1 chunk +49 lines, -0 lines 0 comments Download
M base/mac_util_unittest.mm View 1 chunk +44 lines, -0 lines 0 comments Download
M base/process_util.h View 1 2 1 chunk +8 lines, -0 lines 0 comments Download
M base/process_util_posix.cc View 1 2 4 chunks +49 lines, -9 lines 0 comments Download
M base/process_util_unittest.cc View 1 2 1 chunk +45 lines, -0 lines 0 comments Download
M chrome/browser/browser_resources.grd View 1 2 1 chunk +4 lines, -2 lines 0 comments Download
M chrome/browser/memory_details.h View 1 2 2 chunks +14 lines, -0 lines 0 comments Download
M chrome/browser/memory_details.cc View 1 2 2 chunks +30 lines, -25 lines 0 comments Download
A chrome/browser/memory_details_mac.cc View 1 2 1 chunk +226 lines, -0 lines 0 comments Download
A chrome/browser/process_info_snapshot.h View 1 chunk +106 lines, -0 lines 0 comments Download
A chrome/browser/process_info_snapshot_mac.cc View 1 1 chunk +156 lines, -0 lines 0 comments Download
A chrome/browser/process_info_snapshot_mac_unittest.cc View 1 1 chunk +85 lines, -0 lines 0 comments Download
A chrome/browser/resources/about_memory_mac.html View 1 2 1 chunk +577 lines, -0 lines 0 comments Download
M chrome/chrome.gyp View 1 2 3 3 chunks +4 lines, -0 lines 0 comments Download
M chrome/common/temp_scaffolding_stubs.cc View 1 2 1 chunk +0 lines, -15 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
viettrungluu
(Continuing from <http://codereview.chromium.org/173261>.) The unit test current fails under our valgrind.sh due to the --trace-children=yes ...
11 years, 2 months ago (2009-10-23 02:18:15 UTC) #1
viettrungluu
If chrome_tests.py is reflective of how we run valgrind on the buildbots, I think we ...
11 years, 2 months ago (2009-10-23 04:37:58 UTC) #2
TVL
http://codereview.chromium.org/333008/diff/1/7 File chrome/browser/memory_details.h (right): http://codereview.chromium.org/333008/diff/1/7#newcode114 Line 114: // process. Comment what pid is used for ...
11 years, 2 months ago (2009-10-23 16:15:01 UTC) #3
John Grabowski
LGTM from me. Please wait for LGTM from tvl before landing. http://codereview.chromium.org/333008/diff/1/8 File chrome/browser/memory_details_mac.cc (right): ...
11 years, 2 months ago (2009-10-23 16:50:11 UTC) #4
Mark Mentovai
I didn't read the whole thing because I'm developing ADD. http://codereview.chromium.org/333008/diff/1/3 File base/process_util_posix.cc (right): http://codereview.chromium.org/333008/diff/1/3#newcode602 ...
11 years, 2 months ago (2009-10-23 16:52:23 UTC) #5
viettrungluu
I think I've done everything (or at least responded to everything). Please re^{googol}-review. http://codereview.chromium.org/333008/diff/1/3 File ...
11 years, 2 months ago (2009-10-25 23:13:35 UTC) #6
TVL
lg (didn't really look at the html) http://codereview.chromium.org/333008/diff/8001/8004 File base/mac_util_unittest.cc (right): http://codereview.chromium.org/333008/diff/8001/8004#newcode44 Line 44: EXPECT_TRUE(out.empty()); ...
11 years, 1 month ago (2009-10-26 13:41:49 UTC) #7
Mark Mentovai
http://codereview.chromium.org/333008/diff/1/8 File chrome/browser/memory_details_mac.cc (right): http://codereview.chromium.org/333008/diff/1/8#newcode41 Line 41: const char* k_ext = ".app"; viettrungluu wrote: > ...
11 years, 1 month ago (2009-10-26 14:38:22 UTC) #8
viettrungluu
11 years, 1 month ago (2009-11-05 18:52:29 UTC) #9
Sorry for the huge delay. I guess I'll commit it once it's been through the try
servers again.

http://codereview.chromium.org/333008/diff/8001/8004
File base/mac_util_unittest.cc (right):

http://codereview.chromium.org/333008/diff/8001/8004#newcode44
Line 44: EXPECT_TRUE(out.empty());
On 2009/10/26 13:41:49, TVL wrote:
> nit: when using a loop for input, i usually log the loop index to help see
what
> failed.  i.e.- << "loop: " << i

Done.

http://codereview.chromium.org/333008/diff/8001/8004#newcode75
Line 75: };
On 2009/10/26 13:41:49, TVL wrote:
> nit: i usually do these with a struct that has input and output, that way they
> are lined up in the source, so it is a little easier to follow.

Done.

http://codereview.chromium.org/333008/diff/8001/8004#newcode81
Line 81: EXPECT_TRUE(out.value() == expected_outputs[i]);
On 2009/10/26 13:41:49, TVL wrote:
> EXPECT_STREQ/EXPECT_EQ?  (so the values are printed also)

Done.

http://codereview.chromium.org/333008/diff/8001/8006
File base/process_util_posix.cc (right):

http://codereview.chromium.org/333008/diff/8001/8006#newcode605
Line 605: bool success = WaitForExitCode(pid, &exit_code);
On 2009/10/26 13:41:49, TVL wrote:
> fyi - you can actually hang here.  imagine using this call with max_output set
> to something sorta small, but the executable you invoke produces a lot more
> output.  The executable will eventually block because the output pipe is full
> and you aren't reading it any more.  so it won't be able to exit.  (I've hit
> this bug in the past when the thing I invoked suddenly got errors and
generated
> about a meg of output that i wasn't expecting)

Would most things stop on the broken pipe? (Any other cases should be taken care
of by a timeout, which is a TODO below ...).

Powered by Google App Engine
This is Rietveld 408576698