V8 Project
v8::internal::CpuProfiler Class Reference

#include <cpu-profiler.h>

+ Inheritance diagram for v8::internal::CpuProfiler:
+ Collaboration diagram for v8::internal::CpuProfiler:

Public Member Functions

 CpuProfiler (Isolate *isolate)
 
 CpuProfiler (Isolate *isolate, CpuProfilesCollection *test_collection, ProfileGenerator *test_generator, ProfilerEventsProcessor *test_processor)
 
virtual ~CpuProfiler ()
 
void set_sampling_interval (base::TimeDelta value)
 
void StartProfiling (const char *title, bool record_samples=false)
 
void StartProfiling (String *title, bool record_samples)
 
CpuProfileStopProfiling (const char *title)
 
CpuProfileStopProfiling (String *title)
 
int GetProfilesCount ()
 
CpuProfileGetProfile (int index)
 
void DeleteAllProfiles ()
 
void DeleteProfile (CpuProfile *profile)
 
TickSampleStartTickSample ()
 
void FinishTickSample ()
 
virtual void CallbackEvent (Name *name, Address entry_point)
 
virtual void CodeCreateEvent (Logger::LogEventsAndTags tag, Code *code, const char *comment)
 
virtual void CodeCreateEvent (Logger::LogEventsAndTags tag, Code *code, Name *name)
 
virtual void CodeCreateEvent (Logger::LogEventsAndTags tag, Code *code, SharedFunctionInfo *shared, CompilationInfo *info, Name *script_name)
 
virtual void CodeCreateEvent (Logger::LogEventsAndTags tag, Code *code, SharedFunctionInfo *shared, CompilationInfo *info, Name *script_name, int line, int column)
 
virtual void CodeCreateEvent (Logger::LogEventsAndTags tag, Code *code, int args_count)
 
virtual void CodeMovingGCEvent ()
 
virtual void CodeMoveEvent (Address from, Address to)
 
virtual void CodeDisableOptEvent (Code *code, SharedFunctionInfo *shared)
 
virtual void CodeDeleteEvent (Address from)
 
virtual void GetterCallbackEvent (Name *name, Address entry_point)
 
virtual void RegExpCodeCreateEvent (Code *code, String *source)
 
virtual void SetterCallbackEvent (Name *name, Address entry_point)
 
virtual void SharedFunctionInfoMoveEvent (Address from, Address to)
 
 INLINE (bool is_profiling() const)
 
boolis_profiling_address ()
 
ProfileGeneratorgenerator () const
 
ProfilerEventsProcessorprocessor () const
 
Isolateisolate () const
 
- Public Member Functions inherited from v8::internal::CodeEventListener
virtual ~CodeEventListener ()
 

Private Member Functions

void StartProcessorIfNotStarted ()
 
void StopProcessorIfLastProfile (const char *title)
 
void StopProcessor ()
 
void ResetProfiles ()
 
void LogBuiltins ()
 
 DISALLOW_COPY_AND_ASSIGN (CpuProfiler)
 

Private Attributes

Isolateisolate_
 
base::TimeDelta sampling_interval_
 
CpuProfilesCollectionprofiles_
 
ProfileGeneratorgenerator_
 
ProfilerEventsProcessorprocessor_
 
bool saved_is_logging_
 
bool is_profiling_
 

Detailed Description

Definition at line 192 of file cpu-profiler.h.

Constructor & Destructor Documentation

◆ CpuProfiler() [1/2]

v8::internal::CpuProfiler::CpuProfiler ( Isolate isolate)
explicit

Definition at line 370 of file cpu-profiler.cc.

371  : isolate_(isolate),
372  sampling_interval_(base::TimeDelta::FromMicroseconds(
373  FLAG_cpu_profiler_sampling_interval)),
374  profiles_(new CpuProfilesCollection(isolate->heap())),
375  generator_(NULL),
376  processor_(NULL),
377  is_profiling_(false) {
378 }
ProfilerEventsProcessor * processor_
Definition: cpu-profiler.h:262
Isolate * isolate() const
Definition: cpu-profiler.h:249
CpuProfilesCollection * profiles_
Definition: cpu-profiler.h:260
base::TimeDelta sampling_interval_
Definition: cpu-profiler.h:259
ProfileGenerator * generator_
Definition: cpu-profiler.h:261
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

◆ CpuProfiler() [2/2]

v8::internal::CpuProfiler::CpuProfiler ( Isolate isolate,
CpuProfilesCollection test_collection,
ProfileGenerator test_generator,
ProfilerEventsProcessor test_processor 
)

Definition at line 381 of file cpu-profiler.cc.

385  : isolate_(isolate),
386  sampling_interval_(base::TimeDelta::FromMicroseconds(
387  FLAG_cpu_profiler_sampling_interval)),
388  profiles_(test_profiles),
389  generator_(test_generator),
390  processor_(test_processor),
391  is_profiling_(false) {
392 }

◆ ~CpuProfiler()

v8::internal::CpuProfiler::~CpuProfiler ( )
virtual

Definition at line 395 of file cpu-profiler.cc.

395  {
397  delete profiles_;
398 }
#define DCHECK(condition)
Definition: logging.h:205

References DCHECK, is_profiling_, and profiles_.

Member Function Documentation

◆ CallbackEvent()

void v8::internal::CpuProfiler::CallbackEvent ( Name name,
Address  entry_point 
)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 183 of file cpu-profiler.cc.

183  {
184  if (FilterOutCodeCreateEvent(Logger::CALLBACK_TAG)) return;
185  CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
186  CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
187  rec->start = entry_point;
188  rec->entry = profiles_->NewCodeEntry(
189  Logger::CALLBACK_TAG,
191  rec->size = 1;
192  rec->shared = NULL;
193  processor_->Enqueue(evt_rec);
194 }
CodeEntry * NewCodeEntry(Logger::LogEventsAndTags tag, const char *name, const char *name_prefix=CodeEntry::kEmptyNamePrefix, const char *resource_name=CodeEntry::kEmptyResourceName, int line_number=v8::CpuProfileNode::kNoLineNumberInfo, int column_number=v8::CpuProfileNode::kNoColumnNumberInfo)
void Enqueue(const CodeEventsContainer &event)
Definition: cpu-profiler.cc:36
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 expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
static bool FilterOutCodeCreateEvent(Logger::LogEventsAndTags tag)

References v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::CodeCreateEventRecord::entry, v8::internal::FilterOutCodeCreateEvent(), v8::internal::CpuProfilesCollection::GetName(), name, v8::internal::CpuProfilesCollection::NewCodeEntry(), NULL, processor_, profiles_, v8::internal::CodeCreateEventRecord::shared, v8::internal::CodeCreateEventRecord::size, and v8::internal::CodeCreateEventRecord::start.

+ Here is the call graph for this function:

◆ CodeCreateEvent() [1/5]

void v8::internal::CpuProfiler::CodeCreateEvent ( Logger::LogEventsAndTags  tag,
Code code,
const char *  comment 
)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 197 of file cpu-profiler.cc.

199  {
200  if (FilterOutCodeCreateEvent(tag)) return;
201  CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
202  CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
203  rec->start = code->address();
204  rec->entry = profiles_->NewCodeEntry(tag, profiles_->GetFunctionName(name));
205  rec->size = code->ExecutableSize();
206  rec->shared = NULL;
207  processor_->Enqueue(evt_rec);
208 }
const char * GetFunctionName(Name *name)

References v8::internal::HeapObject::address(), v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::CodeCreateEventRecord::entry, v8::internal::Code::ExecutableSize(), v8::internal::FilterOutCodeCreateEvent(), v8::internal::CpuProfilesCollection::GetFunctionName(), name, v8::internal::CpuProfilesCollection::NewCodeEntry(), NULL, processor_, profiles_, v8::internal::CodeCreateEventRecord::shared, v8::internal::CodeCreateEventRecord::size, and v8::internal::CodeCreateEventRecord::start.

+ Here is the call graph for this function:

◆ CodeCreateEvent() [2/5]

void v8::internal::CpuProfiler::CodeCreateEvent ( Logger::LogEventsAndTags  tag,
Code code,
int  args_count 
)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 277 of file cpu-profiler.cc.

279  {
280  if (FilterOutCodeCreateEvent(tag)) return;
281  CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
282  CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
283  rec->start = code->address();
284  rec->entry = profiles_->NewCodeEntry(
285  tag,
286  profiles_->GetName(args_count),
287  "args_count: ");
288  rec->size = code->ExecutableSize();
289  rec->shared = NULL;
290  processor_->Enqueue(evt_rec);
291 }

References v8::internal::HeapObject::address(), v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::CodeCreateEventRecord::entry, v8::internal::Code::ExecutableSize(), v8::internal::FilterOutCodeCreateEvent(), v8::internal::CpuProfilesCollection::GetName(), v8::internal::CpuProfilesCollection::NewCodeEntry(), NULL, processor_, profiles_, v8::internal::CodeCreateEventRecord::shared, v8::internal::CodeCreateEventRecord::size, and v8::internal::CodeCreateEventRecord::start.

+ Here is the call graph for this function:

◆ CodeCreateEvent() [3/5]

void v8::internal::CpuProfiler::CodeCreateEvent ( Logger::LogEventsAndTags  tag,
Code code,
Name name 
)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 211 of file cpu-profiler.cc.

213  {
214  if (FilterOutCodeCreateEvent(tag)) return;
215  CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
216  CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
217  rec->start = code->address();
218  rec->entry = profiles_->NewCodeEntry(tag, profiles_->GetFunctionName(name));
219  rec->size = code->ExecutableSize();
220  rec->shared = NULL;
221  processor_->Enqueue(evt_rec);
222 }

References v8::internal::HeapObject::address(), v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::CodeCreateEventRecord::entry, v8::internal::Code::ExecutableSize(), v8::internal::FilterOutCodeCreateEvent(), v8::internal::CpuProfilesCollection::GetFunctionName(), name, v8::internal::CpuProfilesCollection::NewCodeEntry(), NULL, processor_, profiles_, v8::internal::CodeCreateEventRecord::shared, v8::internal::CodeCreateEventRecord::size, and v8::internal::CodeCreateEventRecord::start.

+ Here is the call graph for this function:

◆ CodeCreateEvent() [4/5]

void v8::internal::CpuProfiler::CodeCreateEvent ( Logger::LogEventsAndTags  tag,
Code code,
SharedFunctionInfo shared,
CompilationInfo info,
Name script_name 
)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 225 of file cpu-profiler.cc.

227  {
228  if (FilterOutCodeCreateEvent(tag)) return;
229  CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
230  CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
231  rec->start = code->address();
232  rec->entry = profiles_->NewCodeEntry(
233  tag, profiles_->GetFunctionName(shared->DebugName()),
235  if (info) {
236  rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges());
237  }
238  if (shared->script()->IsScript()) {
239  DCHECK(Script::cast(shared->script()));
240  Script* script = Script::cast(shared->script());
241  rec->entry->set_script_id(script->id()->value());
242  rec->entry->set_bailout_reason(
243  GetBailoutReason(shared->DisableOptimizationReason()));
244  }
245  rec->size = code->ExecutableSize();
246  rec->shared = shared->address();
247  processor_->Enqueue(evt_rec);
248 }
static const char *const kEmptyNamePrefix
void set_no_frame_ranges(List< OffsetRange > *ranges)
const char * GetBailoutReason(BailoutReason reason)

References v8::internal::HeapObject::address(), DCHECK, v8::internal::SharedFunctionInfo::DebugName(), v8::internal::SharedFunctionInfo::DisableOptimizationReason(), v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::CodeCreateEventRecord::entry, v8::internal::Code::ExecutableSize(), v8::internal::FilterOutCodeCreateEvent(), v8::internal::GetBailoutReason(), v8::internal::CpuProfilesCollection::GetFunctionName(), v8::internal::CpuProfilesCollection::GetName(), v8::internal::CodeEntry::kEmptyNamePrefix, v8::internal::CpuProfilesCollection::NewCodeEntry(), processor_, profiles_, v8::internal::CompilationInfo::ReleaseNoFrameRanges(), v8::internal::CodeEntry::set_bailout_reason(), v8::internal::CodeEntry::set_no_frame_ranges(), v8::internal::CodeEntry::set_script_id(), v8::internal::CodeCreateEventRecord::shared, v8::internal::CodeCreateEventRecord::size, and v8::internal::CodeCreateEventRecord::start.

+ Here is the call graph for this function:

◆ CodeCreateEvent() [5/5]

void v8::internal::CpuProfiler::CodeCreateEvent ( Logger::LogEventsAndTags  tag,
Code code,
SharedFunctionInfo shared,
CompilationInfo info,
Name script_name,
int  line,
int  column 
)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 251 of file cpu-profiler.cc.

254  {
255  if (FilterOutCodeCreateEvent(tag)) return;
256  CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
257  CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
258  rec->start = code->address();
259  rec->entry = profiles_->NewCodeEntry(
260  tag, profiles_->GetFunctionName(shared->DebugName()),
261  CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), line,
262  column);
263  if (info) {
264  rec->entry->set_no_frame_ranges(info->ReleaseNoFrameRanges());
265  }
266  DCHECK(Script::cast(shared->script()));
267  Script* script = Script::cast(shared->script());
268  rec->entry->set_script_id(script->id()->value());
269  rec->size = code->ExecutableSize();
270  rec->shared = shared->address();
271  rec->entry->set_bailout_reason(
272  GetBailoutReason(shared->DisableOptimizationReason()));
273  processor_->Enqueue(evt_rec);
274 }

References v8::internal::HeapObject::address(), DCHECK, v8::internal::SharedFunctionInfo::DebugName(), v8::internal::SharedFunctionInfo::DisableOptimizationReason(), v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::CodeCreateEventRecord::entry, v8::internal::Code::ExecutableSize(), v8::internal::FilterOutCodeCreateEvent(), v8::internal::GetBailoutReason(), v8::internal::CpuProfilesCollection::GetFunctionName(), v8::internal::CpuProfilesCollection::GetName(), v8::internal::CodeEntry::kEmptyNamePrefix, v8::internal::CpuProfilesCollection::NewCodeEntry(), processor_, profiles_, v8::internal::CompilationInfo::ReleaseNoFrameRanges(), v8::internal::CodeEntry::set_bailout_reason(), v8::internal::CodeEntry::set_no_frame_ranges(), v8::internal::CodeEntry::set_script_id(), v8::internal::CodeCreateEventRecord::shared, v8::internal::CodeCreateEventRecord::size, and v8::internal::CodeCreateEventRecord::start.

+ Here is the call graph for this function:

◆ CodeDeleteEvent()

void v8::internal::CpuProfiler::CodeDeleteEvent ( Address  from)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 312 of file cpu-profiler.cc.

312  {
313 }

◆ CodeDisableOptEvent()

void v8::internal::CpuProfiler::CodeDisableOptEvent ( Code code,
SharedFunctionInfo shared 
)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 303 of file cpu-profiler.cc.

303  {
304  CodeEventsContainer evt_rec(CodeEventRecord::CODE_DISABLE_OPT);
305  CodeDisableOptEventRecord* rec = &evt_rec.CodeDisableOptEventRecord_;
306  rec->start = code->address();
307  rec->bailout_reason = GetBailoutReason(shared->DisableOptimizationReason());
308  processor_->Enqueue(evt_rec);
309 }

References v8::internal::HeapObject::address(), v8::internal::CodeDisableOptEventRecord::bailout_reason, v8::internal::SharedFunctionInfo::DisableOptimizationReason(), v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::GetBailoutReason(), processor_, and v8::internal::CodeDisableOptEventRecord::start.

+ Here is the call graph for this function:

◆ CodeMoveEvent()

void v8::internal::CpuProfiler::CodeMoveEvent ( Address  from,
Address  to 
)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 294 of file cpu-profiler.cc.

294  {
295  CodeEventsContainer evt_rec(CodeEventRecord::CODE_MOVE);
296  CodeMoveEventRecord* rec = &evt_rec.CodeMoveEventRecord_;
297  rec->from = from;
298  rec->to = to;
299  processor_->Enqueue(evt_rec);
300 }
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 expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file

References v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::CodeMoveEventRecord::from, processor_, v8::internal::CodeMoveEventRecord::to, and to().

+ Here is the call graph for this function:

◆ CodeMovingGCEvent()

virtual void v8::internal::CpuProfiler::CodeMovingGCEvent ( )
inlinevirtual

Implements v8::internal::CodeEventListener.

Definition at line 233 of file cpu-profiler.h.

233 {}

◆ DeleteAllProfiles()

void v8::internal::CpuProfiler::DeleteAllProfiles ( )

Definition at line 157 of file cpu-profiler.cc.

157  {
159  ResetProfiles();
160 }

References is_profiling_, ResetProfiles(), and StopProcessor().

+ Here is the call graph for this function:

◆ DeleteProfile()

void v8::internal::CpuProfiler::DeleteProfile ( CpuProfile profile)

Definition at line 163 of file cpu-profiler.cc.

163  {
164  profiles_->RemoveProfile(profile);
165  delete profile;
166  if (profiles_->profiles()->is_empty() && !is_profiling_) {
167  // If this was the last profile, clean up all accessory data as well.
168  ResetProfiles();
169  }
170 }
void RemoveProfile(CpuProfile *profile)

References is_profiling_, v8::internal::CpuProfilesCollection::profiles(), profiles_, v8::internal::CpuProfilesCollection::RemoveProfile(), and ResetProfiles().

+ Here is the call graph for this function:

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::CpuProfiler::DISALLOW_COPY_AND_ASSIGN ( CpuProfiler  )
private

◆ FinishTickSample()

void v8::internal::CpuProfiler::FinishTickSample ( )
inline

Definition at line 61 of file cpu-profiler-inl.h.

References v8::internal::ProfilerEventsProcessor::FinishTickSample(), and processor_.

Referenced by v8::internal::Sampler::SampleStack().

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

◆ generator()

ProfileGenerator* v8::internal::CpuProfiler::generator ( ) const
inline

Definition at line 247 of file cpu-profiler.h.

247 { return generator_; }

References generator_.

◆ GetProfile()

CpuProfile * v8::internal::CpuProfiler::GetProfile ( int  index)

Definition at line 152 of file cpu-profiler.cc.

152  {
153  return profiles_->profiles()->at(index);
154 }

References v8::internal::CpuProfilesCollection::profiles(), and profiles_.

+ Here is the call graph for this function:

◆ GetProfilesCount()

int v8::internal::CpuProfiler::GetProfilesCount ( )

Definition at line 146 of file cpu-profiler.cc.

146  {
147  // The count of profiles doesn't depend on a security token.
148  return profiles_->profiles()->length();
149 }

References v8::internal::CpuProfilesCollection::profiles(), and profiles_.

+ Here is the call graph for this function:

◆ GetterCallbackEvent()

void v8::internal::CpuProfiler::GetterCallbackEvent ( Name name,
Address  entry_point 
)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 326 of file cpu-profiler.cc.

326  {
327  if (FilterOutCodeCreateEvent(Logger::CALLBACK_TAG)) return;
328  CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
329  CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
330  rec->start = entry_point;
331  rec->entry = profiles_->NewCodeEntry(
332  Logger::CALLBACK_TAG,
334  "get ");
335  rec->size = 1;
336  rec->shared = NULL;
337  processor_->Enqueue(evt_rec);
338 }

References v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::CodeCreateEventRecord::entry, v8::internal::FilterOutCodeCreateEvent(), v8::internal::CpuProfilesCollection::GetName(), name, v8::internal::CpuProfilesCollection::NewCodeEntry(), NULL, processor_, profiles_, v8::internal::CodeCreateEventRecord::shared, v8::internal::CodeCreateEventRecord::size, and v8::internal::CodeCreateEventRecord::start.

+ Here is the call graph for this function:

◆ INLINE()

v8::internal::CpuProfiler::INLINE ( bool is_profiling() const  )
inline

Definition at line 242 of file cpu-profiler.h.

242 { return is_profiling_; }

References is_profiling_.

◆ is_profiling_address()

bool* v8::internal::CpuProfiler::is_profiling_address ( )
inline

Definition at line 243 of file cpu-profiler.h.

243  {
244  return &is_profiling_;
245  }

References is_profiling_.

◆ isolate()

Isolate* v8::internal::CpuProfiler::isolate ( ) const
inline

Definition at line 249 of file cpu-profiler.h.

249 { return isolate_; }

References isolate_.

Referenced by ResetProfiles().

+ Here is the caller graph for this function:

◆ LogBuiltins()

void v8::internal::CpuProfiler::LogBuiltins ( )
private

Definition at line 494 of file cpu-profiler.cc.

494  {
495  Builtins* builtins = isolate_->builtins();
496  DCHECK(builtins->is_initialized());
497  for (int i = 0; i < Builtins::builtin_count; i++) {
498  CodeEventsContainer evt_rec(CodeEventRecord::REPORT_BUILTIN);
499  ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_;
500  Builtins::Name id = static_cast<Builtins::Name>(i);
501  rec->start = builtins->builtin(id)->address();
502  rec->builtin_id = id;
503  processor_->Enqueue(evt_rec);
504  }
505 }
Builtins * builtins()
Definition: isolate.h:947

References v8::internal::HeapObject::address(), v8::internal::Builtins::builtin(), v8::internal::Builtins::builtin_count, v8::internal::ReportBuiltinEventRecord::builtin_id, v8::internal::Isolate::builtins(), DCHECK, v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::Builtins::is_initialized(), isolate_, processor_, and v8::internal::ReportBuiltinEventRecord::start.

Referenced by StartProcessorIfNotStarted().

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

◆ processor()

ProfilerEventsProcessor* v8::internal::CpuProfiler::processor ( ) const
inline

Definition at line 248 of file cpu-profiler.h.

248 { return processor_; }

References processor_.

◆ RegExpCodeCreateEvent()

void v8::internal::CpuProfiler::RegExpCodeCreateEvent ( Code code,
String source 
)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 341 of file cpu-profiler.cc.

341  {
342  if (FilterOutCodeCreateEvent(Logger::REG_EXP_TAG)) return;
343  CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
344  CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
345  rec->start = code->address();
346  rec->entry = profiles_->NewCodeEntry(
347  Logger::REG_EXP_TAG,
348  profiles_->GetName(source),
349  "RegExp: ");
350  rec->size = code->ExecutableSize();
351  processor_->Enqueue(evt_rec);
352 }

References v8::internal::HeapObject::address(), v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::CodeCreateEventRecord::entry, v8::internal::Code::ExecutableSize(), v8::internal::FilterOutCodeCreateEvent(), v8::internal::CpuProfilesCollection::GetName(), v8::internal::CpuProfilesCollection::NewCodeEntry(), processor_, profiles_, v8::internal::CodeCreateEventRecord::size, and v8::internal::CodeCreateEventRecord::start.

+ Here is the call graph for this function:

◆ ResetProfiles()

void v8::internal::CpuProfiler::ResetProfiles ( )
private

Definition at line 407 of file cpu-profiler.cc.

407  {
408  delete profiles_;
409  profiles_ = new CpuProfilesCollection(isolate()->heap());
410 }

References isolate(), and profiles_.

Referenced by DeleteAllProfiles(), and DeleteProfile().

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

◆ set_sampling_interval()

void v8::internal::CpuProfiler::set_sampling_interval ( base::TimeDelta  value)

Definition at line 401 of file cpu-profiler.cc.

401  {
403  sampling_interval_ = value;
404 }

References DCHECK, is_profiling_, and sampling_interval_.

◆ SetterCallbackEvent()

void v8::internal::CpuProfiler::SetterCallbackEvent ( Name name,
Address  entry_point 
)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 355 of file cpu-profiler.cc.

355  {
356  if (FilterOutCodeCreateEvent(Logger::CALLBACK_TAG)) return;
357  CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION);
358  CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_;
359  rec->start = entry_point;
360  rec->entry = profiles_->NewCodeEntry(
361  Logger::CALLBACK_TAG,
363  "set ");
364  rec->size = 1;
365  rec->shared = NULL;
366  processor_->Enqueue(evt_rec);
367 }

References v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::CodeCreateEventRecord::entry, v8::internal::FilterOutCodeCreateEvent(), v8::internal::CpuProfilesCollection::GetName(), name, v8::internal::CpuProfilesCollection::NewCodeEntry(), NULL, processor_, profiles_, v8::internal::CodeCreateEventRecord::shared, v8::internal::CodeCreateEventRecord::size, and v8::internal::CodeCreateEventRecord::start.

+ Here is the call graph for this function:

◆ SharedFunctionInfoMoveEvent()

void v8::internal::CpuProfiler::SharedFunctionInfoMoveEvent ( Address  from,
Address  to 
)
virtual

Implements v8::internal::CodeEventListener.

Definition at line 316 of file cpu-profiler.cc.

316  {
317  CodeEventsContainer evt_rec(CodeEventRecord::SHARED_FUNC_MOVE);
318  SharedFunctionInfoMoveEventRecord* rec =
319  &evt_rec.SharedFunctionInfoMoveEventRecord_;
320  rec->from = from;
321  rec->to = to;
322  processor_->Enqueue(evt_rec);
323 }

References v8::internal::ProfilerEventsProcessor::Enqueue(), v8::internal::SharedFunctionInfoMoveEventRecord::from, processor_, v8::internal::SharedFunctionInfoMoveEventRecord::to, and to().

+ Here is the call graph for this function:

◆ StartProcessorIfNotStarted()

void v8::internal::CpuProfiler::StartProcessorIfNotStarted ( )
private

Definition at line 425 of file cpu-profiler.cc.

425  {
426  if (processor_ != NULL) {
428  return;
429  }
430  Logger* logger = isolate_->logger();
431  // Disable logging when using the new implementation.
432  saved_is_logging_ = logger->is_logging_;
433  logger->is_logging_ = false;
434  generator_ = new ProfileGenerator(profiles_);
435  Sampler* sampler = logger->sampler();
436  processor_ = new ProfilerEventsProcessor(
437  generator_, sampler, sampling_interval_);
438  is_profiling_ = true;
439  // Enumerate stuff we already have in the heap.
441  if (!FLAG_prof_browser_mode) {
442  logger->LogCodeObjects();
443  }
444  logger->LogCompiledFunctions();
445  logger->LogAccessorCallbacks();
446  LogBuiltins();
447  // Enable stack sampling.
448  sampler->SetHasProcessingThread(true);
449  sampler->IncreaseProfilingDepth();
452 }
void StartSynchronously()
Definition: platform.h:440
bool HasBeenSetUp()
Definition: heap.cc:221
Logger * logger()
Definition: isolate.h:866
void AddCurrentStack(Isolate *isolate)
Definition: cpu-profiler.cc:42

References v8::internal::ProfilerEventsProcessor::AddCurrentStack(), DCHECK, generator_, v8::internal::Heap::HasBeenSetUp(), v8::internal::Isolate::heap(), v8::internal::Sampler::IncreaseProfilingDepth(), v8::internal::Logger::is_logging_, is_profiling_, isolate_, v8::internal::Logger::LogAccessorCallbacks(), LogBuiltins(), v8::internal::Logger::LogCodeObjects(), v8::internal::Logger::LogCompiledFunctions(), v8::internal::Isolate::logger(), NULL, processor_, profiles_, v8::internal::Logger::sampler(), sampling_interval_, saved_is_logging_, v8::internal::Sampler::SetHasProcessingThread(), and v8::base::Thread::StartSynchronously().

Referenced by StartProfiling().

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

◆ StartProfiling() [1/2]

void v8::internal::CpuProfiler::StartProfiling ( const char *  title,
bool  record_samples = false 
)

Definition at line 413 of file cpu-profiler.cc.

413  {
414  if (profiles_->StartProfiling(title, record_samples)) {
416  }
417 }
bool StartProfiling(const char *title, bool record_samples)

References profiles_, StartProcessorIfNotStarted(), and v8::internal::CpuProfilesCollection::StartProfiling().

Referenced by StartProfiling().

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

◆ StartProfiling() [2/2]

void v8::internal::CpuProfiler::StartProfiling ( String title,
bool  record_samples 
)

Definition at line 420 of file cpu-profiler.cc.

420  {
421  StartProfiling(profiles_->GetName(title), record_samples);
422 }
void StartProfiling(const char *title, bool record_samples=false)

References v8::internal::CpuProfilesCollection::GetName(), profiles_, and StartProfiling().

+ Here is the call graph for this function:

◆ StartTickSample()

TickSample * v8::internal::CpuProfiler::StartTickSample ( )
inline

Definition at line 55 of file cpu-profiler-inl.h.

55  {
57  return NULL;
58 }

References is_profiling_, NULL, processor_, and v8::internal::ProfilerEventsProcessor::StartTickSample().

Referenced by v8::internal::Sampler::SampleStack().

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

◆ StopProcessor()

void v8::internal::CpuProfiler::StopProcessor ( )
private

Definition at line 479 of file cpu-profiler.cc.

479  {
480  Logger* logger = isolate_->logger();
481  Sampler* sampler = reinterpret_cast<Sampler*>(logger->ticker_);
482  is_profiling_ = false;
484  delete processor_;
485  delete generator_;
486  processor_ = NULL;
487  generator_ = NULL;
488  sampler->SetHasProcessingThread(false);
489  sampler->DecreaseProfilingDepth();
490  logger->is_logging_ = saved_is_logging_;
491 }

References v8::internal::Sampler::DecreaseProfilingDepth(), generator_, v8::internal::Logger::is_logging_, is_profiling_, isolate_, v8::internal::Isolate::logger(), NULL, processor_, saved_is_logging_, v8::internal::Sampler::SetHasProcessingThread(), v8::internal::ProfilerEventsProcessor::StopSynchronously(), and v8::internal::Logger::ticker_.

Referenced by DeleteAllProfiles(), and StopProcessorIfLastProfile().

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

◆ StopProcessorIfLastProfile()

void v8::internal::CpuProfiler::StopProcessorIfLastProfile ( const char *  title)
private

Definition at line 474 of file cpu-profiler.cc.

474  {
475  if (profiles_->IsLastProfile(title)) StopProcessor();
476 }

References v8::internal::CpuProfilesCollection::IsLastProfile(), profiles_, and StopProcessor().

Referenced by StopProfiling().

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

◆ StopProfiling() [1/2]

CpuProfile * v8::internal::CpuProfiler::StopProfiling ( const char *  title)

Definition at line 455 of file cpu-profiler.cc.

455  {
456  if (!is_profiling_) return NULL;
458  CpuProfile* result = profiles_->StopProfiling(title);
459  if (result != NULL) {
460  result->Print();
461  }
462  return result;
463 }
void StopProcessorIfLastProfile(const char *title)
CpuProfile * StopProfiling(const char *title)

References is_profiling_, NULL, v8::internal::CpuProfile::Print(), profiles_, StopProcessorIfLastProfile(), and v8::internal::CpuProfilesCollection::StopProfiling().

+ Here is the call graph for this function:

◆ StopProfiling() [2/2]

CpuProfile * v8::internal::CpuProfiler::StopProfiling ( String title)

Definition at line 466 of file cpu-profiler.cc.

466  {
467  if (!is_profiling_) return NULL;
468  const char* profile_title = profiles_->GetName(title);
469  StopProcessorIfLastProfile(profile_title);
470  return profiles_->StopProfiling(profile_title);
471 }

References v8::internal::CpuProfilesCollection::GetName(), is_profiling_, NULL, profiles_, StopProcessorIfLastProfile(), and v8::internal::CpuProfilesCollection::StopProfiling().

+ Here is the call graph for this function:

Member Data Documentation

◆ generator_

ProfileGenerator* v8::internal::CpuProfiler::generator_
private

Definition at line 261 of file cpu-profiler.h.

Referenced by generator(), StartProcessorIfNotStarted(), and StopProcessor().

◆ is_profiling_

◆ isolate_

Isolate* v8::internal::CpuProfiler::isolate_
private

Definition at line 258 of file cpu-profiler.h.

Referenced by isolate(), LogBuiltins(), StartProcessorIfNotStarted(), and StopProcessor().

◆ processor_

◆ profiles_

◆ sampling_interval_

base::TimeDelta v8::internal::CpuProfiler::sampling_interval_
private

Definition at line 259 of file cpu-profiler.h.

Referenced by set_sampling_interval(), and StartProcessorIfNotStarted().

◆ saved_is_logging_

bool v8::internal::CpuProfiler::saved_is_logging_
private

Definition at line 263 of file cpu-profiler.h.

Referenced by StartProcessorIfNotStarted(), and StopProcessor().


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