V8 Project
v8::CpuProfiler Class Reference

Interface for controlling CPU profiling. More...

#include <v8-profiler.h>

+ Collaboration diagram for v8::CpuProfiler:

Public Member Functions

void SetSamplingInterval (int us)
 Changes default CPU profiler sampling interval to the specified number of microseconds. More...
 
void StartProfiling (Handle< String > title, bool record_samples=false)
 Starts collecting CPU profile. More...
 
 V8_DEPRECATED ("Use StartProfiling", void StartCpuProfiling(Handle< String > title, bool record_samples=false))
 Deprecated. More...
 
CpuProfileStopProfiling (Handle< String > title)
 Stops collecting CPU profile with a given title and returns it. More...
 
 V8_DEPRECATED ("Use StopProfiling", const CpuProfile *StopCpuProfiling(Handle< String > title))
 Deprecated. More...
 
void SetIdle (bool is_idle)
 Tells the profiler whether the embedder is idle. More...
 

Private Member Functions

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

Detailed Description

Interface for controlling CPU profiling.

Instance of the profiler can be retrieved using v8::Isolate::GetCpuProfiler.

Definition at line 129 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

◆ operator=()

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

◆ SetIdle()

void v8::CpuProfiler::SetIdle ( bool  is_idle)

Tells the profiler whether the embedder is idle.

Definition at line 7200 of file api.cc.

7200  {
7201  i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate();
7202  i::StateTag state = isolate->current_vm_state();
7203  DCHECK(state == i::EXTERNAL || state == i::IDLE);
7204  if (isolate->js_entry_sp() != NULL) return;
7205  if (is_idle) {
7206  isolate->set_current_vm_state(i::IDLE);
7207  } else if (state == i::IDLE) {
7208  isolate->set_current_vm_state(i::EXTERNAL);
7209  }
7210 }
Address js_entry_sp()
Definition: isolate.h:658
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, v8::internal::EXTERNAL, v8::internal::IDLE, v8::internal::Isolate::js_entry_sp(), and NULL.

+ Here is the call graph for this function:

◆ 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 7170 of file api.cc.

7170  {
7171  DCHECK(us >= 0);
7172  return reinterpret_cast<i::CpuProfiler*>(this)->set_sampling_interval(
7173  base::TimeDelta::FromMicroseconds(us));
7174 }

References DCHECK.

◆ StartProfiling()

void v8::CpuProfiler::StartProfiling ( Handle< String title,
bool  record_samples = false 
)

Starts collecting CPU profile.

Title may be an empty string. It is allowed to have several profiles being collected at once. Attempts to start collecting several profiles with the same title are silently ignored. While collecting a profile, functions from all security contexts are included in it. The token-based filtering is only performed when querying for a profile.

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

Definition at line 7177 of file api.cc.

7177  {
7178  reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling(
7179  *Utils::OpenHandle(*title), record_samples);
7180 }
void StartProfiling(Handle< String > title, bool record_samples=false)
Starts collecting CPU profile.
Definition: api.cc:7177
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
Definition: api.h:288

References v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ StopProfiling()

CpuProfile * v8::CpuProfiler::StopProfiling ( Handle< 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 7188 of file api.cc.

7188  {
7189  return reinterpret_cast<CpuProfile*>(
7190  reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling(
7191  *Utils::OpenHandle(*title)));
7192 }
CpuProfile * StopProfiling(Handle< String > title)
Stops collecting CPU profile with a given title and returns it.
Definition: api.cc:7188

References v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ V8_DEPRECATED() [1/2]

v8::CpuProfiler::V8_DEPRECATED ( "Use StartProfiling ,
void   StartCpuProfilingHandle< String > title, bool record_samples=false 
)

Deprecated.

Use StartProfiling instead.

◆ V8_DEPRECATED() [2/2]

v8::CpuProfiler::V8_DEPRECATED ( "Use StopProfiling ,
const CpuProfile StopCpuProfilingHandle< String > title 
)

Deprecated.

Use StopProfiling instead.


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