v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::internal::TickSample Struct Reference

#include <tick-sample.h>

Collaboration diagram for v8::internal::TickSample:

Public Types

enum  RecordCEntryFrame { kIncludeCEntryFrame , kSkipCEntryFrame }
 

Public Member Functions

 TickSample ()
 
void Init (Isolate *isolate, const v8::RegisterState &state, RecordCEntryFrame record_c_entry_frame, bool update_stats, bool use_simulator_reg_state=true, base::TimeDelta sampling_interval=base::TimeDelta(), const std::optional< uint64_t > trace_id=std::nullopt)
 
void print () const
 

Static Public Member Functions

static bool GetStackSample (Isolate *isolate, v8::RegisterState *state, RecordCEntryFrame record_c_entry_frame, void **frames, size_t frames_limit, v8::SampleInfo *sample_info, StateTag *out_state=nullptr, bool use_simulator_reg_state=true)
 

Public Attributes

void * pc = nullptr
 
union { 
 
   void *   tos 
 
   void *   external_callback_entry = nullptr 
 
};  
 
void * context = nullptr
 
void * embedder_context = nullptr
 
base::TimeTicks timestamp
 
base::TimeDelta sampling_interval_
 
StateTag state = OTHER
 
EmbedderStateTag embedder_state = EmbedderStateTag::EMPTY
 
uint16_t frames_count = 0
 
bool has_external_callback = false
 
bool update_stats_ = true
 
std::optional< uint64_t > trace_id_
 
void * stack [kMaxFramesCount]
 

Static Public Attributes

static constexpr unsigned kMaxFramesCountLog2 = 8
 
static constexpr unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1
 

Detailed Description

Definition at line 18 of file tick-sample.h.

Member Enumeration Documentation

◆ RecordCEntryFrame

Enumerator
kIncludeCEntryFrame 
kSkipCEntryFrame 

Definition at line 22 of file tick-sample.h.

Constructor & Destructor Documentation

◆ TickSample()

v8::internal::TickSample::TickSample ( )
inline

Definition at line 24 of file tick-sample.h.

Member Function Documentation

◆ GetStackSample()

bool v8::internal::TickSample::GetStackSample ( Isolate * isolate,
v8::RegisterState * state,
RecordCEntryFrame record_c_entry_frame,
void ** frames,
size_t frames_limit,
v8::SampleInfo * sample_info,
StateTag * out_state = nullptr,
bool use_simulator_reg_state = true )
static

Get a call stack sample from the isolate.

Parameters
isolateThe isolate.
stateRegister state.
record_c_entry_frameInclude or skip the runtime function.
framesCaller allocated buffer to store stack frames.
frames_limitMaximum number of frames to capture. The buffer must be large enough to hold the number of frames.
sample_infoThe sample info is filled up by the function provides number of actual captured stack frames and the current VM state.
out_stateOutput parameter. If non-nullptr pointer is provided, and the execution is currently in a fast API call, records StateTag::EXTERNAL to it. The caller could then use this as a marker to not take into account the actual VM state recorded in |sample_info|. In the case of fast API calls, the VM state must be EXTERNAL, as the callback is always an external C++ function.
use_simulator_reg_stateWhen set to true and V8 is running under a simulator, the method will use the simulator register state rather than the one provided with |state| argument. Otherwise the method will use provided register |state| as is.
Note
GetStackSample is thread and signal safe and should only be called when the JS thread is paused or interrupted. Otherwise the behavior is undefined.

Definition at line 219 of file tick-sample.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Init()

DISABLE_ASAN void v8::internal::TickSample::Init ( Isolate * isolate,
const v8::RegisterState & state,
RecordCEntryFrame record_c_entry_frame,
bool update_stats,
bool use_simulator_reg_state = true,
base::TimeDelta sampling_interval = base::TimeDelta(),
const std::optional< uint64_t > trace_id = std::nullopt )

Initialize a tick sample from the isolate.

Parameters
isolateThe isolate.
stateExecution state.
record_c_entry_frameInclude or skip the runtime function.
update_statsWhether update the sample to the aggregated stats.
use_simulator_reg_stateWhen set to true and V8 is running under a simulator, the method will use the simulator register state rather than the one provided with |state| argument. Otherwise the method will use provided register |state| as is.

Definition at line 164 of file tick-sample.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print()

void v8::internal::TickSample::print ( ) const

Definition at line 396 of file tick-sample.cc.

Here is the call graph for this function:

Member Data Documentation

◆ [union]

union { ... } v8::internal::TickSample

◆ context

void* v8::internal::TickSample::context = nullptr

Definition at line 87 of file tick-sample.h.

◆ embedder_context

void* v8::internal::TickSample::embedder_context = nullptr

Definition at line 88 of file tick-sample.h.

◆ embedder_state

EmbedderStateTag v8::internal::TickSample::embedder_state = EmbedderStateTag::EMPTY

Definition at line 94 of file tick-sample.h.

◆ external_callback_entry

void* v8::internal::TickSample::external_callback_entry = nullptr

Definition at line 85 of file tick-sample.h.

◆ frames_count

uint16_t v8::internal::TickSample::frames_count = 0

Definition at line 96 of file tick-sample.h.

◆ has_external_callback

bool v8::internal::TickSample::has_external_callback = false

Definition at line 98 of file tick-sample.h.

◆ kMaxFramesCount

unsigned v8::internal::TickSample::kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1
staticconstexpr

Definition at line 80 of file tick-sample.h.

◆ kMaxFramesCountLog2

unsigned v8::internal::TickSample::kMaxFramesCountLog2 = 8
staticconstexpr

Definition at line 79 of file tick-sample.h.

◆ pc

void* v8::internal::TickSample::pc = nullptr

Definition at line 82 of file tick-sample.h.

◆ sampling_interval_

base::TimeDelta v8::internal::TickSample::sampling_interval_

Definition at line 91 of file tick-sample.h.

◆ stack

void* v8::internal::TickSample::stack[kMaxFramesCount]

Definition at line 104 of file tick-sample.h.

◆ state

StateTag v8::internal::TickSample::state = OTHER

Definition at line 93 of file tick-sample.h.

◆ timestamp

base::TimeTicks v8::internal::TickSample::timestamp

Definition at line 90 of file tick-sample.h.

◆ tos

void* v8::internal::TickSample::tos

Definition at line 84 of file tick-sample.h.

◆ trace_id_

std::optional<uint64_t> v8::internal::TickSample::trace_id_

Definition at line 102 of file tick-sample.h.

◆ update_stats_

bool v8::internal::TickSample::update_stats_ = true

Definition at line 100 of file tick-sample.h.


The documentation for this struct was generated from the following files: