Chromium Code Reviews| Index: src/platform.h |
| diff --git a/src/platform.h b/src/platform.h |
| index 42e6eae93e284f3786cffb87805ac430cc3f65e3..1580d589ac99fa0c417e94f62dc07a81ee0e2112 100644 |
| --- a/src/platform.h |
| +++ b/src/platform.h |
| @@ -554,11 +554,14 @@ class TickSample { |
| class Sampler { |
| public: |
| // Initialize sampler. |
| - explicit Sampler(int interval, bool profiling); |
| + Sampler(int interval, bool profiling); |
| virtual ~Sampler(); |
| // Performs stack sampling. |
| - virtual void SampleStack(TickSample* sample) = 0; |
| + void SampleStack(TickSample* sample) { |
| + DoSampleStack(sample); |
| + IncSamplesTaken(); |
| + } |
| // This method is called for each sampling period with the current |
| // program counter. |
| @@ -580,14 +583,23 @@ class Sampler { |
| // Whether the sampler is running (that is, consumes resources). |
| bool IsActive() const { return active_; } |
| + int samples_taken() const { return samples_taken_; } |
| + void ResetSamplesTaken() { samples_taken_ = 0; } |
| + |
| class PlatformData; |
| + protected: |
| + virtual void DoSampleStack(TickSample* sample) = 0; |
| + |
| private: |
| + void IncSamplesTaken() { if (++samples_taken_ < 0) samples_taken_ = 0; } |
| + |
| const int interval_; |
| const bool profiling_; |
| const bool synchronous_; |
| bool active_; |
| PlatformData* data_; // Platform specific data. |
| + int samples_taken_; // Counts stack samples taken. Used in tests. |
|
Vitaly Repeshko
2010/11/25 15:48:46
Please put this comment before the getter and rese
mnaganov (inactive)
2010/11/25 15:53:22
Done.
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
| }; |