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

Unified Diff: src/platform.h

Issue 5325003: Simplify ProfLazyMode test on Linux. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments addressed Created 10 years, 1 month 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 | « src/log.cc ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « src/log.cc ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698