Loading...
Searching...
No Matches
v8-profiler.h
Go to the documentation of this file.
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
3// found in the LICENSE file.
4
5#ifndef V8_V8_PROFILER_H_
6#define V8_V8_PROFILER_H_
7
8#include <limits.h>
9
10#include <memory>
11#include <unordered_set>
12#include <vector>
13
14#include "cppgc/common.h" // NOLINT(build/include_directory)
15#include "v8-local-handle.h" // NOLINT(build/include_directory)
16#include "v8-message.h" // NOLINT(build/include_directory)
17#include "v8-persistent-handle.h" // NOLINT(build/include_directory)
18
22namespace v8 {
23
24enum class EmbedderStateTag : uint8_t;
25class HeapGraphNode;
26struct HeapStatsUpdate;
27class Object;
28enum StateTag : uint16_t;
29
30using NativeObject = void*;
31using SnapshotObjectId = uint32_t;
32using ProfilerId = uint32_t;
33
36 size_t position;
37};
38
39namespace internal {
40class CpuProfile;
41} // namespace internal
42
43} // namespace v8
44
45#ifdef V8_OS_WIN
46template class V8_EXPORT std::vector<v8::CpuProfileDeoptFrame>;
47#endif
48
49namespace v8 {
50
54enum class CpuProfileSource : uint8_t {
56 kUnspecified = 0,
58 kInspector = 1,
63 kInternal = 3,
64};
65
68 const char* deopt_reason;
69 std::vector<CpuProfileDeoptFrame> stack;
70};
71
72} // namespace v8
73
74#ifdef V8_OS_WIN
75template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>;
76#endif
77
78namespace v8 {
79
84 public:
85 struct LineTick {
87 int line;
88
91 int column;
92
94 unsigned int hit_count;
95 };
96
97 // An annotation hinting at the source of a CpuProfileNode.
99 // User-supplied script with associated resource information.
100 kScript = 0,
101 // Native scripts and provided builtins.
102 kBuiltin = 1,
103 // Callbacks into native code.
104 kCallback = 2,
105 // VM-internal functions or state.
107 // A node that failed to symbolize.
108 kUnresolved = 4,
109 };
110
113
119 const char* GetFunctionNameStr() const;
120
122 int GetScriptId() const;
123
126
132 const char* GetScriptResourceNameStr() const;
133
139
144 int GetLineNumber() const;
145
150 int GetColumnNumber() const;
151
155 unsigned int GetHitLineCount() const;
156
162 bool GetLineTicks(LineTick* entries, unsigned int length) const;
163
167 const char* GetBailoutReason() const;
168
172 unsigned GetHitCount() const;
173
175 unsigned GetNodeId() const;
176
181
183 int GetChildrenCount() const;
184
186 const CpuProfileNode* GetChild(int index) const;
187
189 const CpuProfileNode* GetParent() const;
190
192 const std::vector<CpuProfileDeoptInfo>& GetDeoptInfos() const;
193
194 static const int kNoLineNumberInfo = Message::kNoLineNumberInfo;
195 static const int kNoColumnNumberInfo = Message::kNoColumnInfo;
196};
197
202 public:
203 enum WriteResult { kContinue = 0, kAbort = 1 };
204 virtual ~OutputStream() = default;
206 virtual void EndOfStream() = 0;
208 virtual int GetChunkSize() { return 1024; }
214 virtual WriteResult WriteAsciiChunk(char* data, int size) = 0;
221 return kAbort;
222 }
223};
224
230 public:
232 kJSON = 0 // See format description near 'Serialize' method.
233 };
236
239
244 int GetSamplesCount() const;
245
250 const CpuProfileNode* GetSample(int index) const;
251
257 int64_t GetSampleTimestamp(int index) const;
258
263 int64_t GetStartTime() const;
264
268 StateTag GetSampleState(int index) const;
269
274
280 int64_t GetEndTime() const;
281
286 void Delete();
287
305 SerializationFormat format = kJSON) const;
306};
307
309 // In the resulting CpuProfile tree, intermediate nodes in a stack trace
310 // (from the root to a leaf) will have line numbers that point to the start
311 // line of the function, rather than the line of the callsite of the child.
313 // In the resulting CpuProfile tree, nodes are separated based on the line
314 // number of their callsite in their parent.
316};
317
318// Determines how names are derived for functions sampled.
320 // Use the immediate name of functions at compilation time.
322 // Use more verbose naming for functions without names, inferred from scope
323 // where possible.
325};
326
328 // Enables logging when a profile is active, and disables logging when all
329 // profiles are detached.
331 // Enables logging for the lifetime of the CpuProfiler. Calls to
332 // StartRecording are faster, at the expense of runtime overhead.
334};
335
336// Enum for returning profiling status. Once StartProfiling is called,
337// we want to return to clients whether the profiling was able to start
338// correctly, or return a descriptive error.
340 kStarted,
343};
344
352};
353
358 public:
360
361 virtual ~DiscardedSamplesDelegate() = default;
362 virtual void Notify() = 0;
363
364 ProfilerId GetId() const { return profiler_id_; }
365
366 private:
367 friend internal::CpuProfile;
368
369 void SetId(ProfilerId id) { profiler_id_ = id; }
370
371 ProfilerId profiler_id_;
372};
373
378 public:
379 // Indicates that the sample buffer size should not be explicitly limited.
380 static const unsigned kNoSampleLimit = UINT_MAX;
381
399 CpuProfilingMode mode = kLeafNodeLineNumbers,
400 unsigned max_samples = kNoSampleLimit, int sampling_interval_us = 0,
401 MaybeLocal<Context> filter_context = MaybeLocal<Context>(),
402 CpuProfileSource profile_source = CpuProfileSource::kUnspecified);
403
406
407 CpuProfilingMode mode() const { return mode_; }
408 unsigned max_samples() const { return max_samples_; }
409 int sampling_interval_us() const { return sampling_interval_us_; }
410 CpuProfileSource profile_source() const { return profile_source_; }
411
412 private:
413 friend class internal::CpuProfile;
414
415 bool has_filter_context() const { return !filter_context_.IsEmpty(); }
416 void* raw_filter_context() const;
417
418 CpuProfilingMode mode_;
419 unsigned max_samples_;
420 int sampling_interval_us_;
421 Global<Context> filter_context_;
422 CpuProfileSource profile_source_;
423};
424
430 public:
436 static CpuProfiler* New(Isolate* isolate,
437 CpuProfilingNamingMode = kDebugNaming,
438 CpuProfilingLoggingMode = kLazyLogging);
439
447 static void CollectSample(
448 Isolate* isolate, const std::optional<uint64_t> trace_id = std::nullopt);
449
453 void Dispose();
454
461
470
476 CpuProfilingOptions options,
477 std::unique_ptr<DiscardedSamplesDelegate> delegate = nullptr);
478
485 Local<String> title, CpuProfilingOptions options,
486 std::unique_ptr<DiscardedSamplesDelegate> delegate = nullptr);
487
500 Local<String> title, CpuProfilingMode mode, bool record_samples = false,
501 unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
502
508 CpuProfilingResult Start(Local<String> title, bool record_samples = false);
509
516 Local<String> title, CpuProfilingOptions options,
517 std::unique_ptr<DiscardedSamplesDelegate> delegate = nullptr);
518
531 Local<String> title, CpuProfilingMode mode, bool record_samples = false,
532 unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
533
540 bool record_samples = false);
541
546
552
558
559 private:
560 CpuProfiler();
561 ~CpuProfiler();
562 CpuProfiler(const CpuProfiler&);
563 CpuProfiler& operator=(const CpuProfiler&);
564};
565
571 public:
572 enum Type {
573 kContextVariable = 0, // A variable from a function context.
574 kElement = 1, // An element of an array.
575 kProperty = 2, // A named object property.
576 kInternal = 3, // A link that can't be accessed from JS,
577 // thus, its name isn't a real property name
578 // (e.g. parts of a ConsString).
579 kHidden = 4, // A link that is needed for proper sizes
580 // calculation, but may be hidden from user.
581 kShortcut = 5, // A link that must not be followed during
582 // sizes calculation.
583 kWeak = 6 // A weak reference (ignored by the GC).
584 };
585
587 Type GetType() const;
588
594
597
599 const HeapGraphNode* GetToNode() const;
600};
601
602
607 public:
608 enum Type {
609 kHidden = 0, // Hidden node, may be filtered when shown to user.
610 kArray = 1, // An array of elements.
611 kString = 2, // A string.
612 kObject = 3, // A JS object (except for arrays and strings).
613 kCode = 4, // Compiled code.
614 kClosure = 5, // Function closure.
615 kRegExp = 6, // RegExp.
616 kHeapNumber = 7, // Number stored in the heap.
617 kNative = 8, // Native object (not from V8 heap).
618 kSynthetic = 9, // Synthetic object, usually used for grouping
619 // snapshot items together.
620 kConsString = 10, // Concatenated string. A pair of pointers to strings.
621 kSlicedString = 11, // Sliced string. A fragment of another string.
622 kSymbol = 12, // A Symbol (ES6).
623 kBigInt = 13, // BigInt.
624 kObjectShape = 14, // Internal data used for tracking the shapes (or
625 // "hidden classes") of JS objects.
626 };
627
629 Type GetType() const;
630
637
643
645 size_t GetShallowSize() const;
646
648 int GetChildrenCount() const;
649
651 const HeapGraphEdge* GetChild(int index) const;
652};
653
658 public:
660 kJSON = 0 // See format description near 'Serialize' method.
661 };
662
664 const HeapGraphNode* GetRoot() const;
665
668
670 int GetNodesCount() const;
671
673 const HeapGraphNode* GetNode(int index) const;
674
677
683 void Delete();
684
712 SerializationFormat format = kJSON) const;
713};
714
715
721 public:
723 kContinue = 0,
724 kAbort = 1
725 };
726 virtual ~ActivityControl() = default;
731 virtual ControlOption ReportProgressValue(uint32_t done, uint32_t total) = 0;
732};
733
739 public:
740 struct Allocation {
744 size_t size;
745
749 unsigned int count;
750 };
751
755 struct Node {
761
767
773
778
784
790
794 uint32_t node_id;
795
801 std::vector<Node*> children;
802
806 std::vector<Allocation> allocations;
807 };
808
812 struct Sample {
816 uint32_t node_id;
817
821 size_t size;
822
826 unsigned int count;
827
832 uint64_t sample_id;
833 };
834
840 virtual Node* GetRootNode() = 0;
841 virtual const std::vector<Sample>& GetSamples() = 0;
842
843 virtual ~AllocationProfile() = default;
844
845 static const int kNoLineNumberInfo = Message::kNoLineNumberInfo;
846 static const int kNoColumnNumberInfo = Message::kNoColumnInfo;
847};
848
864 public:
865 class Node {
866 public:
874 enum class Detachedness : uint8_t {
875 kUnknown = 0,
876 kAttached = 1,
877 kDetached = 2,
878 };
879
880 Node() = default;
881 virtual ~Node() = default;
882 virtual const char* Name() = 0;
883 virtual size_t SizeInBytes() = 0;
889 virtual Node* WrapperNode() { return nullptr; }
890 virtual bool IsRootNode() { return false; }
892 virtual bool IsEmbedderNode() { return true; }
896 virtual const char* NamePrefix() { return nullptr; }
897
902 virtual NativeObject GetNativeObject() { return nullptr; }
903
910 virtual Detachedness GetDetachedness() { return Detachedness::kUnknown; }
911
919 virtual const void* GetAddress() { return nullptr; }
920
921 Node(const Node&) = delete;
922 Node& operator=(const Node&) = delete;
923 };
924
935 virtual Node* V8Node(const v8::Local<v8::Value>& value) = 0;
936
948 virtual Node* V8Node(const v8::Local<v8::Data>& value);
949
954 virtual Node* AddNode(std::unique_ptr<Node> node) = 0;
955
964 virtual void AddEdge(Node* from, Node* to, const char* name = nullptr) = 0;
965
973 virtual void AddNativeSize(size_t size) {}
974
975 virtual ~EmbedderGraph() = default;
976};
977
979 public:
980 virtual ~QueryObjectPredicate() = default;
981 virtual bool Filter(v8::Local<v8::Object> object) = 0;
982};
983
989 public:
991 QueryObjectPredicate* predicate,
992 std::vector<v8::Global<v8::Object>>* objects);
993
995 kSamplingNoFlags = 0,
996 kSamplingForceGC = 1 << 0,
997 kSamplingIncludeObjectsCollectedByMajorGC = 1 << 1,
998 kSamplingIncludeObjectsCollectedByMinorGC = 1 << 2,
999 };
1000
1007 typedef void (*BuildEmbedderGraphCallback)(v8::Isolate* isolate,
1008 v8::EmbedderGraph* graph,
1009 void* data);
1010
1020 v8::Isolate* isolate, const v8::Local<v8::Value>& v8_value,
1021 uint16_t class_id, void* data);
1022
1025
1028
1034
1040
1046
1053
1059 static const SnapshotObjectId kUnknownObjectId = 0;
1060
1066 class V8_DEPRECATE_SOON("Use ContextNameResolver instead.")
1068 public:
1073 virtual const char* GetName(Local<Object> object) = 0;
1074
1075 protected:
1076 virtual ~ObjectNameResolver() = default;
1077 };
1078
1084 public:
1090 virtual const char* GetName(Local<Context> context) = 0;
1091
1092 protected:
1093 virtual ~ContextNameResolver() = default;
1094 };
1095
1096 enum class HeapSnapshotMode {
1100 kRegular,
1104 kExposeInternals,
1105 };
1106
1107 enum class NumericsMode {
1112 kHideNumericValues,
1116 kExposeNumericValues
1117 };
1118
1119 struct HeapSnapshotOptions final {
1120 // Manually define default constructor here to be able to use it in
1121 // `TakeSnapshot()` below.
1122 // NOLINTNEXTLINE
1124
1128 ActivityControl* control = nullptr;
1133 ContextNameResolver* context_name_resolver = nullptr;
1137 HeapSnapshotMode snapshot_mode = HeapSnapshotMode::kRegular;
1141 NumericsMode numerics_mode = NumericsMode::kHideNumericValues;
1147 };
1148
1155 const HeapSnapshotOptions& options = HeapSnapshotOptions());
1156
1164 ContextNameResolver* resolver = nullptr,
1165 bool hide_internals = true,
1166 bool capture_numeric_value = false);
1167
1172 std::vector<v8::Local<v8::Value>> GetDetachedJSWrapperObjects();
1173
1183 void StartTrackingHeapObjects(bool track_allocations = false);
1184
1199 int64_t* timestamp_us = nullptr);
1200
1207
1233 bool StartSamplingHeapProfiler(uint64_t sample_interval = 512 * 1024,
1234 int stack_depth = 16,
1235 SamplingFlags flags = kSamplingNoFlags);
1236
1241
1249
1255
1256 void AddBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback,
1257 void* data);
1258 void RemoveBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback,
1259 void* data);
1260
1262
1267
1273 const char* CopyNameForHeapSnapshot(const char* name);
1274
1280 static const uint16_t kPersistentHandleNoClassId = 0;
1281
1282 private:
1283 HeapProfiler();
1284 ~HeapProfiler();
1285 HeapProfiler(const HeapProfiler&);
1286 HeapProfiler& operator=(const HeapProfiler&);
1287};
1288
1294 HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size)
1295 : index(index), count(count), size(size) { }
1296 uint32_t index; // Index of the time interval that was changed.
1297 uint32_t count; // New value of count field for the interval with this index.
1298 uint32_t size; // New value of size field for the interval with this index.
1299};
1300
1301#define CODE_EVENTS_LIST(V) \
1302 V(Builtin) \
1303 V(Callback) \
1304 V(Eval) \
1305 V(Function) \
1306 V(InterpretedFunction) \
1307 V(Handler) \
1308 V(BytecodeHandler) \
1309 V(LazyCompile) /* Unused, use kFunction instead */ \
1310 V(RegExp) \
1311 V(Script) \
1312 V(Stub) \
1313 V(Relocation)
1314
1320 kUnknownType = 0
1321#define V(Name) , k##Name##Type
1323#undef V
1324};
1325
1329class V8_EXPORT CodeEvent {
1330 public:
1331 uintptr_t GetCodeStartAddress();
1332 size_t GetCodeSize();
1333 Local<String> GetFunctionName();
1334 Local<String> GetScriptName();
1335 int GetScriptLine();
1336 int GetScriptColumn();
1342 CodeEventType GetCodeType();
1343 const char* GetComment();
1345 static const char* GetCodeEventTypeName(CodeEventType code_event_type);
1347 uintptr_t GetPreviousCodeStartAddress();
1348};
1349
1354 public:
1360 explicit CodeEventHandler(Isolate* isolate);
1361 virtual ~CodeEventHandler();
1362
1371 virtual void Handle(CodeEvent* code_event) = 0;
1372
1377 void Enable();
1378
1383 void Disable();
1384
1385 private:
1388 CodeEventHandler& operator=(const CodeEventHandler&);
1389 void* internal_listener_;
1390};
1391
1392} // namespace v8
1393
1394
1395#endif // V8_V8_PROFILER_H_
Definition: v8-profiler.h:720
ControlOption
Definition: v8-profiler.h:722
virtual ControlOption ReportProgressValue(uint32_t done, uint32_t total)=0
virtual ~ActivityControl()=default
Definition: v8-profiler.h:738
virtual const std::vector< Sample > & GetSamples()=0
virtual Node * GetRootNode()=0
virtual ~AllocationProfile()=default
Definition: v8-profiler.h:1352
Definition: v8-profiler.h:1328
Definition: v8-profiler.h:83
const CpuProfileNode * GetChild(int index) const
bool GetLineTicks(LineTick *entries, unsigned int length) const
const CpuProfileNode * GetParent() const
unsigned GetHitCount() const
unsigned int GetHitLineCount() const
int GetLineNumber() const
unsigned GetNodeId() const
const char * GetScriptResourceNameStr() const
const char * GetFunctionNameStr() const
const std::vector< CpuProfileDeoptInfo > & GetDeoptInfos() const
SourceType
Definition: v8-profiler.h:98
int GetColumnNumber() const
Local< String > GetFunctionName() const
Local< String > GetScriptResourceName() const
SourceType GetSourceType() const
const char * GetBailoutReason() const
int GetScriptId() const
bool IsScriptSharedCrossOrigin() const
int GetChildrenCount() const
Definition: v8-profiler.h:229
const CpuProfileNode * GetTopDownRoot() const
int GetSamplesCount() const
StateTag GetSampleState(int index) const
Local< String > GetTitle() const
int64_t GetEndTime() const
const CpuProfileNode * GetSample(int index) const
SerializationFormat
Definition: v8-profiler.h:231
int64_t GetSampleTimestamp(int index) const
int64_t GetStartTime() const
EmbedderStateTag GetSampleEmbedderState(int index) const
void Serialize(OutputStream *stream, SerializationFormat format=kJSON) const
Definition: v8-profiler.h:429
CpuProfilingResult Start(CpuProfilingOptions options, std::unique_ptr< DiscardedSamplesDelegate > delegate=nullptr)
static void CollectSample(Isolate *isolate, const std::optional< uint64_t > trace_id=std::nullopt)
CpuProfilingStatus StartProfiling(Local< String > title, CpuProfilingOptions options, std::unique_ptr< DiscardedSamplesDelegate > delegate=nullptr)
void SetUsePreciseSampling(bool)
static CpuProfiler * New(Isolate *isolate, CpuProfilingNamingMode=kDebugNaming, CpuProfilingLoggingMode=kLazyLogging)
CpuProfilingResult Start(Local< String > title, CpuProfilingMode mode, bool record_samples=false, unsigned max_samples=CpuProfilingOptions::kNoSampleLimit)
CpuProfilingStatus StartProfiling(Local< String > title, CpuProfilingMode mode, bool record_samples=false, unsigned max_samples=CpuProfilingOptions::kNoSampleLimit)
CpuProfile * StopProfiling(Local< String > title)
CpuProfilingResult Start(Local< String > title, CpuProfilingOptions options, std::unique_ptr< DiscardedSamplesDelegate > delegate=nullptr)
void SetSamplingInterval(int us)
CpuProfile * Stop(ProfilerId id)
static void UseDetailedSourcePositionsForProfiling(Isolate *isolate)
CpuProfilingStatus StartProfiling(Local< String > title, bool record_samples=false)
CpuProfilingResult Start(Local< String > title, bool record_samples=false)
Definition: v8-profiler.h:377
CpuProfilingOptions(CpuProfilingMode mode=kLeafNodeLineNumbers, unsigned max_samples=kNoSampleLimit, int sampling_interval_us=0, MaybeLocal< Context > filter_context=MaybeLocal< Context >(), CpuProfileSource profile_source=CpuProfileSource::kUnspecified)
CpuProfilingOptions & operator=(CpuProfilingOptions &&)=default
int sampling_interval_us() const
Definition: v8-profiler.h:409
CpuProfileSource profile_source() const
Definition: v8-profiler.h:410
CpuProfilingMode mode() const
Definition: v8-profiler.h:407
unsigned max_samples() const
Definition: v8-profiler.h:408
CpuProfilingOptions(CpuProfilingOptions &&)=default
Definition: v8-profiler.h:357
ProfilerId GetId() const
Definition: v8-profiler.h:364
virtual ~DiscardedSamplesDelegate()=default
Definition: v8-profiler.h:865
virtual Detachedness GetDetachedness()
Definition: v8-profiler.h:910
Detachedness
Definition: v8-profiler.h:874
Node & operator=(const Node &)=delete
virtual size_t SizeInBytes()=0
virtual bool IsEmbedderNode()
Definition: v8-profiler.h:892
virtual const char * Name()=0
virtual NativeObject GetNativeObject()
Definition: v8-profiler.h:902
virtual ~Node()=default
virtual Node * WrapperNode()
Definition: v8-profiler.h:889
Node(const Node &)=delete
virtual const char * NamePrefix()
Definition: v8-profiler.h:896
virtual const void * GetAddress()
Definition: v8-profiler.h:919
virtual bool IsRootNode()
Definition: v8-profiler.h:890
Definition: v8-profiler.h:863
virtual void AddNativeSize(size_t size)
Definition: v8-profiler.h:973
virtual ~EmbedderGraph()=default
virtual void AddEdge(Node *from, Node *to, const char *name=nullptr)=0
virtual Node * AddNode(std::unique_ptr< Node > node)=0
virtual Node * V8Node(const v8::Local< v8::Data > &value)
virtual Node * V8Node(const v8::Local< v8::Value > &value)=0
Definition: v8-persistent-handle.h:349
Definition: v8-profiler.h:570
Type
Definition: v8-profiler.h:572
const HeapGraphNode * GetToNode() const
const HeapGraphNode * GetFromNode() const
Type GetType() const
Local< Value > GetName() const
Definition: v8-profiler.h:606
Local< String > GetName() const
SnapshotObjectId GetId() const
Type GetType() const
Type
Definition: v8-profiler.h:608
const HeapGraphEdge * GetChild(int index) const
size_t GetShallowSize() const
int GetChildrenCount() const
Definition: v8-profiler.h:1083
virtual const char * GetName(Local< Context > context)=0
Definition: v8-profiler.h:1067
virtual const char * GetName(Local< Object > object)=0
Definition: v8-profiler.h:988
void StartTrackingHeapObjects(bool track_allocations=false)
void SetGetDetachednessCallback(GetDetachednessCallback callback, void *data)
const HeapSnapshot * TakeHeapSnapshot(ActivityControl *control, ContextNameResolver *resolver=nullptr, bool hide_internals=true, bool capture_numeric_value=false)
bool IsTakingSnapshot()
Local< Value > FindObjectById(SnapshotObjectId id)
AllocationProfile * GetAllocationProfile()
void RemoveBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback, void *data)
void AddBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback, void *data)
std::vector< v8::Local< v8::Value > > GetDetachedJSWrapperObjects()
void DeleteAllHeapSnapshots()
bool StartSamplingHeapProfiler(uint64_t sample_interval=512 *1024, int stack_depth=16, SamplingFlags flags=kSamplingNoFlags)
const char * CopyNameForHeapSnapshot(const char *name)
HeapSnapshotMode
Definition: v8-profiler.h:1096
SamplingFlags
Definition: v8-profiler.h:994
void QueryObjects(v8::Local< v8::Context > context, QueryObjectPredicate *predicate, std::vector< v8::Global< v8::Object > > *objects)
SnapshotObjectId GetObjectId(NativeObject value)
SnapshotObjectId GetObjectId(Local< Value > value)
void StopSamplingHeapProfiler()
const HeapSnapshot * TakeHeapSnapshot(const HeapSnapshotOptions &options=HeapSnapshotOptions())
const HeapSnapshot * GetHeapSnapshot(int index)
SnapshotObjectId GetHeapStats(OutputStream *stream, int64_t *timestamp_us=nullptr)
void StopTrackingHeapObjects()
EmbedderGraph::Node::Detachedness(*)(v8::Isolate *isolate, const v8::Local< v8::Value > &v8_value, uint16_t class_id, void *data) GetDetachednessCallback
Definition: v8-profiler.h:1021
NumericsMode
Definition: v8-profiler.h:1107
Definition: v8-profiler.h:657
const HeapGraphNode * GetNodeById(SnapshotObjectId id) const
int GetNodesCount() const
SerializationFormat
Definition: v8-profiler.h:659
const HeapGraphNode * GetRoot() const
SnapshotObjectId GetMaxSnapshotJSObjectId() const
const HeapGraphNode * GetNode(int index) const
void Serialize(OutputStream *stream, SerializationFormat format=kJSON) const
Definition: v8-isolate.h:291
Definition: v8-local-handle.h:366
Definition: v8-local-handle.h:734
Definition: v8-profiler.h:201
virtual ~OutputStream()=default
virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate *data, int count)
Definition: v8-profiler.h:220
WriteResult
Definition: v8-profiler.h:203
virtual WriteResult WriteAsciiChunk(char *data, int size)=0
virtual void EndOfStream()=0
virtual int GetChunkSize()
Definition: v8-profiler.h:208
Definition: v8-profiler.h:978
virtual bool Filter(v8::Local< v8::Object > object)=0
virtual ~QueryObjectPredicate()=default
EmbedderStackState
Definition: common.h:15
Definition: libplatform.h:15
uint32_t SnapshotObjectId
Definition: v8-profiler.h:31
CpuProfilingStatus
Definition: v8-profiler.h:339
uint32_t ProfilerId
Definition: v8-profiler.h:32
CpuProfilingLoggingMode
Definition: v8-profiler.h:327
@ kEagerLogging
Definition: v8-profiler.h:333
@ kLazyLogging
Definition: v8-profiler.h:330
EmbedderStateTag
Definition: v8-embedder-state-scope.h:22
CpuProfilingMode
Definition: v8-profiler.h:308
@ kLeafNodeLineNumbers
Definition: v8-profiler.h:312
@ kCallerLineNumbers
Definition: v8-profiler.h:315
void * NativeObject
Definition: v8-profiler.h:30
CpuProfileSource
Definition: v8-profiler.h:54
CpuProfilingNamingMode
Definition: v8-profiler.h:319
@ kStandardNaming
Definition: v8-profiler.h:321
@ kDebugNaming
Definition: v8-profiler.h:324
CodeEventType
Definition: v8-profiler.h:1319
@ kUnknownType
Definition: v8-profiler.h:1320
StateTag
Definition: v8-unwinder.h:39
Definition: v8-profiler.h:740
unsigned int count
Definition: v8-profiler.h:749
size_t size
Definition: v8-profiler.h:744
Definition: v8-profiler.h:755
std::vector< Node * > children
Definition: v8-profiler.h:801
int script_id
Definition: v8-profiler.h:772
int start_position
Definition: v8-profiler.h:777
std::vector< Allocation > allocations
Definition: v8-profiler.h:806
int column_number
Definition: v8-profiler.h:789
uint32_t node_id
Definition: v8-profiler.h:794
int line_number
Definition: v8-profiler.h:783
Local< String > script_name
Definition: v8-profiler.h:766
Local< String > name
Definition: v8-profiler.h:760
Definition: v8-profiler.h:812
unsigned int count
Definition: v8-profiler.h:826
size_t size
Definition: v8-profiler.h:821
uint32_t node_id
Definition: v8-profiler.h:816
uint64_t sample_id
Definition: v8-profiler.h:832
Definition: v8-profiler.h:34
size_t position
Definition: v8-profiler.h:36
int script_id
Definition: v8-profiler.h:35
Definition: v8-profiler.h:66
const char * deopt_reason
Definition: v8-profiler.h:68
std::vector< CpuProfileDeoptFrame > stack
Definition: v8-profiler.h:69
Definition: v8-profiler.h:85
unsigned int hit_count
Definition: v8-profiler.h:94
int column
Definition: v8-profiler.h:91
int line
Definition: v8-profiler.h:87
Definition: v8-profiler.h:349
const ProfilerId id
Definition: v8-profiler.h:350
const CpuProfilingStatus status
Definition: v8-profiler.h:351
Definition: v8-profiler.h:1119
HeapSnapshotOptions()
Definition: v8-profiler.h:1123
Definition: v8-profiler.h:1293
uint32_t size
Definition: v8-profiler.h:1298
uint32_t index
Definition: v8-profiler.h:1296
uint32_t count
Definition: v8-profiler.h:1297
HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size)
Definition: v8-profiler.h:1294
#define V(Name)
#define CODE_EVENTS_LIST(V)
Definition: v8-profiler.h:1301
#define V8_EXPORT
Definition: v8config.h:854
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:621