5 #ifndef V8_V8_PROFILER_H_ 6 #define V8_V8_PROFILER_H_ 8 #include <unordered_set> 31 template class V8_EXPORT std::vector<v8::CpuProfileDeoptFrame>;
39 std::vector<CpuProfileDeoptFrame>
stack;
45 template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>;
60 external_callback_entry(nullptr),
62 has_external_callback(false),
78 RecordCEntryFrame record_c_entry_frame,
bool update_stats,
79 bool use_simulator_reg_state =
true);
101 RecordCEntryFrame record_c_entry_frame,
102 void** frames,
size_t frames_limit,
104 bool use_simulator_reg_state =
true);
111 static const unsigned kMaxFramesCountLog2 = 8;
112 static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1;
113 void* stack[kMaxFramesCount];
140 const char* GetFunctionNameStr()
const;
143 int GetScriptId()
const;
153 const char* GetScriptResourceNameStr()
const;
159 int GetLineNumber()
const;
165 int GetColumnNumber()
const;
170 unsigned int GetHitLineCount()
const;
177 bool GetLineTicks(
LineTick* entries,
unsigned int length)
const;
182 const char* GetBailoutReason()
const;
187 unsigned GetHitCount()
const;
191 "Use GetScriptId, GetLineNumber, and GetColumnNumber instead.",
192 unsigned GetCallUid()
const);
195 unsigned GetNodeId()
const;
198 int GetChildrenCount()
const;
204 const std::vector<CpuProfileDeoptInfo>& GetDeoptInfos()
const;
206 static const int kNoLineNumberInfo = Message::kNoLineNumberInfo;
207 static const int kNoColumnNumberInfo = Message::kNoColumnInfo;
227 int GetSamplesCount()
const;
240 int64_t GetSampleTimestamp(
int index)
const;
246 int64_t GetStartTime()
const;
253 int64_t GetEndTime()
const;
290 static void CollectSample(
Isolate* isolate);
302 void SetSamplingInterval(
int us);
316 bool record_samples =
false);
322 void StartProfiling(
Local<String> title,
bool record_samples =
false);
336 void CollectSample());
342 void SetIdle(
bool is_idle));
348 static void UseDetailedSourcePositionsForProfiling(
Isolate* isolate);
365 kContextVariable = 0,
379 Type GetType()
const;
419 Type GetType()
const;
435 size_t GetShallowSize()
const;
438 int GetChildrenCount()
const;
456 virtual void EndOfStream() = 0;
464 virtual WriteResult WriteAsciiChunk(
char* data,
int size) = 0;
492 int GetNodesCount()
const;
534 SerializationFormat format = kJSON)
const;
553 virtual ControlOption ReportProgressValue(
int done,
int total) = 0;
663 virtual Node* GetRootNode() = 0;
664 virtual const std::vector<Sample>& GetSamples() = 0;
668 static const int kNoLineNumberInfo = Message::kNoLineNumberInfo;
669 static const int kNoColumnNumberInfo = Message::kNoColumnInfo;
691 virtual ~
Node() =
default;
692 virtual const char*
Name() = 0;
693 virtual size_t SizeInBytes() = 0;
710 Node& operator=(
const Node&) =
delete;
723 virtual Node* AddNode(std::unique_ptr<Node> node) = 0;
733 virtual void AddEdge(Node* from, Node* to,
const char* name =
nullptr) = 0;
745 kSamplingNoFlags = 0,
746 kSamplingForceGC = 1 << 0,
760 typedef void (*LegacyBuildEmbedderGraphCallback)(
v8::Isolate* isolate,
764 int GetSnapshotCount();
786 void ClearObjectIds();
826 void StartTrackingHeapObjects(
bool track_allocations =
false);
842 int64_t* timestamp_us =
nullptr);
849 void StopTrackingHeapObjects();
878 bool StartSamplingHeapProfiler(uint64_t sample_interval = 512 * 1024,
879 int stack_depth = 16,
885 void StopSamplingHeapProfiler();
899 void DeleteAllHeapSnapshots();
902 "Use AddBuildEmbedderGraphCallback to provide info about embedder nodes",
903 void SetBuildEmbedderGraphCallback(
904 LegacyBuildEmbedderGraphCallback callback));
905 void AddBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback,
907 void RemoveBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback,
915 static const uint16_t kPersistentHandleNoClassId = 0;
930 : index(index), count(count), size(size) { }
936 #define CODE_EVENTS_LIST(V) \ 941 V(InterpretedFunction) \ 955 #define V(Name) , k##Name##Type 965 uintptr_t GetCodeStartAddress();
966 size_t GetCodeSize();
970 int GetScriptColumn();
977 const char* GetComment();
979 static const char* GetCodeEventTypeName(
CodeEventType code_event_type);
1004 void* internal_listener_;
1010 #endif // V8_V8_PROFILER_H_
virtual const char * NamePrefix()
std::vector< Node * > children
#define V8_DEPRECATE_SOON(message, declarator)
virtual bool IsRootNode()
virtual int GetChunkSize()
virtual bool IsEmbedderNode()
HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size)
#define CODE_EVENTS_LIST(V)
std::vector< CpuProfileDeoptFrame > stack
virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate *data, int count)
#define V8_DEPRECATED(message, declarator)
std::vector< Allocation > allocations
const char * deopt_reason
bool has_external_callback
uint32_t SnapshotObjectId
virtual Node * WrapperNode()
Local< String > script_name
void * external_callback_entry