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

Issue 3311028: Implement heap snapshots serialization into JSON. API is designed (Closed)

Created:
10 years, 3 months ago by mnaganov (inactive)
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

Implement heap snapshots serialization into JSON. API is designed to avoid storing serialized snapshot on VM, instead it is emitted using output stream interface. The size of JSON emitted is roughly equal to used heap size (when stored as an ASCII string). Now a whole heap snapshot can be serialized and transmitted outside VM. This makes possible: - implementing non-async UI for heap snapshots inspection; - storing heap snapshots for further inspection; - remote profiling (we can even implement a snapshotting mode where a snapshot isn't even stored in VM, only transmitted -- good for mobile devices); - creating tools for outside heap snapshots processing, e.g. converting to HPROF. Committed: http://code.google.com/p/v8/source/detail?r=5450

Patch Set 1 #

Total comments: 8

Patch Set 2 : Comments addressed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+576 lines, -4 lines) Patch
M include/v8.h View 1 chunk +20 lines, -0 lines 0 comments Download
M include/v8-profiler.h View 1 2 chunks +28 lines, -1 line 0 comments Download
M src/api.cc View 1 1 chunk +17 lines, -0 lines 0 comments Download
M src/profile-generator.h View 1 1 chunk +47 lines, -0 lines 0 comments Download
M src/profile-generator.cc View 1 2 chunks +328 lines, -0 lines 0 comments Download
M src/unicode.h View 2 chunks +3 lines, -3 lines 0 comments Download
M test/cctest/test-heap-profiler.cc View 1 1 chunk +133 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
mnaganov (inactive)
10 years, 3 months ago (2010-09-13 16:54:56 UTC) #1
Søren Thygesen Gjesse
LGTM http://codereview.chromium.org/3311028/diff/1/2 File include/v8-profiler.h (right): http://codereview.chromium.org/3311028/diff/1/2#newcode368 include/v8-profiler.h:368: class V8EXPORT OutputStream { Maybe we should consider ...
10 years, 3 months ago (2010-09-14 09:09:06 UTC) #2
mnaganov (inactive)
10 years, 3 months ago (2010-09-14 11:35:02 UTC) #3
Thanks!

http://codereview.chromium.org/3311028/diff/1/2
File include/v8-profiler.h (right):

http://codereview.chromium.org/3311028/diff/1/2#newcode368
include/v8-profiler.h:368: class V8EXPORT OutputStream {
On 2010/09/14 09:09:07, Søren Gjesse wrote:
> Maybe we should consider moving OutputStream to v8.h at the top level of the
v8
> namespace, as it might be useful for other APIs not related to profiling.

OK, moved into v8.h

http://codereview.chromium.org/3311028/diff/1/2#newcode374
include/v8-profiler.h:374: virtual void WriteAsciiChunk(char* buffer, int
chars_written) = 0;
On 2010/09/14 09:09:07, Søren Gjesse wrote:
> chars_written -> chars?

Changed to WriteAsciiChunk(char* data, int size)

http://codereview.chromium.org/3311028/diff/1/2#newcode377
include/v8-profiler.h:377: void SerializeToJSON(OutputStream* stream, int
chunk_size) const;
On 2010/09/14 09:09:07, Søren Gjesse wrote:
> How about just calling this method Serialize, and have an e Format enum which
> contains kFormatJSON, which could be extended with other formats.
> 
> Also how about moving the selection of chunk_size to the OutputStream (e.g.
> returned by a method GetChunkSize() which could have a default
implementation).

Done and done.

http://codereview.chromium.org/3311028/diff/1/4
File src/profile-generator.cc (right):

http://codereview.chromium.org/3311028/diff/1/4#newcode2190
src/profile-generator.cc:2190: void MaybeWriteChunk() {
On 2010/09/14 09:09:07, Søren Gjesse wrote:
> Maybe have an assert here that chunk_pos_ <= chunk_size_.

Done.

Powered by Google App Engine
This is Rietveld 408576698