Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 7c484de53ee1e537a8abeefdce1e0cab69e4952e..79e59bb98696b7690834c76d751e5db018d0d934 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,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; |