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

Unified Diff: src/api.cc

Issue 422593003: Initial GetSample implementation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed the comments. Fixed the nits. 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..6449057a92f3da23ced995f78c3af01c915218ac 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -9,6 +9,7 @@
#include <sanitizer/asan_interface.h>
#endif // V8_USE_ADDRESS_SANITIZER
#include <cmath> // For isnan.
+#include "include/v8.h"
#include "include/v8-debug.h"
#include "include/v8-profiler.h"
#include "include/v8-testing.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"
@@ -6706,6 +6708,26 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) {
}
+void Isolate::GetSample(Sample* sample) {
+ sample->frames_count = 0;
+
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
+
+ i::Logger* logger = isolate->logger();
+ if (logger == NULL) return;
+
+ i::Sampler* sampler = logger->sampler();
+ if (sampler == NULL) return;
+
+ // 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.
+
+ sampler->GetSample(sample);
+}
+
+
void Isolate::SetEventLogger(LogEventCallback that) {
// Do not overwrite the event logger if we want to log explicitly.
if (i::FLAG_log_timer_events) return;
« no previous file with comments | « include/v8.h ('k') | src/cpu-profiler.h » ('j') | test/cctest/test-sampler-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698