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

Unified Diff: include/v8-profiler.h

Issue 3311028: Implement heap snapshots serialization into JSON. API is designed (Closed)
Patch Set: Comments addressed Created 10 years, 3 months 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
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8-profiler.h
diff --git a/include/v8-profiler.h b/include/v8-profiler.h
index dd1b8caf7b52303f906ff7786024410ec4b904b6..27da41822b6df71391f79e86ce6c1a5300aba6b2 100644
--- a/include/v8-profiler.h
+++ b/include/v8-profiler.h
@@ -323,7 +323,10 @@ class V8EXPORT HeapSnapshot {
enum Type {
kFull = 0, // Heap snapshot with all instances and references.
kAggregated = 1 // Snapshot doesn't contain individual heap entries,
- //instead they are grouped by constructor name.
+ // instead they are grouped by constructor name.
+ };
+ enum SerializationFormat {
+ kJSON = 0 // See format description near 'Serialize' method.
};
/** Returns heap snapshot type. */
@@ -343,6 +346,30 @@ class V8EXPORT HeapSnapshot {
* of the same type can be compared.
*/
const HeapSnapshotsDiff* CompareWith(const HeapSnapshot* snapshot) const;
+
+ /**
+ * Prepare a serialized representation of the snapshot. The result
+ * is written into the stream provided in chunks of specified size.
+ * The total length of the serialized snapshot is unknown in
+ * advance, it is can be roughly equal to JS heap size (that means,
+ * it can be really big - tens of megabytes).
+ *
+ * For the JSON format, heap contents are represented as an object
+ * with the following structure:
+ *
+ * {
+ * snapshot: {title: "...", uid: nnn},
+ * nodes: [
+ * meta-info (JSON string),
+ * nodes themselves
+ * ],
+ * strings: [strings]
+ * }
+ *
+ * Outgoing node links are stored after each node. Nodes reference strings
+ * and other nodes by their indexes in corresponding arrays.
+ */
+ void Serialize(OutputStream* stream, SerializationFormat format) const;
};
« no previous file with comments | « include/v8.h ('k') | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698