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

Unified Diff: include/v8-profiler.h

Issue 2105943002: Expose TickSample and its APIs in v8-profiler.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 5 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') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
*/
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698