V8 Project
v8::internal::CpuProfilesCollection Class Reference

#include <profile-generator.h>

+ Collaboration diagram for v8::internal::CpuProfilesCollection:

Public Member Functions

 CpuProfilesCollection (Heap *heap)
 
 ~CpuProfilesCollection ()
 
bool StartProfiling (const char *title, bool record_samples)
 
CpuProfileStopProfiling (const char *title)
 
List< CpuProfile * > * profiles ()
 
const char * GetName (Name *name)
 
const char * GetName (int args_count)
 
const char * GetFunctionName (Name *name)
 
const char * GetFunctionName (const char *name)
 
bool IsLastProfile (const char *title)
 
void RemoveProfile (CpuProfile *profile)
 
CodeEntryNewCodeEntry (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 AddPathToCurrentProfiles (base::TimeTicks timestamp, const Vector< CodeEntry * > &path)
 

Static Public Attributes

static const int kMaxSimultaneousProfiles = 100
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (CpuProfilesCollection)
 

Private Attributes

StringsStorage function_and_resource_names_
 
List< CodeEntry * > code_entries_
 
List< CpuProfile * > finished_profiles_
 
List< CpuProfile * > current_profiles_
 
base::Semaphore current_profiles_semaphore_
 

Detailed Description

Definition at line 256 of file profile-generator.h.

Constructor & Destructor Documentation

◆ CpuProfilesCollection()

v8::internal::CpuProfilesCollection::CpuProfilesCollection ( Heap heap)
explicit

Definition at line 435 of file profile-generator.cc.

◆ ~CpuProfilesCollection()

v8::internal::CpuProfilesCollection::~CpuProfilesCollection ( )

Definition at line 451 of file profile-generator.cc.

451  {
455 }
static void DeleteCodeEntry(CodeEntry **entry_ptr)
static void DeleteCpuProfile(CpuProfile **profile_ptr)

References code_entries_, current_profiles_, v8::internal::DeleteCodeEntry(), v8::internal::DeleteCpuProfile(), and finished_profiles_.

+ Here is the call graph for this function:

Member Function Documentation

◆ AddPathToCurrentProfiles()

void v8::internal::CpuProfilesCollection::AddPathToCurrentProfiles ( base::TimeTicks  timestamp,
const Vector< CodeEntry * > &  path 
)

Definition at line 519 of file profile-generator.cc.

520  {
521  // As starting / stopping profiles is rare relatively to this
522  // method, we don't bother minimizing the duration of lock holding,
523  // e.g. copying contents of the list to a local vector.
525  for (int i = 0; i < current_profiles_.length(); ++i) {
526  current_profiles_[i]->AddPath(timestamp, path);
527  }
529 }

References current_profiles_, and current_profiles_semaphore_.

Referenced by v8::internal::ProfileGenerator::RecordTickSample().

+ Here is the caller graph for this function:

◆ DISALLOW_COPY_AND_ASSIGN()

v8::internal::CpuProfilesCollection::DISALLOW_COPY_AND_ASSIGN ( CpuProfilesCollection  )
private

◆ GetFunctionName() [1/2]

const char* v8::internal::CpuProfilesCollection::GetFunctionName ( const char *  name)
inline

Definition at line 273 of file profile-generator.h.

273  {
275  }
const char * GetFunctionName(Name *name)
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

References function_and_resource_names_, v8::internal::StringsStorage::GetFunctionName(), and name.

+ Here is the call graph for this function:

◆ GetFunctionName() [2/2]

const char* v8::internal::CpuProfilesCollection::GetFunctionName ( Name name)
inline

Definition at line 270 of file profile-generator.h.

270  {
272  }

References function_and_resource_names_, v8::internal::StringsStorage::GetFunctionName(), and name.

Referenced by v8::internal::CpuProfiler::CodeCreateEvent().

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

◆ GetName() [1/2]

const char* v8::internal::CpuProfilesCollection::GetName ( int  args_count)
inline

Definition at line 267 of file profile-generator.h.

267  {
268  return function_and_resource_names_.GetName(args_count);
269  }
const char * GetName(Name *name)

References function_and_resource_names_, and v8::internal::StringsStorage::GetName().

+ Here is the call graph for this function:

◆ GetName() [2/2]

const char* v8::internal::CpuProfilesCollection::GetName ( Name name)
inline

Definition at line 264 of file profile-generator.h.

264  {
266  }

References function_and_resource_names_, v8::internal::StringsStorage::GetName(), and name.

Referenced by v8::internal::CpuProfiler::CallbackEvent(), v8::internal::CpuProfiler::CodeCreateEvent(), v8::internal::CpuProfiler::GetterCallbackEvent(), v8::internal::CpuProfiler::RegExpCodeCreateEvent(), v8::internal::CpuProfiler::SetterCallbackEvent(), v8::internal::CpuProfiler::StartProfiling(), and v8::internal::CpuProfiler::StopProfiling().

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

◆ IsLastProfile()

bool v8::internal::CpuProfilesCollection::IsLastProfile ( const char *  title)

Definition at line 498 of file profile-generator.cc.

498  {
499  // Called from VM thread, and only it can mutate the list,
500  // so no locking is needed here.
501  if (current_profiles_.length() != 1) return false;
502  return StrLength(title) == 0
503  || strcmp(current_profiles_[0]->title(), title) == 0;
504 }
int StrLength(const char *string)
Definition: vector.h:147

References current_profiles_, and v8::internal::StrLength().

Referenced by v8::internal::CpuProfiler::StopProcessorIfLastProfile().

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

◆ NewCodeEntry()

CodeEntry * v8::internal::CpuProfilesCollection::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 
)

Definition at line 532 of file profile-generator.cc.

538  {
539  CodeEntry* code_entry = new CodeEntry(tag,
540  name,
541  name_prefix,
542  resource_name,
543  line_number,
544  column_number);
545  code_entries_.Add(code_entry);
546  return code_entry;
547 }

References code_entries_, and name.

Referenced by v8::internal::CpuProfiler::CallbackEvent(), v8::internal::CpuProfiler::CodeCreateEvent(), v8::internal::CpuProfiler::GetterCallbackEvent(), v8::internal::CpuProfiler::RegExpCodeCreateEvent(), and v8::internal::CpuProfiler::SetterCallbackEvent().

+ Here is the caller graph for this function:

◆ profiles()

List<CpuProfile*>* v8::internal::CpuProfilesCollection::profiles ( )
inline

Definition at line 263 of file profile-generator.h.

263 { return &finished_profiles_; }

References finished_profiles_.

Referenced by v8::internal::CpuProfiler::DeleteProfile(), v8::internal::CpuProfiler::GetProfile(), and v8::internal::CpuProfiler::GetProfilesCount().

+ Here is the caller graph for this function:

◆ RemoveProfile()

void v8::internal::CpuProfilesCollection::RemoveProfile ( CpuProfile profile)

Definition at line 507 of file profile-generator.cc.

507  {
508  // Called from VM thread for a completed profile.
509  for (int i = 0; i < finished_profiles_.length(); i++) {
510  if (profile == finished_profiles_[i]) {
511  finished_profiles_.Remove(i);
512  return;
513  }
514  }
515  UNREACHABLE();
516 }
#define UNREACHABLE()
Definition: logging.h:30

References finished_profiles_, and UNREACHABLE.

Referenced by v8::internal::CpuProfiler::DeleteProfile().

+ Here is the caller graph for this function:

◆ StartProfiling()

bool v8::internal::CpuProfilesCollection::StartProfiling ( const char *  title,
bool  record_samples 
)

Definition at line 458 of file profile-generator.cc.

459  {
463  return false;
464  }
465  for (int i = 0; i < current_profiles_.length(); ++i) {
466  if (strcmp(current_profiles_[i]->title(), title) == 0) {
467  // Ignore attempts to start profile with the same title...
469  // ... though return true to force it collect a sample.
470  return true;
471  }
472  }
473  current_profiles_.Add(new CpuProfile(title, record_samples));
475  return true;
476 }

References current_profiles_, current_profiles_semaphore_, and kMaxSimultaneousProfiles.

Referenced by v8::internal::CpuProfiler::StartProfiling().

+ Here is the caller graph for this function:

◆ StopProfiling()

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

Definition at line 479 of file profile-generator.cc.

479  {
480  const int title_len = StrLength(title);
481  CpuProfile* profile = NULL;
483  for (int i = current_profiles_.length() - 1; i >= 0; --i) {
484  if (title_len == 0 || strcmp(current_profiles_[i]->title(), title) == 0) {
485  profile = current_profiles_.Remove(i);
486  break;
487  }
488  }
490 
491  if (profile == NULL) return NULL;
492  profile->CalculateTotalTicksAndSamplingRate();
493  finished_profiles_.Add(profile);
494  return profile;
495 }
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

References v8::internal::CpuProfile::CalculateTotalTicksAndSamplingRate(), current_profiles_, current_profiles_semaphore_, finished_profiles_, NULL, and v8::internal::StrLength().

Referenced by v8::internal::CpuProfiler::StopProfiling().

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

Member Data Documentation

◆ code_entries_

List<CodeEntry*> v8::internal::CpuProfilesCollection::code_entries_
private

Definition at line 296 of file profile-generator.h.

Referenced by NewCodeEntry(), and ~CpuProfilesCollection().

◆ current_profiles_

List<CpuProfile*> v8::internal::CpuProfilesCollection::current_profiles_
private

◆ current_profiles_semaphore_

base::Semaphore v8::internal::CpuProfilesCollection::current_profiles_semaphore_
private

Definition at line 301 of file profile-generator.h.

Referenced by AddPathToCurrentProfiles(), StartProfiling(), and StopProfiling().

◆ finished_profiles_

List<CpuProfile*> v8::internal::CpuProfilesCollection::finished_profiles_
private

◆ function_and_resource_names_

StringsStorage v8::internal::CpuProfilesCollection::function_and_resource_names_
private

Definition at line 295 of file profile-generator.h.

Referenced by GetFunctionName(), and GetName().

◆ kMaxSimultaneousProfiles

const int v8::internal::CpuProfilesCollection::kMaxSimultaneousProfiles = 100
static

Definition at line 292 of file profile-generator.h.

Referenced by StartProfiling().


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