| v8-profiler.h | | v8-profiler.h | |
| | | | |
| skipping to change at line 107 | | skipping to change at line 107 | |
| | | | |
| /** Returns the count of samples where function exists. */ | | /** Returns the count of samples where function exists. */ | |
| double GetTotalSamplesCount() const; | | double GetTotalSamplesCount() const; | |
| | | | |
| /** Returns the count of samples where function was currently executing.
*/ | | /** Returns the count of samples where function was currently executing.
*/ | |
| double GetSelfSamplesCount() const; | | double GetSelfSamplesCount() const; | |
| | | | |
| /** Returns function entry UID. */ | | /** Returns function entry UID. */ | |
| unsigned GetCallUid() const; | | unsigned GetCallUid() const; | |
| | | | |
|
| /** Returns id of the node. The id is unique within the tree */ | | | |
| unsigned GetNodeId() const; | | | |
| | | | |
| /** Returns child nodes count of the node. */ | | /** Returns child nodes count of the node. */ | |
| int GetChildrenCount() const; | | int GetChildrenCount() const; | |
| | | | |
| /** Retrieves a child node by index. */ | | /** Retrieves a child node by index. */ | |
| const CpuProfileNode* GetChild(int index) const; | | const CpuProfileNode* GetChild(int index) const; | |
| | | | |
| static const int kNoLineNumberInfo = Message::kNoLineNumberInfo; | | static const int kNoLineNumberInfo = Message::kNoLineNumberInfo; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 135 | | skipping to change at line 132 | |
| /** Returns CPU profile UID (assigned by the profiler.) */ | | /** Returns CPU profile UID (assigned by the profiler.) */ | |
| unsigned GetUid() const; | | unsigned GetUid() const; | |
| | | | |
| /** Returns CPU profile title. */ | | /** Returns CPU profile title. */ | |
| Handle<String> GetTitle() const; | | Handle<String> GetTitle() const; | |
| | | | |
| /** Returns the root node of the top down call tree. */ | | /** Returns the root node of the top down call tree. */ | |
| const CpuProfileNode* GetTopDownRoot() const; | | const CpuProfileNode* GetTopDownRoot() const; | |
| | | | |
| /** | | /** | |
|
| * Returns number of samples recorded. The samples are not recorded unle | | | |
| ss | | | |
| * |record_samples| parameter of CpuProfiler::StartCpuProfiling is true. | | | |
| */ | | | |
| int GetSamplesCount() const; | | | |
| | | | |
| /** | | | |
| * Returns profile node corresponding to the top frame the sample at | | | |
| * the given index. | | | |
| */ | | | |
| const CpuProfileNode* GetSample(int index) const; | | | |
| | | | |
| /** | | | |
| * Deletes the profile and removes it from CpuProfiler's list. | | * Deletes the profile and removes it from CpuProfiler's list. | |
| * All pointers to nodes previously returned become invalid. | | * All pointers to nodes previously returned become invalid. | |
| * Profiles with the same uid but obtained using different | | * Profiles with the same uid but obtained using different | |
| * security token are not deleted, but become inaccessible | | * security token are not deleted, but become inaccessible | |
| * using FindProfile method. It is embedder's responsibility | | * using FindProfile method. It is embedder's responsibility | |
| * to call Delete on these profiles. | | * to call Delete on these profiles. | |
| */ | | */ | |
| void Delete(); | | void Delete(); | |
| }; | | }; | |
| | | | |
| /** | | /** | |
|
| * Interface for controlling CPU profiling. Instance of the | | * Interface for controlling CPU profiling. | |
| * profiler can be retrieved using v8::Isolate::GetCpuProfiler. | | | |
| */ | | */ | |
| class V8EXPORT CpuProfiler { | | class V8EXPORT CpuProfiler { | |
| public: | | public: | |
| /** | | /** | |
| * A note on security tokens usage. As scripts from different | | * A note on security tokens usage. As scripts from different | |
| * origins can run inside a single V8 instance, it is possible to | | * origins can run inside a single V8 instance, it is possible to | |
| * have functions from different security contexts intermixed in a | | * have functions from different security contexts intermixed in a | |
| * single CPU profile. To avoid exposing function names belonging to | | * single CPU profile. To avoid exposing function names belonging to | |
| * other contexts, filtering by security token is performed while | | * other contexts, filtering by security token is performed while | |
| * obtaining profiling results. | | * obtaining profiling results. | |
| */ | | */ | |
| | | | |
|
| /** Deprecated. Use GetProfileCount instead. */ | | | |
| static int GetProfilesCount(); | | | |
| /** | | /** | |
| * Returns the number of profiles collected (doesn't include | | * Returns the number of profiles collected (doesn't include | |
| * profiles that are being collected at the moment of call.) | | * profiles that are being collected at the moment of call.) | |
| */ | | */ | |
|
| int GetProfileCount(); | | static int GetProfilesCount(); | |
| | | | |
|
| /** Deprecated. Use GetCpuProfile instead. */ | | | |
| static const CpuProfile* GetProfile( | | | |
| int index, | | | |
| Handle<Value> security_token = Handle<Value>()); | | | |
| /** Returns a profile by index. */ | | /** Returns a profile by index. */ | |
|
| const CpuProfile* GetCpuProfile( | | static const CpuProfile* GetProfile( | |
| int index, | | int index, | |
| Handle<Value> security_token = Handle<Value>()); | | Handle<Value> security_token = Handle<Value>()); | |
| | | | |
|
| /** Deprecated. Use FindProfile instead. */ | | | |
| static const CpuProfile* FindProfile( | | | |
| unsigned uid, | | | |
| Handle<Value> security_token = Handle<Value>()); | | | |
| /** Returns a profile by uid. */ | | /** Returns a profile by uid. */ | |
|
| const CpuProfile* FindCpuProfile( | | static const CpuProfile* FindProfile( | |
| unsigned uid, | | unsigned uid, | |
| Handle<Value> security_token = Handle<Value>()); | | Handle<Value> security_token = Handle<Value>()); | |
| | | | |
|
| /** Deprecated. Use StartCpuProfiling instead. */ | | | |
| static void StartProfiling(Handle<String> title, bool record_samples = fa | | | |
| lse); | | | |
| /** | | /** | |
| * Starts collecting CPU profile. Title may be an empty string. It | | * Starts collecting CPU profile. Title may be an empty string. It | |
| * is allowed to have several profiles being collected at | | * is allowed to have several profiles being collected at | |
| * once. Attempts to start collecting several profiles with the same | | * once. Attempts to start collecting several profiles with the same | |
| * title are silently ignored. While collecting a profile, functions | | * title are silently ignored. While collecting a profile, functions | |
| * from all security contexts are included in it. The token-based | | * from all security contexts are included in it. The token-based | |
| * filtering is only performed when querying for a profile. | | * filtering is only performed when querying for a profile. | |
|
| * | | | |
| * |record_samples| parameter controls whether individual samples should | | | |
| * be recorded in addition to the aggregated tree. | | | |
| */ | | */ | |
|
| void StartCpuProfiling(Handle<String> title, bool record_samples = false)
; | | static void StartProfiling(Handle<String> title); | |
| | | | |
|
| /** Deprecated. Use StopCpuProfiling instead. */ | | | |
| static const CpuProfile* StopProfiling( | | | |
| Handle<String> title, | | | |
| Handle<Value> security_token = Handle<Value>()); | | | |
| /** | | /** | |
| * Stops collecting CPU profile with a given title and returns it. | | * Stops collecting CPU profile with a given title and returns it. | |
| * If the title given is empty, finishes the last profile started. | | * If the title given is empty, finishes the last profile started. | |
| */ | | */ | |
|
| const CpuProfile* StopCpuProfiling( | | static const CpuProfile* StopProfiling( | |
| Handle<String> title, | | Handle<String> title, | |
| Handle<Value> security_token = Handle<Value>()); | | Handle<Value> security_token = Handle<Value>()); | |
| | | | |
|
| /** Deprecated. Use DeleteAllCpuProfiles instead. */ | | | |
| static void DeleteAllProfiles(); | | | |
| /** | | /** | |
| * Deletes all existing profiles, also cancelling all profiling | | * Deletes all existing profiles, also cancelling all profiling | |
| * activity. All previously returned pointers to profiles and their | | * activity. All previously returned pointers to profiles and their | |
| * contents become invalid after this call. | | * contents become invalid after this call. | |
| */ | | */ | |
|
| void DeleteAllCpuProfiles(); | | static void DeleteAllProfiles(); | |
| | | | |
| private: | | | |
| CpuProfiler(); | | | |
| ~CpuProfiler(); | | | |
| CpuProfiler(const CpuProfiler&); | | | |
| CpuProfiler& operator=(const CpuProfiler&); | | | |
| }; | | }; | |
| | | | |
| class HeapGraphNode; | | class HeapGraphNode; | |
| | | | |
| /** | | /** | |
| * HeapSnapshotEdge represents a directed connection between heap | | * HeapSnapshotEdge represents a directed connection between heap | |
| * graph nodes: from retainers to retained nodes. | | * graph nodes: from retainers to retained nodes. | |
| */ | | */ | |
| class V8EXPORT HeapGraphEdge { | | class V8EXPORT HeapGraphEdge { | |
| public: | | public: | |
| | | | |
| skipping to change at line 342 | | skipping to change at line 299 | |
| */ | | */ | |
| class V8EXPORT HeapSnapshot { | | class V8EXPORT HeapSnapshot { | |
| public: | | public: | |
| enum Type { | | enum Type { | |
| kFull = 0 // Heap snapshot with all instances and references. | | kFull = 0 // Heap snapshot with all instances and references. | |
| }; | | }; | |
| enum SerializationFormat { | | enum SerializationFormat { | |
| kJSON = 0 // See format description near 'Serialize' method. | | kJSON = 0 // See format description near 'Serialize' method. | |
| }; | | }; | |
| | | | |
|
| /** Deprecated. Returns kFull. */ | | /** Returns heap snapshot type. */ | |
| V8_DEPRECATED(Type GetType() const); | | Type GetType() const; | |
| | | | |
| /** Returns heap snapshot UID (assigned by the profiler.) */ | | /** Returns heap snapshot UID (assigned by the profiler.) */ | |
| unsigned GetUid() const; | | unsigned GetUid() const; | |
| | | | |
| /** Returns heap snapshot title. */ | | /** Returns heap snapshot title. */ | |
| Handle<String> GetTitle() const; | | Handle<String> GetTitle() const; | |
| | | | |
| /** Returns the root node of the heap graph. */ | | /** Returns the root node of the heap graph. */ | |
| const HeapGraphNode* GetRoot() const; | | const HeapGraphNode* GetRoot() const; | |
| | | | |
| | | | |
| skipping to change at line 405 | | skipping to change at line 362 | |
| * | | * | |
| * Nodes reference strings, other nodes, and edges by their indexes | | * Nodes reference strings, other nodes, and edges by their indexes | |
| * in corresponding arrays. | | * in corresponding arrays. | |
| */ | | */ | |
| void Serialize(OutputStream* stream, SerializationFormat format) const; | | void Serialize(OutputStream* stream, SerializationFormat format) const; | |
| }; | | }; | |
| | | | |
| class RetainedObjectInfo; | | class RetainedObjectInfo; | |
| | | | |
| /** | | /** | |
|
| * Interface for controlling heap profiling. Instance of the | | * Interface for controlling heap profiling. | |
| * profiler can be retrieved using v8::Isolate::GetHeapProfiler. | | | |
| */ | | */ | |
| class V8EXPORT HeapProfiler { | | class V8EXPORT HeapProfiler { | |
| public: | | public: | |
| /** | | /** | |
| * Callback function invoked for obtaining RetainedObjectInfo for | | * Callback function invoked for obtaining RetainedObjectInfo for | |
| * the given JavaScript wrapper object. It is prohibited to enter V8 | | * the given JavaScript wrapper object. It is prohibited to enter V8 | |
| * while the callback is running: only getters on the handle and | | * while the callback is running: only getters on the handle and | |
| * GetPointerFromInternalField on the objects are allowed. | | * GetPointerFromInternalField on the objects are allowed. | |
| */ | | */ | |
| typedef RetainedObjectInfo* (*WrapperInfoCallback) | | typedef RetainedObjectInfo* (*WrapperInfoCallback) | |
| (uint16_t class_id, Handle<Value> wrapper); | | (uint16_t class_id, Handle<Value> wrapper); | |
| | | | |
|
| /** Deprecated. Use GetSnapshotCount instead. */ | | | |
| static int GetSnapshotsCount(); | | | |
| /** Returns the number of snapshots taken. */ | | /** Returns the number of snapshots taken. */ | |
|
| int GetSnapshotCount(); | | static int GetSnapshotsCount(); | |
| | | | |
|
| /** Deprecated. Use GetHeapSnapshot instead. */ | | | |
| static const HeapSnapshot* GetSnapshot(int index); | | | |
| /** Returns a snapshot by index. */ | | /** Returns a snapshot by index. */ | |
|
| const HeapSnapshot* GetHeapSnapshot(int index); | | static const HeapSnapshot* GetSnapshot(int index); | |
| | | | |
|
| /** Deprecated. Use FindHeapSnapshot instead. */ | | | |
| static const HeapSnapshot* FindSnapshot(unsigned uid); | | | |
| /** Returns a profile by uid. */ | | /** Returns a profile by uid. */ | |
|
| const HeapSnapshot* FindHeapSnapshot(unsigned uid); | | static const HeapSnapshot* FindSnapshot(unsigned uid); | |
| | | | |
|
| /** Deprecated. Use GetObjectId instead. */ | | | |
| static SnapshotObjectId GetSnapshotObjectId(Handle<Value> value); | | | |
| /** | | /** | |
| * Returns SnapshotObjectId for a heap object referenced by |value| if | | * Returns SnapshotObjectId for a heap object referenced by |value| if | |
| * it has been seen by the heap profiler, kUnknownObjectId otherwise. | | * it has been seen by the heap profiler, kUnknownObjectId otherwise. | |
| */ | | */ | |
|
| SnapshotObjectId GetObjectId(Handle<Value> value); | | static SnapshotObjectId GetSnapshotObjectId(Handle<Value> value); | |
| | | | |
| /** | | /** | |
| * A constant for invalid SnapshotObjectId. GetSnapshotObjectId will retu
rn | | * A constant for invalid SnapshotObjectId. GetSnapshotObjectId will retu
rn | |
| * it in case heap profiler cannot find id for the object passed as | | * it in case heap profiler cannot find id for the object passed as | |
| * parameter. HeapSnapshot::GetNodeById will always return NULL for such
id. | | * parameter. HeapSnapshot::GetNodeById will always return NULL for such
id. | |
| */ | | */ | |
| static const SnapshotObjectId kUnknownObjectId = 0; | | static const SnapshotObjectId kUnknownObjectId = 0; | |
| | | | |
| /** | | /** | |
| * Callback interface for retrieving user friendly names of global object
s. | | * Callback interface for retrieving user friendly names of global object
s. | |
| */ | | */ | |
| class ObjectNameResolver { | | class ObjectNameResolver { | |
|
| public: | | public: | |
| /** | | /** | |
| * Returns name to be used in the heap snapshot for given node. Returne
d | | * Returns name to be used in the heap snapshot for given node. Returne
d | |
| * string must stay alive until snapshot collection is completed. | | * string must stay alive until snapshot collection is completed. | |
| */ | | */ | |
| virtual const char* GetName(Handle<Object> object) = 0; | | virtual const char* GetName(Handle<Object> object) = 0; | |
|
| protected: | | protected: | |
| virtual ~ObjectNameResolver() {} | | virtual ~ObjectNameResolver() {} | |
| }; | | }; | |
| | | | |
|
| /** Deprecated. Use TakeHeapSnapshot instead. */ | | | |
| static const HeapSnapshot* TakeSnapshot( | | | |
| Handle<String> title, | | | |
| HeapSnapshot::Type type = HeapSnapshot::kFull, | | | |
| ActivityControl* control = NULL, | | | |
| ObjectNameResolver* global_object_name_resolver = NULL); | | | |
| /** | | /** | |
| * Takes a heap snapshot and returns it. Title may be an empty string. | | * Takes a heap snapshot and returns it. Title may be an empty string. | |
|
| | | * See HeapSnapshot::Type for types description. | |
| */ | | */ | |
|
| const HeapSnapshot* TakeHeapSnapshot( | | static const HeapSnapshot* TakeSnapshot( | |
| Handle<String> title, | | Handle<String> title, | |
|
| | | HeapSnapshot::Type type = HeapSnapshot::kFull, | |
| ActivityControl* control = NULL, | | ActivityControl* control = NULL, | |
| ObjectNameResolver* global_object_name_resolver = NULL); | | ObjectNameResolver* global_object_name_resolver = NULL); | |
| | | | |
|
| /** Deprecated. Use StartTrackingHeapObjects instead. */ | | | |
| static void StartHeapObjectsTracking(); | | | |
| /** | | /** | |
| * Starts tracking of heap objects population statistics. After calling | | * Starts tracking of heap objects population statistics. After calling | |
| * this method, all heap objects relocations done by the garbage collecto
r | | * this method, all heap objects relocations done by the garbage collecto
r | |
| * are being registered. | | * are being registered. | |
| */ | | */ | |
|
| void StartTrackingHeapObjects(); | | static void StartHeapObjectsTracking(); | |
| | | | |
|
| /** Deprecated. Use GetHeapStats instead. */ | | | |
| static SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); | | | |
| /** | | /** | |
| * Adds a new time interval entry to the aggregated statistics array. The | | * Adds a new time interval entry to the aggregated statistics array. The | |
| * time interval entry contains information on the current heap objects | | * time interval entry contains information on the current heap objects | |
| * population size. The method also updates aggregated statistics and | | * population size. The method also updates aggregated statistics and | |
| * reports updates for all previous time intervals via the OutputStream | | * reports updates for all previous time intervals via the OutputStream | |
| * object. Updates on each time interval are provided as a stream of the | | * object. Updates on each time interval are provided as a stream of the | |
| * HeapStatsUpdate structure instances. | | * HeapStatsUpdate structure instances. | |
| * The return value of the function is the last seen heap object Id. | | * The return value of the function is the last seen heap object Id. | |
| * | | * | |
|
| * StartTrackingHeapObjects must be called before the first call to this | | * StartHeapObjectsTracking must be called before the first call to this | |
| * method. | | * method. | |
| */ | | */ | |
|
| SnapshotObjectId GetHeapStats(OutputStream* stream); | | static SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); | |
| | | | |
|
| /** Deprecated. Use StopTrackingHeapObjects instead. */ | | | |
| static void StopHeapObjectsTracking(); | | | |
| /** | | /** | |
| * Stops tracking of heap objects population statistics, cleans up all | | * Stops tracking of heap objects population statistics, cleans up all | |
| * collected data. StartHeapObjectsTracking must be called again prior to | | * collected data. StartHeapObjectsTracking must be called again prior to | |
| * calling PushHeapObjectsStats next time. | | * calling PushHeapObjectsStats next time. | |
| */ | | */ | |
|
| void StopTrackingHeapObjects(); | | static void StopHeapObjectsTracking(); | |
| | | | |
|
| /** Deprecated. Use DeleteAllHeapSnapshots instead. */ | | | |
| static void DeleteAllSnapshots(); | | | |
| /** | | /** | |
| * Deletes all snapshots taken. All previously returned pointers to | | * Deletes all snapshots taken. All previously returned pointers to | |
| * snapshots and their contents become invalid after this call. | | * snapshots and their contents become invalid after this call. | |
| */ | | */ | |
|
| void DeleteAllHeapSnapshots(); | | static void DeleteAllSnapshots(); | |
| | | | |
|
| /** Deprecated. Use SetWrapperClassInfoProvider instead. */ | | | |
| static void DefineWrapperClass( | | | |
| uint16_t class_id, | | | |
| WrapperInfoCallback callback); | | | |
| /** Binds a callback to embedder's class ID. */ | | /** Binds a callback to embedder's class ID. */ | |
|
| void SetWrapperClassInfoProvider( | | static void DefineWrapperClass( | |
| uint16_t class_id, | | uint16_t class_id, | |
| WrapperInfoCallback callback); | | WrapperInfoCallback callback); | |
| | | | |
| /** | | /** | |
| * Default value of persistent handle class ID. Must not be used to | | * 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 | | * define a class. Can be used to reset a class of a persistent | |
| * handle. | | * handle. | |
| */ | | */ | |
| static const uint16_t kPersistentHandleNoClassId = 0; | | static const uint16_t kPersistentHandleNoClassId = 0; | |
| | | | |
|
| /** | | /** Returns the number of currently existing persistent handles. */ | |
| * Deprecated. Returns the number of currently existing persistent handle | | | |
| s. | | | |
| */ | | | |
| static int GetPersistentHandleCount(); | | static int GetPersistentHandleCount(); | |
| | | | |
|
| /** Deprecated. Use GetHeapProfilerMemorySize instead. */ | | | |
| static size_t GetMemorySizeUsedByProfiler(); | | | |
| /** Returns memory used for profiler internal data and snapshots. */ | | /** Returns memory used for profiler internal data and snapshots. */ | |
|
| size_t GetProfilerMemorySize(); | | static size_t GetMemorySizeUsedByProfiler(); | |
| | | | |
| private: | | | |
| HeapProfiler(); | | | |
| ~HeapProfiler(); | | | |
| HeapProfiler(const HeapProfiler&); | | | |
| HeapProfiler& operator=(const HeapProfiler&); | | | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Interface for providing information about embedder's objects | | * Interface for providing information about embedder's objects | |
| * held by global handles. This information is reported in two ways: | | * held by global handles. This information is reported in two ways: | |
| * | | * | |
| * 1. When calling AddObjectGroup, an embedder may pass | | * 1. When calling AddObjectGroup, an embedder may pass | |
| * RetainedObjectInfo instance describing the group. To collect | | * RetainedObjectInfo instance describing the group. To collect | |
| * this information while taking a heap snapshot, V8 calls GC | | * this information while taking a heap snapshot, V8 calls GC | |
| * prologue and epilogue callbacks. | | * prologue and epilogue callbacks. | |
| | | | |
| skipping to change at line 627 | | skipping to change at line 549 | |
| RetainedObjectInfo() {} | | RetainedObjectInfo() {} | |
| virtual ~RetainedObjectInfo() {} | | virtual ~RetainedObjectInfo() {} | |
| | | | |
| private: | | private: | |
| RetainedObjectInfo(const RetainedObjectInfo&); | | RetainedObjectInfo(const RetainedObjectInfo&); | |
| RetainedObjectInfo& operator=(const RetainedObjectInfo&); | | RetainedObjectInfo& operator=(const RetainedObjectInfo&); | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * A struct for exporting HeapStats data from V8, using "push" model. | | * A struct for exporting HeapStats data from V8, using "push" model. | |
|
| * See HeapProfiler::GetHeapStats. | | * See HeapProfiler::PushHeapObjectsStats. | |
| */ | | */ | |
| struct HeapStatsUpdate { | | struct HeapStatsUpdate { | |
| HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size) | | HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size) | |
| : index(index), count(count), size(size) { } | | : index(index), count(count), size(size) { } | |
| uint32_t index; // Index of the time interval that was changed. | | uint32_t index; // Index of the time interval that was changed. | |
| uint32_t count; // New value of count field for the interval with this i
ndex. | | uint32_t count; // New value of count field for the interval with this i
ndex. | |
| uint32_t size; // New value of size field for the interval with this ind
ex. | | uint32_t size; // New value of size field for the interval with this ind
ex. | |
| }; | | }; | |
| | | | |
| } // namespace v8 | | } // namespace v8 | |
| | | | |
End of changes. 47 change blocks. |
| 109 lines changed or deleted | | 28 lines changed or added | |
|