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

Unified Diff: include/v8.h

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
« no previous file with comments | « no previous file | src/api.cc » ('j') | test/cctest/test-sampler-api.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 73384946ba7d93594fd5c3d78753dfe01c2726f6..fbe3dea2a7164ab6e70c2e23d567123206ca4caf 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1297,6 +1297,35 @@ class V8_EXPORT StackFrame {
};
+/* TODO(gholap): This should go away and struct Sample should
+ just use const void* instead of Address.
+ Currently we need it because of implementation details. */
+typedef unsigned char* Address;
+
+
+/**
+ * Isolate::Getsample collects the current JS execution state as a sample.
+ * A collected sample contains,
+ * - stack : An array of addresses.
+ * One address per stack frame.
+ * The address is the instruction pointer,
+ * pointing to the instruction which led to the
+ * creation of the stack frame.
+ * (for example, a function call)
+ * - frames_count: Number of stack frames that were captured.
+ * That is, stack[frames_count+i] might contain meaningless
+ * addresses for any i >= 0.
+ */
+struct V8_EXPORT Sample {
+ Sample()
+ : frames_count(0) {}
+ static const unsigned kMaxFramesCount = 255;
+
+ Address stack[kMaxFramesCount]; // Call stack.
+ unsigned frames_count; // Number of captured frames.
+};
+
+
/**
* A JSON Parser.
*/
@@ -4217,6 +4246,11 @@ class V8_EXPORT Isolate {
void GetHeapStatistics(HeapStatistics* heap_statistics);
/**
+ * Get a sample from the isolate.
+ */
+ void GetSample(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
« no previous file with comments | « no previous file | src/api.cc » ('j') | test/cctest/test-sampler-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698