summaryrefslogtreecommitdiff
path: root/deps/v8/src/profiler/cpu-profiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/profiler/cpu-profiler.h')
-rw-r--r--deps/v8/src/profiler/cpu-profiler.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/deps/v8/src/profiler/cpu-profiler.h b/deps/v8/src/profiler/cpu-profiler.h
index e8d977424b..e7ca3fbd7b 100644
--- a/deps/v8/src/profiler/cpu-profiler.h
+++ b/deps/v8/src/profiler/cpu-profiler.h
@@ -27,7 +27,7 @@ class CodeEntry;
class CodeMap;
class CpuProfilesCollection;
class Isolate;
-class ProfileGenerator;
+class Symbolizer;
#define CODE_EVENTS_TYPE_LIST(V) \
V(CODE_CREATION, CodeCreateEventRecord) \
@@ -165,7 +165,7 @@ class V8_EXPORT_PRIVATE ProfilerEventsProcessor : public base::Thread,
virtual void SetSamplingInterval(base::TimeDelta) {}
protected:
- ProfilerEventsProcessor(Isolate* isolate, ProfileGenerator* generator,
+ ProfilerEventsProcessor(Isolate* isolate, Symbolizer* symbolizer,
ProfilerCodeObserver* code_observer);
// Called from events processing thread (Run() method.)
@@ -178,7 +178,7 @@ class V8_EXPORT_PRIVATE ProfilerEventsProcessor : public base::Thread,
};
virtual SampleProcessingResult ProcessOneSample() = 0;
- ProfileGenerator* generator_;
+ Symbolizer* symbolizer_;
ProfilerCodeObserver* code_observer_;
std::atomic_bool running_{true};
base::ConditionVariable running_cond_;
@@ -193,8 +193,9 @@ class V8_EXPORT_PRIVATE ProfilerEventsProcessor : public base::Thread,
class V8_EXPORT_PRIVATE SamplingEventsProcessor
: public ProfilerEventsProcessor {
public:
- SamplingEventsProcessor(Isolate* isolate, ProfileGenerator* generator,
+ SamplingEventsProcessor(Isolate* isolate, Symbolizer* symbolizer,
ProfilerCodeObserver* code_observer,
+ CpuProfilesCollection* profiles,
base::TimeDelta period, bool use_precise_sampling);
~SamplingEventsProcessor() override;
@@ -221,6 +222,7 @@ class V8_EXPORT_PRIVATE SamplingEventsProcessor
private:
SampleProcessingResult ProcessOneSample() override;
+ void SymbolizeAndAddToProfiles(const TickSampleEventRecord* record);
static const size_t kTickSampleBufferSize = 512 * KB;
static const size_t kTickSampleQueueLength =
@@ -228,6 +230,7 @@ class V8_EXPORT_PRIVATE SamplingEventsProcessor
SamplingCircularQueue<TickSampleEventRecord,
kTickSampleQueueLength> ticks_buffer_;
std::unique_ptr<sampler::Sampler> sampler_;
+ CpuProfilesCollection* profiles_;
base::TimeDelta period_; // Samples & code events processing period.
const bool use_precise_sampling_; // Whether or not busy-waiting is used for
// low sampling intervals on Windows.
@@ -243,6 +246,7 @@ class V8_EXPORT_PRIVATE ProfilerCodeObserver : public CodeEventObserver {
void CodeEventHandler(const CodeEventsContainer& evt_rec) override;
CodeMap* code_map() { return &code_map_; }
+ void ClearCodeMap();
private:
friend class ProfilerEventsProcessor;
@@ -294,7 +298,7 @@ class V8_EXPORT_PRIVATE CpuProfiler {
CpuProfiler(Isolate* isolate, CpuProfilingNamingMode naming_mode,
CpuProfilingLoggingMode logging_mode,
- CpuProfilesCollection* profiles, ProfileGenerator* test_generator,
+ CpuProfilesCollection* profiles, Symbolizer* test_symbolizer,
ProfilerEventsProcessor* test_processor);
~CpuProfiler();
@@ -304,13 +308,16 @@ class V8_EXPORT_PRIVATE CpuProfiler {
using ProfilingMode = v8::CpuProfilingMode;
using NamingMode = v8::CpuProfilingNamingMode;
using LoggingMode = v8::CpuProfilingLoggingMode;
+ using StartProfilingStatus = CpuProfilingStatus;
base::TimeDelta sampling_interval() const { return base_sampling_interval_; }
void set_sampling_interval(base::TimeDelta value);
void set_use_precise_sampling(bool);
void CollectSample();
- void StartProfiling(const char* title, CpuProfilingOptions options = {});
- void StartProfiling(String title, CpuProfilingOptions options = {});
+ StartProfilingStatus StartProfiling(const char* title,
+ CpuProfilingOptions options = {});
+ StartProfilingStatus StartProfiling(String title,
+ CpuProfilingOptions options = {});
CpuProfile* StopProfiling(const char* title);
CpuProfile* StopProfiling(String title);
@@ -321,13 +328,14 @@ class V8_EXPORT_PRIVATE CpuProfiler {
bool is_profiling() const { return is_profiling_; }
- ProfileGenerator* generator() const { return generator_.get(); }
+ Symbolizer* symbolizer() const { return symbolizer_.get(); }
ProfilerEventsProcessor* processor() const { return processor_.get(); }
Isolate* isolate() const { return isolate_; }
ProfilerListener* profiler_listener_for_test() const {
return profiler_listener_.get();
}
+ CodeMap* code_map_for_test() { return code_observer_.code_map(); }
private:
void StartProcessorIfNotStarted();
@@ -352,7 +360,7 @@ class V8_EXPORT_PRIVATE CpuProfiler {
// to a multiple of, or used as the default if unspecified.
base::TimeDelta base_sampling_interval_;
std::unique_ptr<CpuProfilesCollection> profiles_;
- std::unique_ptr<ProfileGenerator> generator_;
+ std::unique_ptr<Symbolizer> symbolizer_;
std::unique_ptr<ProfilerEventsProcessor> processor_;
std::unique_ptr<ProfilerListener> profiler_listener_;
std::unique_ptr<ProfilingScope> profiling_scope_;