Chromium Code Reviews| Index: runtime/vm/profiler.h |
| diff --git a/runtime/vm/profiler.h b/runtime/vm/profiler.h |
| index 0b681c41caee8302bc9fcab43f6797b8d60bf41e..d1eaff7a6268713f9765c4715b7fc6c4b9e0b14f 100644 |
| --- a/runtime/vm/profiler.h |
| +++ b/runtime/vm/profiler.h |
| @@ -83,7 +83,7 @@ class IsolateProfilerData { |
| }; |
| -class SampleVisitor { |
| +class SampleVisitor : public ValueObject { |
| public: |
| explicit SampleVisitor(Isolate* isolate) : isolate_(isolate), visited_(0) { } |
| virtual ~SampleVisitor() {} |
| @@ -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() { |
|
siva
2014/05/02 20:43:37
const
|
| + return sp_; |
| + } |
| + |
| + void set_sp(uword sp) { |
| + sp_ = sp; |
| + } |
| + |
| + uword fp() { |
|
siva
2014/05/02 20:43:37
const
|
| + return fp_; |
| + } |
| + |
| + void set_fp(uword fp) { |
| + fp_ = fp; |
| + } |
| + |
| + void InsertCallerForTopFrame(uword pc) { |
| + // Shift all entries down. |
|
siva
2014/05/02 20:43:37
Maybe you should add a comment here indicating wha
|
| + 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> {}; |
|
siva
2014/05/02 20:43:37
it would be more readable to enumerate the bits, e
|
| 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]; |
| }; |
| @@ -207,25 +265,23 @@ class SampleBuffer { |
| void VisitSamples(SampleVisitor* visitor) { |
| ASSERT(visitor != NULL); |
| - Sample sample; |
| const intptr_t length = capacity(); |
| for (intptr_t i = 0; i < length; i++) { |
| - // Copy the sample. |
| - sample = *At(i); |
| - if (sample.isolate() != visitor->isolate()) { |
| + Sample* sample = At(i); |
| + if (sample->isolate() != visitor->isolate()) { |
| // Another isolate. |
| continue; |
| } |
| - if (sample.timestamp() == 0) { |
| + if (sample->timestamp() == 0) { |
| // Empty. |
| continue; |
| } |
| - if (sample.At(0) == 0) { |
| + if (sample->At(0) == 0) { |
| // No frames. |
| continue; |
| } |
| visitor->IncrementVisited(); |
| - visitor->VisitSample(&sample); |
| + visitor->VisitSample(sample); |
| } |
| } |