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

Side by Side Diff: include/v8-profiler.h

Issue 2631063003: [api,profiler] Introduce GetRetainerInfos callback for profiling (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_V8_PROFILER_H_ 5 #ifndef V8_V8_PROFILER_H_
6 #define V8_V8_PROFILER_H_ 6 #define V8_V8_PROFILER_H_
7 7
8 #include <unordered_set>
8 #include <vector> 9 #include <vector>
9 #include "v8.h" // NOLINT(build/include) 10 #include "v8.h" // NOLINT(build/include)
10 11
11 /** 12 /**
12 * Profiler support for the V8 JavaScript engine. 13 * Profiler support for the V8 JavaScript engine.
13 */ 14 */
14 namespace v8 { 15 namespace v8 {
15 16
16 class HeapGraphNode; 17 class HeapGraphNode;
17 struct HeapStatsUpdate; 18 struct HeapStatsUpdate;
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 * Interface for controlling heap profiling. Instance of the 624 * Interface for controlling heap profiling. Instance of the
624 * profiler can be retrieved using v8::Isolate::GetHeapProfiler. 625 * profiler can be retrieved using v8::Isolate::GetHeapProfiler.
625 */ 626 */
626 class V8_EXPORT HeapProfiler { 627 class V8_EXPORT HeapProfiler {
627 public: 628 public:
628 enum SamplingFlags { 629 enum SamplingFlags {
629 kSamplingNoFlags = 0, 630 kSamplingNoFlags = 0,
630 kSamplingForceGC = 1 << 0, 631 kSamplingForceGC = 1 << 0,
631 }; 632 };
632 633
634 typedef std::unordered_set<const v8::PersistentBase<v8::Value>*>
635 RetainerChildren;
636 typedef std::vector<std::pair<v8::RetainedObjectInfo*, RetainerChildren>>
637 RetainerGroups;
638 typedef std::vector<std::pair<const v8::PersistentBase<v8::Value>*,
639 const v8::PersistentBase<v8::Value>*>>
640 RetainerEdges;
641
642 struct RetainerInfos {
643 RetainerGroups groups;
644 RetainerEdges edges;
645 };
646
647 /**
648 * Callback function invoked to retrieve all RetainerInfos from the embedder.
649 */
650 typedef RetainerInfos (*GetRetainerInfosCallback)(v8::Isolate* isolate);
651
633 /** 652 /**
634 * Callback function invoked for obtaining RetainedObjectInfo for 653 * Callback function invoked for obtaining RetainedObjectInfo for
635 * the given JavaScript wrapper object. It is prohibited to enter V8 654 * the given JavaScript wrapper object. It is prohibited to enter V8
636 * while the callback is running: only getters on the handle and 655 * while the callback is running: only getters on the handle and
637 * GetPointerFromInternalField on the objects are allowed. 656 * GetPointerFromInternalField on the objects are allowed.
638 */ 657 */
639 typedef RetainedObjectInfo* (*WrapperInfoCallback)(uint16_t class_id, 658 typedef RetainedObjectInfo* (*WrapperInfoCallback)(uint16_t class_id,
640 Local<Value> wrapper); 659 Local<Value> wrapper);
641 660
642 /** Returns the number of snapshots taken. */ 661 /** Returns the number of snapshots taken. */
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 * Deletes all snapshots taken. All previously returned pointers to 794 * Deletes all snapshots taken. All previously returned pointers to
776 * snapshots and their contents become invalid after this call. 795 * snapshots and their contents become invalid after this call.
777 */ 796 */
778 void DeleteAllHeapSnapshots(); 797 void DeleteAllHeapSnapshots();
779 798
780 /** Binds a callback to embedder's class ID. */ 799 /** Binds a callback to embedder's class ID. */
781 void SetWrapperClassInfoProvider( 800 void SetWrapperClassInfoProvider(
782 uint16_t class_id, 801 uint16_t class_id,
783 WrapperInfoCallback callback); 802 WrapperInfoCallback callback);
784 803
804 void SetGetRetainerInfosCallback(GetRetainerInfosCallback callback);
805
785 /** 806 /**
786 * Default value of persistent handle class ID. Must not be used to 807 * Default value of persistent handle class ID. Must not be used to
787 * define a class. Can be used to reset a class of a persistent 808 * define a class. Can be used to reset a class of a persistent
788 * handle. 809 * handle.
789 */ 810 */
790 static const uint16_t kPersistentHandleNoClassId = 0; 811 static const uint16_t kPersistentHandleNoClassId = 0;
791 812
792 /** Returns memory used for profiler internal data and snapshots. */ 813 /** Returns memory used for profiler internal data and snapshots. */
793 size_t GetProfilerMemorySize(); 814 size_t GetProfilerMemorySize();
794 815
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 uint32_t index; // Index of the time interval that was changed. 909 uint32_t index; // Index of the time interval that was changed.
889 uint32_t count; // New value of count field for the interval with this index. 910 uint32_t count; // New value of count field for the interval with this index.
890 uint32_t size; // New value of size field for the interval with this index. 911 uint32_t size; // New value of size field for the interval with this index.
891 }; 912 };
892 913
893 914
894 } // namespace v8 915 } // namespace v8
895 916
896 917
897 #endif // V8_V8_PROFILER_H_ 918 #endif // V8_V8_PROFILER_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698