v8  3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HeapSnapshot Class Reference

#include <v8-profiler.h>

Public Types

enum  SerializationFormat { kJSON = 0 }
 

Public Member Functions

unsigned GetUid () const
 
Handle< StringGetTitle () const
 
const HeapGraphNodeGetRoot () const
 
const HeapGraphNodeGetNodeById (SnapshotObjectId id) const
 
int GetNodesCount () const
 
const HeapGraphNodeGetNode (int index) const
 
SnapshotObjectId GetMaxSnapshotJSObjectId () const
 
void Delete ()
 
void Serialize (OutputStream *stream, SerializationFormat format) const
 

Detailed Description

HeapSnapshots record the state of the JS heap at some moment.

Definition at line 314 of file v8-profiler.h.

Member Enumeration Documentation

Enumerator
kJSON 

Definition at line 316 of file v8-profiler.h.

Member Function Documentation

void Delete ( )

Deletes the snapshot and removes it from HeapProfiler's list. All pointers to nodes, edges and paths previously returned become invalid.

Definition at line 7272 of file api.cc.

References HeapProfiler::DeleteAllSnapshots(), HeapProfiler::GetSnapshotsCount(), and Isolate::heap_profiler().

SnapshotObjectId GetMaxSnapshotJSObjectId ( ) const

Returns a max seen JS object Id.

Definition at line 7317 of file api.cc.

Referenced by TEST().

const HeapGraphNode * GetNode ( int  index) const

Returns a node by index.

Definition at line 7311 of file api.cc.

Referenced by TEST().

const HeapGraphNode * GetNodeById ( SnapshotObjectId  id) const

Returns a node by its id.

Definition at line 7300 of file api.cc.

Referenced by TEST().

int GetNodesCount ( ) const

Returns total nodes count in the snapshot.

Definition at line 7306 of file api.cc.

Referenced by TEST().

const HeapGraphNode * GetRoot ( ) const

Returns the root node of the heap graph.

Definition at line 7295 of file api.cc.

Referenced by HasWeakGlobalHandle(), and TEST().

Handle< String > GetTitle ( ) const

Returns heap snapshot title.

Definition at line 7288 of file api.cc.

References Isolate::factory(), and Factory::InternalizeUtf8String().

unsigned GetUid ( ) const

Returns heap snapshot UID (assigned by the profiler.)

Definition at line 7283 of file api.cc.

Referenced by TEST().

void Serialize ( OutputStream stream,
HeapSnapshot::SerializationFormat  format 
) 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 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, meta: { meta-info }, node_count: nnn, edge_count: nnn }, nodes: [nodes array], edges: [edges array], strings: [strings array] }

Nodes reference strings, other nodes, and edges by their indexes in corresponding arrays.

Definition at line 7322 of file api.cc.

References Utils::ApiCheck(), and OutputStream::GetChunkSize().

Referenced by TEST().


The documentation for this class was generated from the following files: