5 #ifndef V8_V8_PROFILER_H_ 6 #define V8_V8_PROFILER_H_ 10 #include <unordered_set> 23 using NativeObject =
void*;
24 using SnapshotObjectId = uint32_t;
38 template class V8_EXPORT std::vector<v8::CpuProfileDeoptFrame>;
52 template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>;
274 unsigned max_samples =
kNoSampleLimit,
int sampling_interval_us = 0,
284 bool has_filter_context()
const {
return !filter_context_
.IsEmpty(); }
285 void* raw_filter_context()
const;
288 unsigned max_samples_;
289 int sampling_interval_us_;
457 SnapshotObjectId
GetId()
const;
716 virtual ~
Node() =
default;
717 virtual const char*
Name() = 0;
763 virtual void AddEdge(
Node* from,
Node* to,
const char* name =
nullptr) = 0;
848 bool treat_global_objects_as_roots =
true);
875 int64_t* timestamp_us =
nullptr);
912 int stack_depth = 16,
965 #define CODE_EVENTS_LIST(V) 970 V(InterpretedFunction) 985 #define V(Name) , k##Name##Type 1053 void* internal_listener_;
static void CollectSample(Isolate *isolate)
void DeleteAllHeapSnapshots()
static void UseDetailedSourcePositionsForProfiling(Isolate *isolate)
void Serialize(OutputStream *stream, SerializationFormat format=kJSON) const
void StartProfiling(Local< String > title, CpuProfilingOptions options)
virtual const char * NamePrefix()
const HeapGraphNode * GetRoot() const
void StopTrackingHeapObjects()
int GetChildrenCount() const
int64_t GetStartTime() const
CodeEventType GetCodeType()
SourceType GetSourceType() const
void RemoveBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback, void *data)
unsigned int GetHitLineCount() const
virtual ~ActivityControl()=default
void StartProfiling(Local< String > title, CpuProfilingMode mode, bool record_samples=false, unsigned max_samples=CpuProfilingOptions::kNoSampleLimit)
std::vector< Node * > children
const HeapGraphEdge * GetChild(int index) const
const std::vector< CpuProfileDeoptInfo > & GetDeoptInfos() const
const HeapGraphNode * GetToNode() const
virtual ~AllocationProfile()=default
static const int kNoColumnInfo
static const int kNoColumnNumberInfo
CpuProfile * StopProfiling(Local< String > title)
virtual size_t SizeInBytes()=0
SnapshotObjectId GetObjectId(Local< Value > value)
virtual ~EmbedderGraph()=default
Local< String > GetFunctionName() const
static const int kNoLineNumberInfo
const char * GetScriptResourceNameStr() const
void SetSamplingInterval(int us)
int GetChildrenCount() const
virtual ControlOption ReportProgressValue(int done, int total)=0
const HeapSnapshot * TakeHeapSnapshot(ActivityControl *control=nullptr, ObjectNameResolver *global_object_name_resolver=nullptr, bool treat_global_objects_as_roots=true)
const char * GetBailoutReason() const
static CpuProfiler * New(Isolate *isolate, CpuProfilingNamingMode=kDebugNaming, CpuProfilingLoggingMode=kLazyLogging)
virtual ~OutputStream()=default
void StartProfiling(Local< String > title, bool record_samples=false)
virtual const std::vector< Sample > & GetSamples()=0
bool IsScriptSharedCrossOrigin() const
const HeapGraphNode * GetNode(int index) const
V8_INLINE bool IsEmpty() const
unsigned GetHitCount() const
const HeapGraphNode * GetNodeById(SnapshotObjectId id) const
Local< String > GetScriptName()
Local< String > GetFunctionName()
const HeapGraphNode * GetFromNode() const
SnapshotObjectId GetObjectId(NativeObject value)
virtual bool IsRootNode()
static const int kNoColumnNumberInfo
Node(const Node &)=delete
int GetNodesCount() const
uintptr_t GetCodeStartAddress()
Local< String > GetName() const
CpuProfilingMode mode() const
virtual const char * Name()=0
virtual int GetChunkSize()
static const uint16_t kPersistentHandleNoClassId
const CpuProfileNode * GetSample(int index) const
virtual bool IsEmbedderNode()
HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size)
#define CODE_EVENTS_LIST(V)
virtual NativeObject GetNativeObject()
std::vector< CpuProfileDeoptFrame > stack
virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate *data, int count)
void StopSamplingHeapProfiler()
unsigned max_samples() const
unsigned GetNodeId() const
virtual Node * V8Node(const v8::Local< v8::Value > &value)=0
int GetLineNumber() const
static const int kNoLineNumberInfo
int GetColumnNumber() const
const char * GetFunctionNameStr() const
bool GetLineTicks(LineTick *entries, unsigned int length) const
std::vector< Allocation > allocations
virtual ~ObjectNameResolver()=default
SnapshotObjectId GetHeapStats(OutputStream *stream, int64_t *timestamp_us=nullptr)
int sampling_interval_us() const
virtual void AddEdge(Node *from, Node *to, const char *name=nullptr)=0
uintptr_t GetPreviousCodeStartAddress()
static const unsigned kNoSampleLimit
Local< Value > GetName() const
Local< Value > FindObjectById(SnapshotObjectId id)
const CpuProfileNode * GetTopDownRoot() const
virtual WriteResult WriteAsciiChunk(char *data, int size)=0
const char * deopt_reason
SnapshotObjectId GetMaxSnapshotJSObjectId() const
Node & operator=(const Node &)=delete
int GetSamplesCount() const
virtual Node * WrapperNode()
AllocationProfile * GetAllocationProfile()
virtual ~CodeEventHandler()
virtual Node * GetRootNode()=0
void SetUsePreciseSampling(bool)
virtual void Handle(CodeEvent *code_event)=0
void(* BuildEmbedderGraphCallback)(v8::Isolate *isolate, v8::EmbedderGraph *graph, void *data)
bool StartSamplingHeapProfiler(uint64_t sample_interval=512 *1024, int stack_depth=16, SamplingFlags flags=kSamplingNoFlags)
Local< String > GetTitle() const
const char * GetComment()
CpuProfilingOptions(CpuProfilingMode mode=kLeafNodeLineNumbers, unsigned max_samples=kNoSampleLimit, int sampling_interval_us=0, MaybeLocal< Context > filter_context=MaybeLocal< Context >())
void StartTrackingHeapObjects(bool track_allocations=false)
const CpuProfileNode * GetChild(int index) const
static const char * GetCodeEventTypeName(CodeEventType code_event_type)
Local< String > GetScriptResourceName() const
virtual void EndOfStream()=0
void AddBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback, void *data)
int64_t GetEndTime() const
SnapshotObjectId GetId() const
static const int kNoLineNumberInfo
Local< String > script_name
virtual const char * GetName(Local< Object > object)=0
size_t GetShallowSize() const
CodeEventHandler(Isolate *isolate)
const HeapSnapshot * GetHeapSnapshot(int index)
int64_t GetSampleTimestamp(int index) const
const CpuProfileNode * GetParent() const
static const SnapshotObjectId kUnknownObjectId
virtual Node * AddNode(std::unique_ptr< Node > node)=0