v8
3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
|
#include <v8-profiler.h>
Data Structures | |
class | ObjectNameResolver |
Public Types | |
typedef RetainedObjectInfo *(* | WrapperInfoCallback )(uint16_t class_id, Handle< Value > wrapper) |
Public Member Functions | |
int | GetSnapshotCount () |
const HeapSnapshot * | GetHeapSnapshot (int index) |
SnapshotObjectId | GetObjectId (Handle< Value > value) |
Handle< Value > | FindObjectById (SnapshotObjectId id) |
void | ClearObjectIds () |
const HeapSnapshot * | TakeHeapSnapshot (Handle< String > title, ActivityControl *control=NULL, ObjectNameResolver *global_object_name_resolver=NULL) |
void | StartTrackingHeapObjects (bool track_allocations=false) |
SnapshotObjectId | GetHeapStats (OutputStream *stream) |
void | StopTrackingHeapObjects () |
void | DeleteAllHeapSnapshots () |
void | SetWrapperClassInfoProvider (uint16_t class_id, WrapperInfoCallback callback) |
size_t | GetProfilerMemorySize () |
void | SetRetainedObjectInfo (UniqueId id, RetainedObjectInfo *info) |
Static Public Attributes | |
static const SnapshotObjectId | kUnknownObjectId = 0 |
static const uint16_t | kPersistentHandleNoClassId = 0 |
Interface for controlling heap profiling. Instance of the profiler can be retrieved using v8::Isolate::GetHeapProfiler.
Definition at line 401 of file v8-profiler.h.
typedef RetainedObjectInfo*(* WrapperInfoCallback)(uint16_t class_id, Handle< Value > wrapper) |
Callback function invoked for obtaining RetainedObjectInfo for the given JavaScript wrapper object. It is prohibited to enter V8 while the callback is running: only getters on the handle and GetPointerFromInternalField on the objects are allowed.
Definition at line 410 of file v8-profiler.h.
void ClearObjectIds | ( | ) |
void DeleteAllHeapSnapshots | ( | ) |
Handle< Value > FindObjectById | ( | SnapshotObjectId | id | ) |
Returns heap object with given SnapshotObjectId if the object is alive, otherwise empty handle is returned.
Definition at line 7352 of file api.cc.
References Handle< T >::is_null(), and Utils::ToLocal().
Referenced by TEST().
const HeapSnapshot * GetHeapSnapshot | ( | int | index | ) |
SnapshotObjectId GetHeapStats | ( | OutputStream * | stream | ) |
Adds a new time interval entry to the aggregated statistics array. The time interval entry contains information on the current heap objects population size. The method also updates aggregated statistics and reports updates for all previous time intervals via the OutputStream object. Updates on each time interval are provided as a stream of the HeapStatsUpdate structure instances. The return value of the function is the last seen heap object Id.
StartTrackingHeapObjects must be called before the first call to this method.
SnapshotObjectId GetObjectId | ( | Handle< Value > | value | ) |
Returns SnapshotObjectId for a heap object referenced by |value| if it has been seen by the heap profiler, kUnknownObjectId otherwise.
Definition at line 7346 of file api.cc.
References Utils::OpenHandle().
Referenced by TEST().
size_t GetProfilerMemorySize | ( | ) |
int GetSnapshotCount | ( | ) |
void SetRetainedObjectInfo | ( | UniqueId | id, |
RetainedObjectInfo * | info | ||
) |
Sets a RetainedObjectInfo for an object group (see V8::SetObjectGroupId).
void SetWrapperClassInfoProvider | ( | uint16_t | class_id, |
WrapperInfoCallback | callback | ||
) |
void StartTrackingHeapObjects | ( | bool | track_allocations = false | ) |
Starts tracking of heap objects population statistics. After calling this method, all heap objects relocations done by the garbage collector are being registered.
|track_allocations| parameter controls whether stack trace of each allocation in the heap will be recorded and reported as part of HeapSnapshot.
Definition at line 7375 of file api.cc.
Referenced by TEST().
void StopTrackingHeapObjects | ( | ) |
const HeapSnapshot * TakeHeapSnapshot | ( | Handle< String > | title, |
ActivityControl * | control = NULL , |
||
ObjectNameResolver * | global_object_name_resolver = NULL |
||
) |
Takes a heap snapshot and returns it. Title may be an empty string.
Definition at line 7365 of file api.cc.
References Utils::OpenHandle().
Referenced by HasWeakGlobalHandle(), and TEST().
|
static |
Default value of persistent handle class ID. Must not be used to define a class. Can be used to reset a class of a persistent handle.
Definition at line 514 of file v8-profiler.h.
Referenced by GlobalHandles::Node::Acquire(), HeapProfiler::DefineWrapperClass(), GlobalHandles::Node::has_wrapper_class_id(), and GlobalHandles::Node::Release().
|
static |
A constant for invalid SnapshotObjectId. GetSnapshotObjectId will return it in case heap profiler cannot find id for the object passed as parameter. HeapSnapshot::GetNodeById will always return NULL for such id.
Definition at line 442 of file v8-profiler.h.
Referenced by HeapProfiler::GetSnapshotObjectId(), and TEST().