Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Unified Diff: src/api.cc

Issue 422593003: Initial GetSample implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Moved the thread pausing logic inside Sampler::GetSample Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 7c484de53ee1e537a8abeefdce1e0cab69e4952e..a0ddd6c635b949f73e01388e317fb0e92d9dd4db 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,23 @@ void HeapProfiler::SetRetainedObjectInfo(UniqueId id,
reinterpret_cast<i::HeapProfiler*>(this)->SetRetainedObjectInfo(id, info);
}
+void Sampler::GetSample(Isolate* isolate,
+ unsigned max_frame_count,
+ Sample* sample) {
+ i::Isolate* isolate_ = reinterpret_cast<i::Isolate*>(isolate);
+
+ i::CpuProfiler* profiler_ = isolate_->cpu_profiler();
+ if (profiler_ == NULL) return;
+
+ i::ProfilerEventsProcessor* processor_ = profiler_->processor();
+ if (processor_ == NULL) return;
+
+ i::Sampler* sampler_ = processor_->sampler();
+ if (sampler_ == NULL) return;
+
+ sampler_->GetSample(reinterpret_cast<i::TickSample*>(sample),
+ max_frame_count);
+}
v8::Testing::StressType internal::Testing::stress_type_ =
v8::Testing::kStressTypeOpt;
« include/v8-sampler.h ('K') | « include/v8-sampler.h ('k') | src/cpu-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698