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

Unified Diff: src/api.cc

Issue 422593003: Initial GetSample implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Moved initialization of sample from the signal emitter to sigal handler thread. 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
« no previous file with comments | « include/v8-sampler.h ('k') | src/cpu-profiler.h » ('j') | src/sampler.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « include/v8-sampler.h ('k') | src/cpu-profiler.h » ('j') | src/sampler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698