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

Unified Diff: src/api.cc

Issue 422593003: Initial GetSample implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed typo. Made sure SIGPROF handler is always installed. Added a test. Created 6 years, 4 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..fa687bbad090f8cddb47dab6a2bb3ed99cc89881 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"
@@ -30,6 +31,7 @@
#include "src/heap-snapshot-generator-inl.h"
#include "src/icu_util.h"
#include "src/json-parser.h"
+#include "src/log.h"
#include "src/messages.h"
#include "src/natives.h"
#include "src/parser.h"
@@ -7425,6 +7427,23 @@ void HeapProfiler::SetRetainedObjectInfo(UniqueId id,
reinterpret_cast<i::HeapProfiler*>(this)->SetRetainedObjectInfo(id, info);
}
+Sample* Sampler::GetSample(Isolate* isolate,
+ Sample* sample) {
+ i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
+
+ i::Logger* logger = internal_isolate->logger();
+ if (logger == NULL) return NULL;
+
+ i::Sampler* sampler = logger->sampler();
+ if (sampler == NULL) return NULL;
+
+ // TODO(gohlap): These checks and getters above are just transitory.
+ // Get rid of those as we make the API mature.
+ // We have these right now because we want the new API
+ // to play well with the current cpu-profiler thread inside v8.
+
+ return sampler->GetSample(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') | test/cctest/test-sampler-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698