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

#include <v8-profiler.h>

Collaboration diagram for v8::CpuProfiler:

Public Member Functions

void Dispose ()
 
void SetSamplingInterval (int us)
 
void SetUsePreciseSampling (bool)
 
CpuProfilingResult Start (CpuProfilingOptions options, std::unique_ptr< DiscardedSamplesDelegate > delegate=nullptr)
 
CpuProfilingResult Start (Local< String > title, CpuProfilingOptions options, std::unique_ptr< DiscardedSamplesDelegate > delegate=nullptr)
 
CpuProfilingResult Start (Local< String > title, CpuProfilingMode mode, bool record_samples=false, unsigned max_samples=CpuProfilingOptions::kNoSampleLimit)
 
CpuProfilingResult Start (Local< String > title, bool record_samples=false)
 
CpuProfilingStatus StartProfiling (Local< String > title, CpuProfilingOptions options, std::unique_ptr< DiscardedSamplesDelegate > delegate=nullptr)
 
CpuProfilingStatus StartProfiling (Local< String > title, CpuProfilingMode mode, bool record_samples=false, unsigned max_samples=CpuProfilingOptions::kNoSampleLimit)
 
CpuProfilingStatus StartProfiling (Local< String > title, bool record_samples=false)
 
CpuProfileStop (ProfilerId id)
 
CpuProfileStopProfiling (Local< String > title)
 

Static Public Member Functions

static CpuProfilerNew (Isolate *isolate, CpuProfilingNamingMode=kDebugNaming, CpuProfilingLoggingMode=kLazyLogging)
 
static void CollectSample (Isolate *isolate, const std::optional< uint64_t > trace_id=std::nullopt)
 
static void UseDetailedSourcePositionsForProfiling (Isolate *isolate)
 

Private Member Functions

 CpuProfiler ()
 
 ~CpuProfiler ()
 
 CpuProfiler (const CpuProfiler &)
 
CpuProfileroperator= (const CpuProfiler &)
 

Detailed Description

Interface for controlling CPU profiling. Instance of the profiler can be created using v8::CpuProfiler::New method.

Definition at line 406 of file v8-profiler.h.

Constructor & Destructor Documentation

◆ CpuProfiler() [1/2]

v8::CpuProfiler::CpuProfiler ( )
private

◆ ~CpuProfiler()

v8::CpuProfiler::~CpuProfiler ( )
private

◆ CpuProfiler() [2/2]

v8::CpuProfiler::CpuProfiler ( const CpuProfiler & )
private

Member Function Documentation

◆ CollectSample()

void v8::CpuProfiler::CollectSample ( Isolate * isolate,
const std::optional< uint64_t > trace_id = std::nullopt )
static

Synchronously collect current stack sample in all profilers attached to the |isolate|. The call does not affect number of ticks recorded for the current top node. |trace_id| is an optional identifier set to the collected sample. this is useful to associate the sample with a trace event.

Definition at line 11425 of file api.cc.

◆ Dispose()

void v8::CpuProfiler::Dispose ( )

Disposes the CPU profiler object.

Definition at line 11420 of file api.cc.

Here is the caller graph for this function:

◆ New()

CpuProfiler * v8::CpuProfiler::New ( Isolate * isolate,
CpuProfilingNamingMode naming_mode = kDebugNaming,
CpuProfilingLoggingMode logging_mode = kLazyLogging )
static

Creates a new CPU profiler for the |isolate|. The isolate must be initialized. The profiler object must be disposed after use by calling |Dispose| method.

Definition at line 11391 of file api.cc.

Here is the caller graph for this function:

◆ operator=()

CpuProfiler & v8::CpuProfiler::operator= ( const CpuProfiler & )
private

◆ SetSamplingInterval()

void v8::CpuProfiler::SetSamplingInterval ( int us)

Changes default CPU profiler sampling interval to the specified number of microseconds. Default interval is 1000us. This method must be called when there are no profiles being recorded.

Definition at line 11431 of file api.cc.

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

◆ SetUsePreciseSampling()

void v8::CpuProfiler::SetUsePreciseSampling ( bool use_precise_sampling)

Sets whether or not the profiler should prioritize consistency of sample periodicity on Windows. Disabling this can greatly reduce CPU usage, but may result in greater variance in sample timings from the platform's scheduler. Defaults to enabled. This method must be called when there are no profiles being recorded.

Definition at line 11437 of file api.cc.

◆ Start() [1/4]

CpuProfilingResult v8::CpuProfiler::Start ( CpuProfilingOptions options,
std::unique_ptr< DiscardedSamplesDelegate > delegate = nullptr )

Starts collecting a CPU profile. Several profiles may be collected at once. Generates an anonymous profiler, without a String identifier.

Definition at line 11442 of file api.cc.

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

◆ Start() [2/4]

CpuProfilingResult v8::CpuProfiler::Start ( Local< String > title,
bool record_samples = false )

The same as StartProfiling above, but the CpuProfilingMode defaults to kLeafNodeLineNumbers mode, which was the previous default behavior of the profiler.

Definition at line 11457 of file api.cc.

Here is the call graph for this function:

◆ Start() [3/4]

CpuProfilingResult v8::CpuProfiler::Start ( Local< String > title,
CpuProfilingMode mode,
bool record_samples = false,
unsigned max_samples = CpuProfilingOptions::kNoSampleLimit )

Starts profiling with the same semantics as above, except with expanded parameters.

|record_samples| parameter controls whether individual samples should be recorded in addition to the aggregated tree.

|max_samples| controls the maximum number of samples that should be recorded by the profiler. Samples obtained after this limit will be discarded.

Definition at line 11466 of file api.cc.

Here is the call graph for this function:

◆ Start() [4/4]

CpuProfilingResult v8::CpuProfiler::Start ( Local< String > title,
CpuProfilingOptions options,
std::unique_ptr< DiscardedSamplesDelegate > delegate = nullptr )

Starts collecting a CPU profile. Title may be an empty string. Several profiles may be collected at once. Attempts to start collecting several profiles with the same title are silently ignored.

Definition at line 11449 of file api.cc.

Here is the call graph for this function:

◆ StartProfiling() [1/3]

CpuProfilingStatus v8::CpuProfiler::StartProfiling ( Local< String > title,
bool record_samples = false )

The same as StartProfiling above, but the CpuProfilingMode defaults to kLeafNodeLineNumbers mode, which was the previous default behavior of the profiler.

Definition at line 11481 of file api.cc.

Here is the call graph for this function:

◆ StartProfiling() [2/3]

CpuProfilingStatus v8::CpuProfiler::StartProfiling ( Local< String > title,
CpuProfilingMode mode,
bool record_samples = false,
unsigned max_samples = CpuProfilingOptions::kNoSampleLimit )

Starts profiling with the same semantics as above, except with expanded parameters.

|record_samples| parameter controls whether individual samples should be recorded in addition to the aggregated tree.

|max_samples| controls the maximum number of samples that should be recorded by the profiler. Samples obtained after this limit will be discarded.

Definition at line 11486 of file api.cc.

Here is the call graph for this function:

◆ StartProfiling() [3/3]

CpuProfilingStatus v8::CpuProfiler::StartProfiling ( Local< String > title,
CpuProfilingOptions options,
std::unique_ptr< DiscardedSamplesDelegate > delegate = nullptr )

Starts collecting a CPU profile. Title may be an empty string. Several profiles may be collected at once. Attempts to start collecting several profiles with the same title are silently ignored.

Definition at line 11475 of file api.cc.

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

◆ Stop()

CpuProfile * v8::CpuProfiler::Stop ( ProfilerId id)

Stops collecting CPU profile with a given id and returns it.

Definition at line 11499 of file api.cc.

Here is the call graph for this function:

◆ StopProfiling()

CpuProfile * v8::CpuProfiler::StopProfiling ( Local< String > title)

Stops collecting CPU profile with a given title and returns it. If the title given is empty, finishes the last profile started.

Definition at line 11493 of file api.cc.

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

◆ UseDetailedSourcePositionsForProfiling()

void v8::CpuProfiler::UseDetailedSourcePositionsForProfiling ( Isolate * isolate)
static

Generate more detailed source positions to code objects. This results in better results when mapping profiling samples to script source.

Definition at line 11504 of file api.cc.


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