| v8-profiler.h | | v8-profiler.h | |
| | | | |
| skipping to change at line 136 | | skipping to change at line 136 | |
| 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 | | * Returns number of samples recorded. The samples are not recorded unle
ss | |
|
| * |record_samples| parameter of CpuProfiler::StartProfiling is true. | | * |record_samples| parameter of CpuProfiler::StartCpuProfiling is true. | |
| */ | | */ | |
| int GetSamplesCount() const; | | int GetSamplesCount() const; | |
| | | | |
| /** | | /** | |
| * Returns profile node corresponding to the top frame the sample at | | * Returns profile node corresponding to the top frame the sample at | |
| * the given index. | | * the given index. | |
| */ | | */ | |
| const CpuProfileNode* GetSample(int index) const; | | const CpuProfileNode* GetSample(int index) const; | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 158 | | skipping to change at line 158 | |
| * 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. | | * Interface for controlling CPU profiling. Instance of the | |
| | | * 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.) | |
| */ | | */ | |
|
| static int GetProfilesCount(); | | int GetProfileCount(); | |
| | | | |
|
| /** Returns a profile by index. */ | | /** Deprecated. Use GetCpuProfile instead. */ | |
| static const CpuProfile* GetProfile( | | static const CpuProfile* GetProfile( | |
| int index, | | int index, | |
| Handle<Value> security_token = Handle<Value>()); | | Handle<Value> security_token = Handle<Value>()); | |
|
| | | /** Returns a profile by index. */ | |
| | | const CpuProfile* GetCpuProfile( | |
| | | int index, | |
| | | Handle<Value> security_token = Handle<Value>()); | |
| | | | |
|
| /** Returns a profile by uid. */ | | /** Deprecated. Use FindProfile instead. */ | |
| static const CpuProfile* FindProfile( | | static const CpuProfile* FindProfile( | |
| unsigned uid, | | unsigned uid, | |
| Handle<Value> security_token = Handle<Value>()); | | Handle<Value> security_token = Handle<Value>()); | |
|
| | | /** Returns a profile by uid. */ | |
| | | const CpuProfile* FindCpuProfile( | |
| | | unsigned uid, | |
| | | 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 | | * |record_samples| parameter controls whether individual samples should | |
| * be recorded in addition to the aggregated tree. | | * be recorded in addition to the aggregated tree. | |
| */ | | */ | |
|
| static void StartProfiling(Handle<String> title, bool record_samples = fa
lse); | | void StartCpuProfiling(Handle<String> title, bool record_samples = false)
; | |
| | | | |
|
| | | /** 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. | |
| */ | | */ | |
|
| static const CpuProfile* StopProfiling( | | const CpuProfile* StopCpuProfiling( | |
| 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. | |
| */ | | */ | |
|
| static void DeleteAllProfiles(); | | void DeleteAllCpuProfiles(); | |
| | | | |
| | | 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 317 | | skipping to change at line 342 | |
| */ | | */ | |
| 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. | |
| }; | | }; | |
| | | | |
|
| /** Returns heap snapshot type. */ | | /** Deprecated. Returns kFull. */ | |
| Type GetType() const; | | V8_DEPRECATED(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 380 | | skipping to change at line 405 | |
| * | | * | |
| * 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. | | * Interface for controlling heap profiling. Instance of the | |
| | | * 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); | |
| | | | |
|
| /** Returns the number of snapshots taken. */ | | /** Deprecated. Use GetSnapshotCount instead. */ | |
| static int GetSnapshotsCount(); | | static int GetSnapshotsCount(); | |
|
| | | /** Returns the number of snapshots taken. */ | |
| | | int GetSnapshotCount(); | |
| | | | |
|
| /** Returns a snapshot by index. */ | | /** Deprecated. Use GetHeapSnapshot instead. */ | |
| static const HeapSnapshot* GetSnapshot(int index); | | static const HeapSnapshot* GetSnapshot(int index); | |
|
| | | /** Returns a snapshot by index. */ | |
| | | const HeapSnapshot* GetHeapSnapshot(int index); | |
| | | | |
|
| /** Returns a profile by uid. */ | | /** Deprecated. Use FindHeapSnapshot instead. */ | |
| static const HeapSnapshot* FindSnapshot(unsigned uid); | | static const HeapSnapshot* FindSnapshot(unsigned uid); | |
|
| | | /** Returns a profile by uid. */ | |
| | | const HeapSnapshot* FindHeapSnapshot(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. | |
| */ | | */ | |
|
| static SnapshotObjectId GetSnapshotObjectId(Handle<Value> value); | | SnapshotObjectId GetObjectId(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. | | | |
| */ | | */ | |
|
| static const HeapSnapshot* TakeSnapshot( | | const HeapSnapshot* TakeHeapSnapshot( | |
| 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. | |
| */ | | */ | |
|
| static void StartHeapObjectsTracking(); | | void StartTrackingHeapObjects(); | |
| | | | |
|
| | | /** 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. | |
| * | | * | |
|
| * StartHeapObjectsTracking must be called before the first call to this | | * StartTrackingHeapObjects must be called before the first call to this | |
| * method. | | * method. | |
| */ | | */ | |
|
| static SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); | | SnapshotObjectId GetHeapStats(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. | |
| */ | | */ | |
|
| static void StopHeapObjectsTracking(); | | void StopTrackingHeapObjects(); | |
| | | | |
|
| | | /** 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. | |
| */ | | */ | |
|
| static void DeleteAllSnapshots(); | | void DeleteAllHeapSnapshots(); | |
| | | | |
|
| /** Binds a callback to embedder's class ID. */ | | /** Deprecated. Use SetWrapperClassInfoProvider instead. */ | |
| static void DefineWrapperClass( | | static void DefineWrapperClass( | |
| uint16_t class_id, | | uint16_t class_id, | |
| WrapperInfoCallback callback); | | WrapperInfoCallback callback); | |
|
| | | /** Binds a callback to embedder's class ID. */ | |
| | | void SetWrapperClassInfoProvider( | |
| | | uint16_t class_id, | |
| | | 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(); | |
| | | | |
|
| /** Returns memory used for profiler internal data and snapshots. */ | | /** Deprecated. Use GetHeapProfilerMemorySize instead. */ | |
| static size_t GetMemorySizeUsedByProfiler(); | | static size_t GetMemorySizeUsedByProfiler(); | |
|
| | | /** Returns memory used for profiler internal data and snapshots. */ | |
| | | size_t GetProfilerMemorySize(); | |
| | | | |
| | | 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 567 | | skipping to change at line 627 | |
| 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::PushHeapObjectsStats. | | * See HeapProfiler::GetHeapStats. | |
| */ | | */ | |
| 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. 45 change blocks. |
| 29 lines changed or deleted | | 91 lines changed or added | |
|