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
66using SampleContextExtractor = void* (*)(Isolate*);
67
70 size_t position;
71};
72
73namespace internal {
74class CpuProfile;
75} // namespace internal
76
77} // namespace v8
78
79#ifdef V8_OS_WIN
80template class V8_EXPORT std::vector<v8::CpuProfileDeoptFrame>;
81#endif
82
83namespace v8 {
84
88enum class CpuProfileSource : uint8_t {
90 kUnspecified = 0,
92 kInspector = 1,
97 kInternal = 3,
98};
99
102 const char* deopt_reason;
103 std::vector<CpuProfileDeoptFrame> stack;
104};
105
106} // namespace v8
107
108#ifdef V8_OS_WIN
109template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>;
110#endif
111
112namespace v8 {
113
118 public:
119 struct LineTick {
121 int line;
122
126
128 unsigned int hit_count;
129 };
130
131 // An annotation hinting at the source of a CpuProfileNode.
133 // User-supplied script with associated resource information.
134 kScript = 0,
135 // Native scripts and provided builtins.
136 kBuiltin = 1,
137 // Callbacks into native code.
138 kCallback = 2,
139 // VM-internal functions or state.
141 // A node that failed to symbolize.
142 kUnresolved = 4,
143 };
144
147
153 const char* GetFunctionNameStr() const;
154
156 int GetScriptId() const;
157
160
166 const char* GetScriptResourceNameStr() const;
167
173
178 int GetLineNumber() const;
179
184 int GetColumnNumber() const;
185
189 unsigned int GetHitLineCount() const;
190
196 bool GetLineTicks(LineTick* entries, unsigned int length) const;
197
201 const char* GetBailoutReason() const;
202
206 unsigned GetHitCount() const;
207
209 unsigned GetNodeId() const;
210
215
217 int GetChildrenCount() const;
218
220 const CpuProfileNode* GetChild(int index) const;
221
223 const CpuProfileNode* GetParent() const;
224
226 const std::vector<CpuProfileDeoptInfo>& GetDeoptInfos() const;
227
228 static const int kNoLineNumberInfo = Message::kNoLineNumberInfo;
229 static const int kNoColumnNumberInfo = Message::kNoColumnInfo;
230};
231
236 public:
237 enum WriteResult { kContinue = 0, kAbort = 1 };
238 virtual ~OutputStream() = default;
240 virtual void EndOfStream() = 0;
242 virtual int GetChunkSize() { return 1024; }
248 virtual WriteResult WriteAsciiChunk(char* data, int size) = 0;
255 return kAbort;
256 }
257};
258
264 public:
266 kJSON = 0 // See format description near 'Serialize' method.
267 };
270
273
278 int GetSamplesCount() const;
279
284 const CpuProfileNode* GetSample(int index) const;
285
291 int64_t GetSampleTimestamp(int index) const;
292
297 int64_t GetStartTime() const;
298
302 StateTag GetSampleState(int index) const;
303
308
316 void* GetSampleContext(int index) const;
317
323 int64_t GetEndTime() const;
324
329 void Delete();
330
348 SerializationFormat format = kJSON) const;
349};
350
352 // In the resulting CpuProfile tree, intermediate nodes in a stack trace
353 // (from the root to a leaf) will have line numbers that point to the start
354 // line of the function, rather than the line of the callsite of the child.
356 // In the resulting CpuProfile tree, nodes are separated based on the line
357 // number of their callsite in their parent.
359};
360
361// Determines how names are derived for functions sampled.
363 // Use the immediate name of functions at compilation time.
365 // Use more verbose naming for functions without names, inferred from scope
366 // where possible.
368};
369
371 // Enables logging when a profile is active, and disables logging when all
372 // profiles are detached.
374 // Enables logging for the lifetime of the CpuProfiler. Calls to
375 // StartRecording are faster, at the expense of runtime overhead.
377};
378
379// Enum for returning profiling status. Once StartProfiling is called,
380// we want to return to clients whether the profiling was able to start
381// correctly, or return a descriptive error.
383 kStarted,
386};
387
395};
396
401 public:
403
404 virtual ~DiscardedSamplesDelegate() = default;
405 virtual void Notify() = 0;
406
407 ProfilerId GetId() const { return profiler_id_; }
408
409 private:
410 friend internal::CpuProfile;
411
412 void SetId(ProfilerId id) { profiler_id_ = id; }
413
414 ProfilerId profiler_id_;
415};
416
421 public:
422 // Indicates that the sample buffer size should not be explicitly limited.
423 static const unsigned kNoSampleLimit = UINT_MAX;
424
442 CpuProfilingMode mode = kLeafNodeLineNumbers,
443 unsigned max_samples = kNoSampleLimit, int sampling_interval_us = 0,
444 MaybeLocal<Context> filter_context = MaybeLocal<Context>(),
445 CpuProfileSource profile_source = CpuProfileSource::kUnspecified);
446
449
450 CpuProfilingMode mode() const { return mode_; }
451 unsigned max_samples() const { return max_samples_; }
452 int sampling_interval_us() const { return sampling_interval_us_; }
453 CpuProfileSource profile_source() const { return profile_source_; }
454
455 private:
456 friend class internal::CpuProfile;
457
458 bool has_filter_context() const { return !filter_context_.IsEmpty(); }
459 void* raw_filter_context() const;
460
461 CpuProfilingMode mode_;
462 unsigned max_samples_;
463 int sampling_interval_us_;
464 Global<Context> filter_context_;
465 CpuProfileSource profile_source_;
466};
467
473 public:
479 static CpuProfiler* New(Isolate* isolate,
480 CpuProfilingNamingMode = kDebugNaming,
481 CpuProfilingLoggingMode = kLazyLogging);
482
490 static void CollectSample(
491 Isolate* isolate, const std::optional<uint64_t> trace_id = std::nullopt);
492
496 void Dispose();
497
504
513
524
530 CpuProfilingOptions options,
531 std::unique_ptr<DiscardedSamplesDelegate> delegate = nullptr);
532
539 Local<String> title, CpuProfilingOptions options,
540 std::unique_ptr<DiscardedSamplesDelegate> delegate = nullptr);
541
554 Local<String> title, CpuProfilingMode mode, bool record_samples = false,
555 unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
556
562 CpuProfilingResult Start(Local<String> title, bool record_samples = false);
563
570 Local<String> title, CpuProfilingOptions options,
571 std::unique_ptr<DiscardedSamplesDelegate> delegate = nullptr);
572
585 Local<String> title, CpuProfilingMode mode, bool record_samples = false,
586 unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
587
594 bool record_samples = false);
595
600
606
612
613 private:
614 CpuProfiler();
615 ~CpuProfiler();
616 CpuProfiler(const CpuProfiler&);
617 CpuProfiler& operator=(const CpuProfiler&);
618};
619
625 public:
626 enum Type {
627 kContextVariable = 0, // A variable from a function context.
628 kElement = 1, // An element of an array.
629 kProperty = 2, // A named object property.
630 kInternal = 3, // A link that can't be accessed from JS,
631 // thus, its name isn't a real property name
632 // (e.g. parts of a ConsString).
633 kHidden = 4, // A link that is needed for proper sizes
634 // calculation, but may be hidden from user.
635 kShortcut = 5, // A link that must not be followed during
636 // sizes calculation.
637 kWeak = 6 // A weak reference (ignored by the GC).
638 };
639
641 Type GetType() const;
642
648
651
653 const HeapGraphNode* GetToNode() const;
654};
655
656
661 public:
662 enum Type {
663 kHidden = 0, // Hidden node, may be filtered when shown to user.
664 kArray = 1, // An array of elements.
665 kString = 2, // A string.
666 kObject = 3, // A JS object (except for arrays and strings).
667 kCode = 4, // Compiled code.
668 kClosure = 5, // Function closure.
669 kRegExp = 6, // RegExp.
670 kHeapNumber = 7, // Number stored in the heap.
671 kNative = 8, // Native object (not from V8 heap).
672 kSynthetic = 9, // Synthetic object, usually used for grouping
673 // snapshot items together.
674 kConsString = 10, // Concatenated string. A pair of pointers to strings.
675 kSlicedString = 11, // Sliced string. A fragment of another string.
676 kSymbol = 12, // A Symbol (ES6).
677 kBigInt = 13, // BigInt.
678 kObjectShape = 14, // Internal data used for tracking the shapes (or
679 // "hidden classes") of JS objects.
680 };
681
683 Type GetType() const;
684
691
697
699 size_t GetShallowSize() const;
700
702 int GetChildrenCount() const;
703
705 const HeapGraphEdge* GetChild(int index) const;
706};
707
712 public:
714 kJSON = 0 // See format description near 'Serialize' method.
715 };
716
718 const HeapGraphNode* GetRoot() const;
719
722
724 int GetNodesCount() const;
725
727 const HeapGraphNode* GetNode(int index) const;
728
731
737 void Delete();
738
766 SerializationFormat format = kJSON) const;
767};
768
769
775 public:
777 kContinue = 0,
778 kAbort = 1
779 };
780 virtual ~ActivityControl() = default;
785 virtual ControlOption ReportProgressValue(uint32_t done, uint32_t total) = 0;
786};
787
793 public:
794 struct Allocation {
798 size_t size;
799
803 unsigned int count;
804 };
805
809 struct Node {
815
821
827
832
838
844
848 uint32_t node_id;
849
855 std::vector<Node*> children;
856
860 std::vector<Allocation> allocations;
861 };
862
866 struct Sample {
870 uint32_t node_id;
871
875 size_t size;
876
880 unsigned int count;
881
886 uint64_t sample_id;
887
893
898
905 void* context = nullptr;
906 };
907
913 virtual Node* GetRootNode() = 0;
914 virtual const std::vector<Sample>& GetSamples() = 0;
915
916 virtual ~AllocationProfile() = default;
917
918 static const int kNoLineNumberInfo = Message::kNoLineNumberInfo;
919 static const int kNoColumnNumberInfo = Message::kNoColumnInfo;
920};
921
937 public:
938 class Node {
939 public:
947 enum class Detachedness : uint8_t {
948 kUnknown = 0,
949 kAttached = 1,
950 kDetached = 2,
951 };
952
953 Node() = default;
954 virtual ~Node() = default;
955 virtual const char* Name() = 0;
956 virtual size_t SizeInBytes() = 0;
962 virtual Node* WrapperNode() { return nullptr; }
963 virtual bool IsRootNode() { return false; }
965 virtual bool IsEmbedderNode() { return true; }
969 virtual const char* NamePrefix() { return nullptr; }
970
975 virtual NativeObject GetNativeObject() { return nullptr; }
976
983 virtual Detachedness GetDetachedness() { return Detachedness::kUnknown; }
984
992 virtual const void* GetAddress() { return nullptr; }
993
994 Node(const Node&) = delete;
995 Node& operator=(const Node&) = delete;
996 };
997
1008 virtual Node* V8Node(const v8::Local<v8::Value>& value) = 0;
1009
1021 virtual Node* V8Node(const v8::Local<v8::Data>& value);
1022
1027 virtual Node* AddNode(std::unique_ptr<Node> node) = 0;
1028
1037 virtual void AddEdge(Node* from, Node* to, const char* name = nullptr) = 0;
1038
1047 virtual void AddWeakEdge(Node* from, Node* to, const char* name = nullptr) {
1048 AddEdge(from, to, name);
1049 }
1050
1058 virtual void AddNativeSize(size_t size) {}
1059
1060 virtual ~EmbedderGraph() = default;
1061};
1062
1064 public:
1065 virtual ~QueryObjectPredicate() = default;
1066 virtual bool Filter(v8::Local<v8::Object> object) = 0;
1067};
1068
1074 public:
1076 QueryObjectPredicate* predicate,
1077 std::vector<v8::Global<v8::Object>>* objects);
1078
1080 kSamplingNoFlags = 0,
1081 kSamplingForceGC = 1 << 0,
1082 kSamplingIncludeObjectsCollectedByMajorGC = 1 << 1,
1083 kSamplingIncludeObjectsCollectedByMinorGC = 1 << 2,
1084 };
1085
1092 typedef void (*BuildEmbedderGraphCallback)(v8::Isolate* isolate,
1093 v8::EmbedderGraph* graph,
1094 void* data);
1095
1105 v8::Isolate* isolate, const v8::Local<v8::Value>& v8_value,
1106 uint16_t class_id, void* data);
1107
1110
1113
1119
1125
1131
1138
1144 static const SnapshotObjectId kUnknownObjectId = 0;
1145
1151 class V8_DEPRECATE_SOON("Use ContextNameResolver instead.")
1153 public:
1158 virtual const char* GetName(Local<Object> object) = 0;
1159
1160 protected:
1161 virtual ~ObjectNameResolver() = default;
1162 };
1163
1169 public:
1175 virtual const char* GetName(Local<Context> context) = 0;
1176
1177 protected:
1178 virtual ~ContextNameResolver() = default;
1179 };
1180
1181 enum class HeapSnapshotMode {
1185 kRegular,
1189 kExposeInternals,
1190 };
1191
1192 enum class NumericsMode {
1197 kHideNumericValues,
1201 kExposeNumericValues
1202 };
1203
1204 struct HeapSnapshotOptions final {
1205 // Manually define default constructor here to be able to use it in
1206 // `TakeSnapshot()` below.
1207 // NOLINTNEXTLINE
1209
1213 ActivityControl* control = nullptr;
1218 ContextNameResolver* context_name_resolver = nullptr;
1222 HeapSnapshotMode snapshot_mode = HeapSnapshotMode::kRegular;
1226 NumericsMode numerics_mode = NumericsMode::kHideNumericValues;
1232 };
1233
1240 const HeapSnapshotOptions& options = HeapSnapshotOptions());
1241
1249 ContextNameResolver* resolver = nullptr,
1250 bool hide_internals = true,
1251 bool capture_numeric_value = false);
1252
1257 std::vector<v8::Local<v8::Value>> GetDetachedJSWrapperObjects();
1258
1268 void StartTrackingHeapObjects(bool track_allocations = false);
1269
1284 int64_t* timestamp_us = nullptr);
1285
1292
1326 uint64_t sample_interval = 512 * 1024, int stack_depth = 16,
1327 SamplingFlags flags = kSamplingNoFlags,
1328 SampleContextExtractor sample_context_extractor = nullptr);
1329
1334
1341 void SetSamplingHeapProfilerInterval(uint64_t sample_interval);
1342
1349 std::vector<AllocationProfile::Sample> GetSamplingHeapProfilerSamples();
1350
1358
1364
1365 void AddBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback,
1366 void* data);
1367 void RemoveBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback,
1368 void* data);
1369
1371
1376
1382 const char* CopyNameForHeapSnapshot(const char* name);
1383
1389 static const uint16_t kPersistentHandleNoClassId = 0;
1390
1391 private:
1392 HeapProfiler();
1393 ~HeapProfiler();
1394 HeapProfiler(const HeapProfiler&);
1395 HeapProfiler& operator=(const HeapProfiler&);
1396};
1397
1403 HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size)
1404 : index(index), count(count), size(size) { }
1405 uint32_t index; // Index of the time interval that was changed.
1406 uint32_t count; // New value of count field for the interval with this index.
1407 uint32_t size; // New value of size field for the interval with this index.
1408};
1409
1410#define CODE_EVENTS_LIST(V) \
1411 V(Builtin) \
1412 V(Callback) \
1413 V(Eval) \
1414 V(Function) \
1415 V(InterpretedFunction) \
1416 V(Handler) \
1417 V(BytecodeHandler) \
1418 V(LazyCompile) /* Unused, use kFunction instead */ \
1419 V(RegExp) \
1420 V(Script) \
1421 V(Stub) \
1422 V(Relocation)
1423
1429 kUnknownType = 0
1430#define V(Name) , k##Name##Type
1432#undef V
1433};
1434
1438class V8_EXPORT CodeEvent {
1439 public:
1440 uintptr_t GetCodeStartAddress();
1441 size_t GetCodeSize();
1442 Local<String> GetFunctionName();
1443 Local<String> GetScriptName();
1444 int GetScriptLine();
1445 int GetScriptColumn();
1451 CodeEventType GetCodeType();
1452 const char* GetComment();
1454 static const char* GetCodeEventTypeName(CodeEventType code_event_type);
1456 uintptr_t GetPreviousCodeStartAddress();
1457};
1458
1463 public:
1469 explicit CodeEventHandler(Isolate* isolate);
1470 virtual ~CodeEventHandler();
1471
1480 virtual void Handle(CodeEvent* code_event) = 0;
1481
1486 void Enable();
1487
1492 void Disable();
1493
1494 private:
1497 CodeEventHandler& operator=(const CodeEventHandler&);
1498 void* internal_listener_;
1499};
1500
1501} // namespace v8
1502
1503
1504#endif // V8_V8_PROFILER_H_
Definition: v8-profiler.h:774
ControlOption
Definition: v8-profiler.h:776
virtual ControlOption ReportProgressValue(uint32_t done, uint32_t total)=0
virtual ~ActivityControl()=default
Definition: v8-profiler.h:792
virtual const std::vector< Sample > & GetSamples()=0
virtual Node * GetRootNode()=0
virtual ~AllocationProfile()=default
Definition: v8-profiler.h:1461
Definition: v8-profiler.h:1437
Definition: v8-profiler.h:117
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:132
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:263
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:265
int64_t GetSampleTimestamp(int index) const
int64_t GetStartTime() const
EmbedderStateTag GetSampleEmbedderState(int index) const
void * GetSampleContext(int index) const
void Serialize(OutputStream *stream, SerializationFormat format=kJSON) const
Definition: v8-profiler.h:472
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)
void SetSampleContextExtractor(SampleContextExtractor extractor)
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:420
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:452
CpuProfileSource profile_source() const
Definition: v8-profiler.h:453
CpuProfilingMode mode() const
Definition: v8-profiler.h:450
unsigned max_samples() const
Definition: v8-profiler.h:451
CpuProfilingOptions(CpuProfilingOptions &&)=default
Definition: v8-profiler.h:400
ProfilerId GetId() const
Definition: v8-profiler.h:407
virtual ~DiscardedSamplesDelegate()=default
Definition: v8-profiler.h:938
virtual Detachedness GetDetachedness()
Definition: v8-profiler.h:983
Detachedness
Definition: v8-profiler.h:947
Node & operator=(const Node &)=delete
virtual size_t SizeInBytes()=0
virtual bool IsEmbedderNode()
Definition: v8-profiler.h:965
virtual const char * Name()=0
virtual NativeObject GetNativeObject()
Definition: v8-profiler.h:975
virtual ~Node()=default
virtual Node * WrapperNode()
Definition: v8-profiler.h:962
Node(const Node &)=delete
virtual const char * NamePrefix()
Definition: v8-profiler.h:969
virtual const void * GetAddress()
Definition: v8-profiler.h:992
virtual bool IsRootNode()
Definition: v8-profiler.h:963
Definition: v8-profiler.h:936
virtual void AddNativeSize(size_t size)
Definition: v8-profiler.h:1058
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 void AddWeakEdge(Node *from, Node *to, const char *name=nullptr)
Definition: v8-profiler.h:1047
virtual Node * V8Node(const v8::Local< v8::Value > &value)=0
Definition: v8-persistent-handle.h:353
Definition: v8-profiler.h:624
Type
Definition: v8-profiler.h:626
const HeapGraphNode * GetToNode() const
const HeapGraphNode * GetFromNode() const
Type GetType() const
Local< Value > GetName() const
Definition: v8-profiler.h:660
Local< String > GetName() const
SnapshotObjectId GetId() const
Type GetType() const
Type
Definition: v8-profiler.h:662
const HeapGraphEdge * GetChild(int index) const
size_t GetShallowSize() const
int GetChildrenCount() const
Definition: v8-profiler.h:1168
virtual const char * GetName(Local< Context > context)=0
Definition: v8-profiler.h:1152
virtual const char * GetName(Local< Object > object)=0
Definition: v8-profiler.h:1073
void StartTrackingHeapObjects(bool track_allocations=false)
void SetGetDetachednessCallback(GetDetachednessCallback callback, void *data)
bool StartSamplingHeapProfiler(uint64_t sample_interval=512 *1024, int stack_depth=16, SamplingFlags flags=kSamplingNoFlags, SampleContextExtractor sample_context_extractor=nullptr)
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< AllocationProfile::Sample > GetSamplingHeapProfilerSamples()
std::vector< v8::Local< v8::Value > > GetDetachedJSWrapperObjects()
void DeleteAllHeapSnapshots()
void SetSamplingHeapProfilerInterval(uint64_t sample_interval)
const char * CopyNameForHeapSnapshot(const char *name)
HeapSnapshotMode
Definition: v8-profiler.h:1181
SamplingFlags
Definition: v8-profiler.h:1079
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:1106
NumericsMode
Definition: v8-profiler.h:1192
Definition: v8-profiler.h:711
const HeapGraphNode * GetNodeById(SnapshotObjectId id) const
int GetNodesCount() const
SerializationFormat
Definition: v8-profiler.h:713
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:305
Definition: v8-local-handle.h:359
Definition: v8-local-handle.h:730
Definition: v8-profiler.h:235
virtual ~OutputStream()=default
virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate *data, int count)
Definition: v8-profiler.h:254
WriteResult
Definition: v8-profiler.h:237
virtual WriteResult WriteAsciiChunk(char *data, int size)=0
virtual void EndOfStream()=0
virtual int GetChunkSize()
Definition: v8-profiler.h:242
Definition: v8-profiler.h:1063
virtual bool Filter(v8::Local< v8::Object > object)=0
virtual ~QueryObjectPredicate()=default
EmbedderStackState
Definition: common.h:20
Definition: libplatform.h:15
uint32_t SnapshotObjectId
Definition: v8-profiler.h:31
CpuProfilingStatus
Definition: v8-profiler.h:382
uint32_t ProfilerId
Definition: v8-profiler.h:32
CpuProfilingLoggingMode
Definition: v8-profiler.h:370
@ kEagerLogging
Definition: v8-profiler.h:376
@ kLazyLogging
Definition: v8-profiler.h:373
EmbedderStateTag
Definition: v8-embedder-state-scope.h:22
CpuProfilingMode
Definition: v8-profiler.h:351
@ kLeafNodeLineNumbers
Definition: v8-profiler.h:355
@ kCallerLineNumbers
Definition: v8-profiler.h:358
void * NativeObject
Definition: v8-profiler.h:30
CpuProfileSource
Definition: v8-profiler.h:88
void *(*)(Isolate *) SampleContextExtractor
Definition: v8-profiler.h:66
CpuProfilingNamingMode
Definition: v8-profiler.h:362
@ kStandardNaming
Definition: v8-profiler.h:364
@ kDebugNaming
Definition: v8-profiler.h:367
CodeEventType
Definition: v8-profiler.h:1428
@ kUnknownType
Definition: v8-profiler.h:1429
StateTag
Definition: v8-unwinder.h:39
Definition: v8-profiler.h:794
unsigned int count
Definition: v8-profiler.h:803
size_t size
Definition: v8-profiler.h:798
Definition: v8-profiler.h:809
std::vector< Node * > children
Definition: v8-profiler.h:855
int script_id
Definition: v8-profiler.h:826
int start_position
Definition: v8-profiler.h:831
std::vector< Allocation > allocations
Definition: v8-profiler.h:860
int column_number
Definition: v8-profiler.h:843
uint32_t node_id
Definition: v8-profiler.h:848
int line_number
Definition: v8-profiler.h:837
Local< String > script_name
Definition: v8-profiler.h:820
Local< String > name
Definition: v8-profiler.h:814
Definition: v8-profiler.h:866
unsigned int count
Definition: v8-profiler.h:880
size_t size
Definition: v8-profiler.h:875
uint64_t sample_interval
Definition: v8-profiler.h:897
uint32_t node_id
Definition: v8-profiler.h:870
bool is_live
Definition: v8-profiler.h:892
uint64_t sample_id
Definition: v8-profiler.h:886
Definition: v8-profiler.h:68
size_t position
Definition: v8-profiler.h:70
int script_id
Definition: v8-profiler.h:69
Definition: v8-profiler.h:100
const char * deopt_reason
Definition: v8-profiler.h:102
std::vector< CpuProfileDeoptFrame > stack
Definition: v8-profiler.h:103
Definition: v8-profiler.h:119
unsigned int hit_count
Definition: v8-profiler.h:128
int column
Definition: v8-profiler.h:125
int line
Definition: v8-profiler.h:121
Definition: v8-profiler.h:392
const ProfilerId id
Definition: v8-profiler.h:393
const CpuProfilingStatus status
Definition: v8-profiler.h:394
Definition: v8-profiler.h:1204
HeapSnapshotOptions()
Definition: v8-profiler.h:1208
Definition: v8-profiler.h:1402
uint32_t size
Definition: v8-profiler.h:1407
uint32_t index
Definition: v8-profiler.h:1405
uint32_t count
Definition: v8-profiler.h:1406
HeapStatsUpdate(uint32_t index, uint32_t count, uint32_t size)
Definition: v8-profiler.h:1403
#define V(Name)
#define CODE_EVENTS_LIST(V)
Definition: v8-profiler.h:1410
#define V8_EXPORT
Definition: v8config.h:875
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:632