Index: include/v8-profiler.h |
diff --git a/include/v8-profiler.h b/include/v8-profiler.h |
index b2c1dc9818ac8e4f78660e48d6a0992815495fb5..6a09d50ea5635da3f1eff41aa995095b4d59592a 100644 |
--- a/include/v8-profiler.h |
+++ b/include/v8-profiler.h |
@@ -46,6 +46,40 @@ template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>; |
namespace v8 { |
+// TickSample captures the information collected for each sample. |
+struct TickSample { |
+ // Internal profiling (with --prof + tools/$OS-tick-processor) wants to |
+ // include the runtime function we're calling. Externally exposed tick |
+ // samples don't care. |
+ enum RecordCEntryFrame { kIncludeCEntryFrame, kSkipCEntryFrame }; |
+ |
+ TickSample() |
+ : state(OTHER), |
+ pc(nullptr), |
+ external_callback_entry(nullptr), |
+ frames_count(0), |
+ has_external_callback(false), |
+ update_stats(true) {} |
+ void Init(Isolate* isolate, const v8::RegisterState& state, |
+ RecordCEntryFrame record_c_entry_frame, bool update_stats); |
+ static bool GetStackSample(Isolate* isolate, const v8::RegisterState& state, |
+ RecordCEntryFrame record_c_entry_frame, |
+ void** frames, size_t frames_limit, |
+ v8::SampleInfo* sample_info); |
+ StateTag state; // The state of the VM. |
+ void* pc; // Instruction pointer. |
+ union { |
+ void* tos; // Top stack value (*sp). |
+ void* external_callback_entry; |
+ }; |
+ static const unsigned kMaxFramesCountLog2 = 8; |
+ static const unsigned kMaxFramesCount = (1 << kMaxFramesCountLog2) - 1; |
+ void* stack[kMaxFramesCount]; // Call stack. |
+ unsigned frames_count : kMaxFramesCountLog2; // Number of captured frames. |
+ bool has_external_callback : 1; |
+ bool update_stats : 1; // Whether the sample should update aggregated stats. |
+}; |
+ |
/** |
* CpuProfileNode represents a node in a call graph. |
*/ |