V8 Project
v8::internal::Sampler Class Referenceabstract

#include <sampler.h>

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

Public Member Functions

 Sampler (Isolate *isolate, int interval)
 
virtual ~Sampler ()
 
Isolateisolate () const
 
int interval () const
 
void SampleStack (const RegisterState &regs)
 
void Start ()
 
void Stop ()
 
bool IsProfiling () const
 
void IncreaseProfilingDepth ()
 
void DecreaseProfilingDepth ()
 
bool IsActive () const
 
void DoSample ()
 
void SetHasProcessingThread (bool value)
 
unsigned js_and_external_sample_count () const
 
void StartCountingSamples ()
 
PlatformData * platform_data () const
 

Static Public Member Functions

static void SetUp ()
 
static void TearDown ()
 

Protected Member Functions

virtual void Tick (TickSample *sample)=0
 

Private Member Functions

void SetActive (bool value)
 
 DISALLOW_IMPLICIT_CONSTRUCTORS (Sampler)
 

Private Attributes

Isolateisolate_
 
const int interval_
 
base::Atomic32 profiling_
 
base::Atomic32 has_processing_thread_
 
base::Atomic32 active_
 
PlatformData * data_
 
bool is_counting_samples_
 
unsigned js_and_external_sample_count_
 

Detailed Description

Definition at line 56 of file sampler.h.

Constructor & Destructor Documentation

◆ Sampler()

v8::internal::Sampler::Sampler ( Isolate isolate,
int  interval 
)

Definition at line 637 of file sampler.cc.

638  : isolate_(isolate),
640  profiling_(false),
641  has_processing_thread_(false),
642  active_(false),
643  is_counting_samples_(false),
645  data_ = new PlatformData;
646 }
base::Atomic32 active_
Definition: sampler.h:118
PlatformData * data_
Definition: sampler.h:119
int interval() const
Definition: sampler.h:67
base::Atomic32 has_processing_thread_
Definition: sampler.h:117
base::Atomic32 profiling_
Definition: sampler.h:116
const int interval_
Definition: sampler.h:115
Isolate * isolate() const
Definition: sampler.h:66
Isolate * isolate_
Definition: sampler.h:114
unsigned js_and_external_sample_count_
Definition: sampler.h:122

References data_.

◆ ~Sampler()

v8::internal::Sampler::~Sampler ( )
virtual

Definition at line 649 of file sampler.cc.

649  {
650  DCHECK(!IsActive());
651  delete data_;
652 }
bool IsActive() const
Definition: sampler.h:85
#define DCHECK(condition)
Definition: logging.h:205

References data_, DCHECK, and IsActive().

+ Here is the call graph for this function:

Member Function Documentation

◆ DecreaseProfilingDepth()

void v8::internal::Sampler::DecreaseProfilingDepth ( )

Definition at line 677 of file sampler.cc.

677  {
678 #if defined(USE_SIGNALS)
679  SignalHandler::DecreaseSamplerCount();
680 #endif
682 }
Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32 *ptr, Atomic32 increment)

References v8::base::NoBarrier_AtomicIncrement(), and profiling_.

Referenced by v8::internal::Ticker::ClearProfiler(), and v8::internal::CpuProfiler::StopProcessor().

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

◆ DISALLOW_IMPLICIT_CONSTRUCTORS()

v8::internal::Sampler::DISALLOW_IMPLICIT_CONSTRUCTORS ( Sampler  )
private

◆ DoSample()

void v8::internal::Sampler::DoSample ( )

Referenced by v8::internal::ProfilerEventsProcessor::Run(), and v8::internal::SamplerThread::Run().

+ Here is the caller graph for this function:

◆ IncreaseProfilingDepth()

void v8::internal::Sampler::IncreaseProfilingDepth ( )

Definition at line 669 of file sampler.cc.

669  {
671 #if defined(USE_SIGNALS)
672  SignalHandler::IncreaseSamplerCount();
673 #endif
674 }

References v8::base::NoBarrier_AtomicIncrement(), and profiling_.

Referenced by v8::internal::Ticker::SetProfiler(), and v8::internal::CpuProfiler::StartProcessorIfNotStarted().

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

◆ interval()

int v8::internal::Sampler::interval ( ) const
inline

Definition at line 67 of file sampler.h.

67 { return interval_; }

References interval_.

Referenced by v8::internal::SamplerThread::AddActiveSampler().

+ Here is the caller graph for this function:

◆ IsActive()

bool v8::internal::Sampler::IsActive ( ) const
inline

Definition at line 85 of file sampler.h.

85 { return base::NoBarrier_Load(&active_); }
Atomic8 NoBarrier_Load(volatile const Atomic8 *ptr)

References active_, and v8::base::NoBarrier_Load().

Referenced by v8::internal::SamplerThread::AddActiveSampler(), v8::internal::Ticker::ClearProfiler(), v8::internal::Isolate::Deinit(), v8::internal::SamplerThread::RemoveActiveSampler(), v8::internal::Ticker::SetProfiler(), Start(), Stop(), ~Sampler(), and v8::internal::Ticker::~Ticker().

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

◆ isolate()

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

Definition at line 66 of file sampler.h.

66 { return isolate_; }

References isolate_.

Referenced by v8::internal::SamplerThread::Run().

+ Here is the caller graph for this function:

◆ IsProfiling()

bool v8::internal::Sampler::IsProfiling ( ) const
inline

Definition at line 77 of file sampler.h.

77  {
78  return base::NoBarrier_Load(&profiling_) > 0 &&
80  }

References has_processing_thread_, v8::base::NoBarrier_Load(), and profiling_.

Referenced by v8::internal::SamplerThread::Run().

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

◆ js_and_external_sample_count()

unsigned v8::internal::Sampler::js_and_external_sample_count ( ) const
inline

Definition at line 95 of file sampler.h.

95  {
97  }

References js_and_external_sample_count_.

◆ platform_data()

PlatformData* v8::internal::Sampler::platform_data ( ) const
inline

Definition at line 104 of file sampler.h.

104 { return data_; }

References data_.

◆ SampleStack()

void v8::internal::Sampler::SampleStack ( const RegisterState regs)

Definition at line 685 of file sampler.cc.

685  {
686  TickSample* sample = isolate_->cpu_profiler()->StartTickSample();
687  TickSample sample_obj;
688  if (sample == NULL) sample = &sample_obj;
689  sample->Init(isolate_, state);
690  if (is_counting_samples_) {
691  if (sample->state == JS || sample->state == EXTERNAL) {
693  }
694  }
695  Tick(sample);
696  if (sample != &sample_obj) {
698  }
699 }
TickSample * StartTickSample()
CpuProfiler * cpu_profiler() const
Definition: isolate.h:971
virtual void Tick(TickSample *sample)=0
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
void Init(Isolate *isolate, const RegisterState &state)
Definition: sampler.cc:579

References v8::internal::Isolate::cpu_profiler(), v8::internal::EXTERNAL, v8::internal::CpuProfiler::FinishTickSample(), v8::internal::TickSample::Init(), is_counting_samples_, isolate_, v8::internal::JS, js_and_external_sample_count_, NULL, v8::internal::CpuProfiler::StartTickSample(), v8::internal::TickSample::state, and Tick().

+ Here is the call graph for this function:

◆ SetActive()

void v8::internal::Sampler::SetActive ( bool  value)
inlineprivate

Definition at line 112 of file sampler.h.

112 { base::NoBarrier_Store(&active_, value); }
void NoBarrier_Store(volatile Atomic8 *ptr, Atomic8 value)

References active_, and v8::base::NoBarrier_Store().

Referenced by Start(), and Stop().

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

◆ SetHasProcessingThread()

void v8::internal::Sampler::SetHasProcessingThread ( bool  value)
inline

Definition at line 90 of file sampler.h.

90  {
92  }

References has_processing_thread_, and v8::base::NoBarrier_Store().

Referenced by v8::internal::CpuProfiler::StartProcessorIfNotStarted(), and v8::internal::CpuProfiler::StopProcessor().

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

◆ SetUp()

void v8::internal::Sampler::SetUp ( )
static

Definition at line 621 of file sampler.cc.

621  {
622 #if defined(USE_SIGNALS)
623  SignalHandler::SetUp();
624 #endif
626 }

References v8::internal::SamplerThread::SetUp().

Referenced by v8::internal::V8::InitializeOncePerProcessImpl().

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

◆ Start()

void v8::internal::Sampler::Start ( )

Definition at line 655 of file sampler.cc.

655  {
656  DCHECK(!IsActive());
657  SetActive(true);
659 }
static void AddActiveSampler(Sampler *sampler)
Definition: sampler.cc:500
void SetActive(bool value)
Definition: sampler.h:112

References v8::internal::SamplerThread::AddActiveSampler(), DCHECK, IsActive(), and SetActive().

Referenced by v8::internal::Ticker::SetProfiler().

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

◆ StartCountingSamples()

void v8::internal::Sampler::StartCountingSamples ( )
inline

Definition at line 98 of file sampler.h.

98  {
99  is_counting_samples_ = true;
101  }

References is_counting_samples_, and js_and_external_sample_count_.

◆ Stop()

void v8::internal::Sampler::Stop ( )

Definition at line 662 of file sampler.cc.

662  {
663  DCHECK(IsActive());
665  SetActive(false);
666 }
static void RemoveActiveSampler(Sampler *sampler)
Definition: sampler.cc:518

References DCHECK, IsActive(), v8::internal::SamplerThread::RemoveActiveSampler(), and SetActive().

Referenced by v8::internal::Ticker::ClearProfiler(), v8::internal::Isolate::Deinit(), and v8::internal::Ticker::~Ticker().

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

◆ TearDown()

void v8::internal::Sampler::TearDown ( )
static

Definition at line 629 of file sampler.cc.

629  {
631 #if defined(USE_SIGNALS)
632  SignalHandler::TearDown();
633 #endif
634 }
static void TearDown()
Definition: sampler.cc:498

References v8::internal::SamplerThread::TearDown().

Referenced by v8::internal::V8::TearDown().

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

◆ Tick()

virtual void v8::internal::Sampler::Tick ( TickSample sample)
protectedpure virtual

Implemented in v8::internal::Ticker.

Referenced by SampleStack().

+ Here is the caller graph for this function:

Member Data Documentation

◆ active_

base::Atomic32 v8::internal::Sampler::active_
private

Definition at line 118 of file sampler.h.

Referenced by IsActive(), and SetActive().

◆ data_

PlatformData* v8::internal::Sampler::data_
private

Definition at line 119 of file sampler.h.

Referenced by platform_data(), Sampler(), and ~Sampler().

◆ has_processing_thread_

base::Atomic32 v8::internal::Sampler::has_processing_thread_
private

Definition at line 117 of file sampler.h.

Referenced by IsProfiling(), and SetHasProcessingThread().

◆ interval_

const int v8::internal::Sampler::interval_
private

Definition at line 115 of file sampler.h.

Referenced by interval().

◆ is_counting_samples_

bool v8::internal::Sampler::is_counting_samples_
private

Definition at line 120 of file sampler.h.

Referenced by SampleStack(), and StartCountingSamples().

◆ isolate_

Isolate* v8::internal::Sampler::isolate_
private

Definition at line 114 of file sampler.h.

Referenced by isolate(), and SampleStack().

◆ js_and_external_sample_count_

unsigned v8::internal::Sampler::js_and_external_sample_count_
private

Definition at line 122 of file sampler.h.

Referenced by js_and_external_sample_count(), SampleStack(), and StartCountingSamples().

◆ profiling_

base::Atomic32 v8::internal::Sampler::profiling_
private

Definition at line 116 of file sampler.h.

Referenced by DecreaseProfilingDepth(), IncreaseProfilingDepth(), and IsProfiling().


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