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

Unified Diff: runtime/vm/profiler.h

Issue 131853007: Add flag to control number of stack frames collected by profiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | runtime/vm/profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.h
diff --git a/runtime/vm/profiler.h b/runtime/vm/profiler.h
index 706e64aab973de36abf5729989a9ba211ec42f4f..1e7c52701b54003e91c3bb518bbc986a9ce0becb 100644
--- a/runtime/vm/profiler.h
+++ b/runtime/vm/profiler.h
@@ -17,7 +17,8 @@ namespace dart {
class JSONArray;
class JSONStream;
class ProfilerCodeRegionTable;
-struct Sample;
+class Sample;
+class SampleBuffer;
// Profiler
class Profiler : public AllStatic {
@@ -81,22 +82,47 @@ class IsolateProfilerData {
// Profile sample.
-struct Sample {
- static const intptr_t kNumStackFrames = 6;
+class Sample {
+ public:
enum SampleType {
- kIsolateStart,
- kIsolateStop,
kIsolateSample,
};
- int64_t timestamp;
- ThreadId tid;
- Isolate* isolate;
- uintptr_t pcs[kNumStackFrames];
- SampleType type;
- uint16_t vm_tags;
- uint16_t runtime_tags;
+ static void InitOnce();
+
+ uintptr_t At(intptr_t i) const;
+ void SetAt(intptr_t i, uintptr_t pc);
void Init(SampleType type, Isolate* isolate, int64_t timestamp, ThreadId tid);
+ void CopyInto(Sample* dst) const;
+
+ static Sample* Allocate();
+ static intptr_t instance_size() {
+ return instance_size_;
+ }
+
+ SampleType type() const {
+ return type_;
+ }
+
+ Isolate* isolate() const {
+ return isolate_;
+ }
+
+ int64_t timestamp() const {
+ return timestamp_;
+ }
+
+ private:
+ static intptr_t instance_size_;
+ int64_t timestamp_;
+ ThreadId tid_;
+ Isolate* isolate_;
+ SampleType type_;
+ // Note: This class has a size determined at run-time. The pcs_ array
+ // must be the final field.
+ uintptr_t pcs_[0];
+
+ DISALLOW_COPY_AND_ASSIGN(Sample);
};
@@ -109,14 +135,9 @@ class SampleBuffer {
~SampleBuffer();
intptr_t capacity() const { return capacity_; }
-
Sample* ReserveSample();
-
- Sample GetSample(intptr_t i) const {
- ASSERT(i >= 0);
- ASSERT(i < capacity_);
- return samples_[i];
- }
+ void CopySample(intptr_t i, Sample* sample) const;
+ Sample* At(intptr_t idx) const;
private:
Sample* samples_;
« no previous file with comments | « no previous file | runtime/vm/profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698