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

Issue 8885025: Pyauto remote inspector module now provides garbage collect functionality. (Closed)

Created:
9 years ago by dennis_jeffrey
Modified:
9 years ago
Reviewers:
Nirnimesh
CC:
chromium-reviews, Nirnimesh, John Grabowski, anantha, dyu1, Paweł Hajdan Jr., dennis_jeffrey, krisr, gregsimon
Visibility:
Public.

Description

Pyauto remote inspector module now provides garbage collect functionality. Previously, the pyauto remote inspector module only allowed a test to take a v8 heap snapshot, as follows: import perf_snapshot snapshotter = perf_snapshot.PerformanceSnapshotter() snapshot = snapshotter.HeapSnapshot() With this change, the same object now provides the GarbageCollect() function, which forces a garbage collection: import perf_snapshot snapshotter = perf_snapshot.PerformanceSnapshotter() snapshot = snapshotter.GarbageCollect() Refactoring of perf_snapshot.py still needs to be done to make it more general (useful for various kinds of interaction with the remote inspector). This CL includes a portion of this refactoring: I separated the _PerformanceSnapshotterThread class into 2 classes: a base class called _RemoteInspectorBaseThread, and a subclass called _PerformanceSnapshotterThread. There is a new subclass called _GarbageCollectThread to implement the garbage collection functionality. In a future CL, I intend to do some additional refactoring of comments and organization of the code, and also change the name of the file itself. BUG=chromium-os:23962 TEST=None Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=114510

Patch Set 1 #

Total comments: 6

Patch Set 2 : Addressed review comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+290 lines, -174 lines) Patch
M chrome/test/pyautolib/perf_snapshot.py View 1 17 chunks +290 lines, -174 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
dennis_jeffrey
9 years ago (2011-12-08 21:11:10 UTC) #1
Nirnimesh
LGTM http://codereview.chromium.org/8885025/diff/1/chrome/test/pyautolib/perf_snapshot.py File chrome/test/pyautolib/perf_snapshot.py (right): http://codereview.chromium.org/8885025/diff/1/chrome/test/pyautolib/perf_snapshot.py#newcode255 chrome/test/pyautolib/perf_snapshot.py:255: self._lock = threading.Lock() use a better var name. ...
9 years ago (2011-12-13 21:21:59 UTC) #2
dennis_jeffrey
9 years ago (2011-12-14 22:38:48 UTC) #3
Thanks!  I synced with tip-of-tree, addressed the comments, and added one more
statement to the run() method in the _GarbageCollectThread class:

self._client.close()

I had forgotten to add that before, and it causes a problem if you force a
garbage collect and then later try to take a heap snapshot (in this case, the
module fails to connect to the remote chrome instance the next time you try to
do so).  Adding that one statement fixes the problem.

I'm going to submit this CL now.

http://codereview.chromium.org/8885025/diff/1/chrome/test/pyautolib/perf_snap...
File chrome/test/pyautolib/perf_snapshot.py (right):

http://codereview.chromium.org/8885025/diff/1/chrome/test/pyautolib/perf_snap...
chrome/test/pyautolib/perf_snapshot.py:255: self._lock = threading.Lock()
On 2011/12/13 21:21:59, Nirnimesh wrote:
> use a better var name.

Done.

http://codereview.chromium.org/8885025/diff/1/chrome/test/pyautolib/perf_snap...
chrome/test/pyautolib/perf_snapshot.py:417: """Initializes a
_RemoteInspectorBaseThread object.
On 2011/12/13 21:21:59, Nirnimesh wrote:
> Keep it short: Initialize.

Done - I made the same change where applicable elsewhere too.

http://codereview.chromium.org/8885025/diff/1/chrome/test/pyautolib/perf_snap...
chrome/test/pyautolib/perf_snapshot.py:422: verbose: A boolean indicating
whether or not to use verbose logging.
On 2011/12/13 21:21:59, Nirnimesh wrote:
> In future this should probably re-use pyauto's verbose flag.

Good point - I added a TODO for that.

Powered by Google App Engine
This is Rietveld 408576698