Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 8a9a5afa9879947dd99eb7b8b1ca0ecb268fbf8f..8aba8109038486c879446d80d1271d19d4e73d0d 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" |
@@ -6672,6 +6674,24 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { |
} |
+void Isolate::GetSample(Sample* sample) { |
+ 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; |