Chromium Code Reviews| Index: runtime/vm/profiler.h |
| diff --git a/runtime/vm/profiler.h b/runtime/vm/profiler.h |
| index 706e64aab973de36abf5729989a9ba211ec42f4f..6c27c2d4bae71f2c6c85bbd6b1a3aaa93cfd750c 100644 |
| --- a/runtime/vm/profiler.h |
| +++ b/runtime/vm/profiler.h |
| @@ -18,6 +18,7 @@ class JSONArray; |
| class JSONStream; |
| class ProfilerCodeRegionTable; |
| struct Sample; |
| +class SampleBuffer; |
| // Profiler |
| class Profiler : public AllStatic { |
| @@ -82,21 +83,26 @@ class IsolateProfilerData { |
| // Profile sample. |
| struct Sample { |
|
siva
2014/01/16 23:34:23
why not just make it class Sample ?
Cutch
2014/01/17 16:02:25
Done.
|
| - static const intptr_t kNumStackFrames = 6; |
| 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; |
| + uintptr_t pcs[0]; |
|
siva
2014/01/16 23:34:23
Document that this needs to be the last field, no
Cutch
2014/01/17 16:02:25
Done.
|
| void Init(SampleType type, Isolate* isolate, int64_t timestamp, ThreadId tid); |
| + void CopyInto(Sample* dst) const; |
| + |
| + static Sample* Allocate(); |
| + static intptr_t InstanceSize(); |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(Sample); |
| }; |
| @@ -109,14 +115,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_; |