Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index 7c484de53ee1e537a8abeefdce1e0cab69e4952e..cb3385dac0298fc06042ce1461f0fc37ac7acd65 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -11,6 +11,7 @@ |
| #include <cmath> // For isnan. |
| #include "include/v8-debug.h" |
| #include "include/v8-profiler.h" |
| +#include "include/v8-sampler.h" |
| #include "include/v8-testing.h" |
| #include "src/assert-scope.h" |
| #include "src/base/platform/platform.h" |
| @@ -7425,6 +7426,22 @@ void HeapProfiler::SetRetainedObjectInfo(UniqueId id, |
| reinterpret_cast<i::HeapProfiler*>(this)->SetRetainedObjectInfo(id, info); |
| } |
| +Sample* Sampler::GetSample(Isolate* isolate, |
| + Sample* sample) { |
| + i::Isolate* isolate_ = reinterpret_cast<i::Isolate*>(isolate); |
| + |
| + i::CpuProfiler* profiler_ = isolate_->cpu_profiler(); |
| + if (profiler_ == NULL) return NULL; |
| + |
| + i::ProfilerEventsProcessor* processor_ = profiler_->processor(); |
| + if (processor_ == NULL) return NULL; |
| + |
| + i::Sampler* sampler_ = processor_->sampler(); |
| + if (sampler_ == NULL) return NULL; |
|
fmeawad
2014/07/29 18:30:50
Can you cache those between calls?
i.e. check and
gholap
2014/07/29 23:25:20
Acknowledged.
|
| + |
| + return reinterpret_cast<Sample*>( |
| + sampler_->GetSample(reinterpret_cast<i::TickSample*>(sample))); |
| +} |
| v8::Testing::StressType internal::Testing::stress_type_ = |
| v8::Testing::kStressTypeOpt; |