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

Unified Diff: include/v8.h

Issue 596533002: Initial implementation of GetStackSample sampling profiler API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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') | src/sampler.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 ec1941e6fd86eec42707e4d41011112961fe2109..ea5089a6247ad2769297f90b2a1c2fd294f7d7f0 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1415,6 +1415,14 @@ class V8_EXPORT StackFrame {
};
+struct RegisterState {
+ RegisterState() : pc(NULL), sp(NULL), fp(NULL) {}
+ void* pc; // Instruction pointer.
+ void* sp; // Stack pointer.
+ void* fp; // Frame pointer.
+};
+
+
/**
* A JSON Parser.
*/
@@ -4548,6 +4556,19 @@ class V8_EXPORT Isolate {
void GetHeapStatistics(HeapStatistics* heap_statistics);
/**
+ * Get a call stack sample from the isolate.
+ * \param state Execution state.
+ * \param frames Caller allocated buffer to store stack frames.
+ * \param frames_limit Maximum number of frames to capture. The buffer must
+ * be large enough to hold the number of frames.
+ * \return Actual number of captured frames.
+ * \note GetStackSample should only be called when the JS thread is paused or
+ * interrupted. Otherwise the behavior is undefined.
+ */
+ int GetStackSample(const RegisterState& state, void** frames,
Benedikt Meurer 2014/09/23 05:47:48 Nit: int -> size_t
alph 2014/09/23 07:30:46 Done. I just saw v8 tends to use int whenever poss
+ int frames_limit);
Benedikt Meurer 2014/09/23 05:47:48 Nit: int -> size_t
alph 2014/09/23 07:30:46 Done.
+
+ /**
* 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') | src/sampler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698