Index: runtime/vm/profiler.h |
diff --git a/runtime/vm/profiler.h b/runtime/vm/profiler.h |
index 0b681c41caee8302bc9fcab43f6797b8d60bf41e..98fe57df51e1c3883d599faa5bca59333e5e7fe2 100644 |
--- a/runtime/vm/profiler.h |
+++ b/runtime/vm/profiler.h |
@@ -119,8 +119,12 @@ class Sample { |
timestamp_ = timestamp; |
tid_ = tid; |
isolate_ = isolate; |
+ pc_marker_ = 0; |
vm_tag_ = VMTag::kInvalidTagId; |
user_tag_ = UserTags::kNoUserTag; |
+ sp_ = 0; |
+ fp_ = 0; |
+ state_ = 0; |
for (intptr_t i = 0; i < kSampleFramesSize; i++) { |
pcs_[i] = 0; |
} |
@@ -165,12 +169,66 @@ class Sample { |
user_tag_ = tag; |
} |
+ uword pc_marker() const { |
+ return pc_marker_; |
+ } |
+ |
+ void set_pc_marker(uword pc_marker) { |
+ pc_marker_ = pc_marker; |
+ } |
+ |
+ uword sp() { |
+ return sp_; |
+ } |
+ |
+ void set_sp(uword sp) { |
+ sp_ = sp; |
+ } |
+ |
+ uword fp() { |
+ return fp_; |
+ } |
+ |
+ void set_fp(uword fp) { |
+ fp_ = fp; |
+ } |
+ |
+ void InsertCallerForTopFrame(uword pc) { |
+ // Shift all entries down. |
+ for (intptr_t i = 1; i < kSampleFramesSize - 1; i++) { |
+ pcs_[i + 1] = pcs_[i]; |
+ } |
+ pcs_[1] = pc; |
+ } |
+ |
+ bool processed() const { |
+ return ProcessedBit::decode(state_); |
+ } |
+ |
+ void set_processed(bool processed) { |
+ state_ = ProcessedBit::update(processed, state_); |
+ } |
+ |
+ bool leaf_frame_is_dart() const { |
+ return LeafFrameIsDart::decode(state_); |
+ } |
+ |
+ void set_leaf_frame_is_dart(bool leaf_frame_is_dart) { |
+ state_ = LeafFrameIsDart::update(leaf_frame_is_dart, state_); |
+ } |
+ |
private: |
+ class ProcessedBit : public BitField<bool, 0, 1> {}; |
+ class LeafFrameIsDart : public BitField<bool, 1, 1> {}; |
int64_t timestamp_; |
ThreadId tid_; |
Isolate* isolate_; |
+ uword pc_marker_; |
uword vm_tag_; |
uword user_tag_; |
+ uword sp_; |
+ uword fp_; |
+ uword state_; |
uword pcs_[kSampleFramesSize]; |
}; |
@@ -229,6 +287,29 @@ class SampleBuffer { |
} |
} |
+ void VisitSamplesByReference(SampleVisitor* visitor) { |
+ ASSERT(visitor != NULL); |
+ Sample* sample; |
+ const intptr_t length = capacity(); |
+ for (intptr_t i = 0; i < length; i++) { |
+ sample = At(i); |
srdjan
2014/05/02 18:20:29
You can put Sample* sample = At(i); here.
OR
const
Cutch
2014/05/02 18:37:03
Done.
|
+ if (sample->isolate() != visitor->isolate()) { |
+ // Another isolate. |
+ continue; |
+ } |
+ if (sample->timestamp() == 0) { |
+ // Empty. |
+ continue; |
+ } |
+ if (sample->At(0) == 0) { |
+ // No frames. |
+ continue; |
+ } |
+ visitor->IncrementVisited(); |
+ visitor->VisitSample(sample); |
+ } |
+ } |
+ |
private: |
Sample* samples_; |
intptr_t capacity_; |