Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index e4c7087d304d8d88da2b7f12a7c903566021805f..f839eda678da0bb987f7b79a11b6845fe912b869 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -1416,6 +1416,32 @@ class V8_EXPORT StackFrame { |
/** |
+ * Isolate::GetSample collects the current JS execution state as a sample. |
+ * A collected sample contains program counter values. |
+ */ |
+class V8_EXPORT Sample { |
+ public: |
+ enum { kMaxSize = 255u }; |
+ |
+ Sample() : size_(0) {} |
+ template <class InputIterator> |
+ Sample(InputIterator first, InputIterator last) |
loislo
2014/09/18 13:07:28
Looks like it should be a v8 internal constructor
gholap
2014/09/18 23:24:14
We start with: We don't want to expose the private
loislo
2014/09/19 08:58:16
Got it. The only thing that still bother me is the
|
+ : size_(0) { |
+ for (; first != last && size_ < kMaxSize; ++first) data_[size_++] = *first; |
+ } |
+ |
+ typedef const void* const* const_iterator; |
+ const_iterator begin() const { return &data_[0]; } |
+ const_iterator end() const { return &data_[size_]; } |
+ size_t size() const { return size_; } |
+ |
+ private: |
+ const void* data_[kMaxSize]; |
+ size_t size_; |
+}; |
+ |
+ |
+/** |
* A JSON Parser. |
*/ |
class V8_EXPORT JSON { |
@@ -4549,6 +4575,17 @@ class V8_EXPORT Isolate { |
void GetHeapStatistics(HeapStatistics* heap_statistics); |
/** |
+ * Get a sample from the isolate. |
+ * \param sp Stack pointer. |
+ * \param fp Frame pointer. |
+ * \param sample Pointer to (a pre-allocated) sample which will be filled. |
+ * \note GetSample should only be called when the JS thread is paused or |
+ * interrupted. If that is not the case, |
+ * GetSample behaviour is undefined. |
+ */ |
+ void GetSample(void* sp, void* fp, Sample* sample); |
+ |
+ /** |
* Adjusts the amount of registered external memory. Used to give V8 an |
* indication of the amount of externally allocated memory that is kept alive |
* by JavaScript objects. V8 uses this to decide when to perform global |