| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 void DecreaseProfilingDepth() { NoBarrier_AtomicIncrement(&profiling_, -1); } | 615 void DecreaseProfilingDepth() { NoBarrier_AtomicIncrement(&profiling_, -1); } |
| 616 | 616 |
| 617 // Whether the sampler is running (that is, consumes resources). | 617 // Whether the sampler is running (that is, consumes resources). |
| 618 bool IsActive() const { return NoBarrier_Load(&active_); } | 618 bool IsActive() const { return NoBarrier_Load(&active_); } |
| 619 | 619 |
| 620 // Used in tests to make sure that stack sampling is performed. | 620 // Used in tests to make sure that stack sampling is performed. |
| 621 int samples_taken() const { return samples_taken_; } | 621 int samples_taken() const { return samples_taken_; } |
| 622 void ResetSamplesTaken() { samples_taken_ = 0; } | 622 void ResetSamplesTaken() { samples_taken_ = 0; } |
| 623 | 623 |
| 624 class PlatformData; | 624 class PlatformData; |
| 625 PlatformData* data() { return data_; } |
| 625 | 626 |
| 626 protected: | 627 protected: |
| 627 virtual void DoSampleStack(TickSample* sample) = 0; | 628 virtual void DoSampleStack(TickSample* sample) = 0; |
| 628 | 629 |
| 629 private: | 630 private: |
| 630 void SetActive(bool value) { NoBarrier_Store(&active_, value); } | 631 void SetActive(bool value) { NoBarrier_Store(&active_, value); } |
| 631 void IncSamplesTaken() { if (++samples_taken_ < 0) samples_taken_ = 0; } | 632 void IncSamplesTaken() { if (++samples_taken_ < 0) samples_taken_ = 0; } |
| 632 | 633 |
| 633 const int interval_; | 634 const int interval_; |
| 634 Atomic32 profiling_; | 635 Atomic32 profiling_; |
| 635 Atomic32 active_; | 636 Atomic32 active_; |
| 636 PlatformData* data_; // Platform specific data. | 637 PlatformData* data_; // Platform specific data. |
| 637 int samples_taken_; // Counts stack samples taken. | 638 int samples_taken_; // Counts stack samples taken. |
| 638 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 639 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
| 639 }; | 640 }; |
| 640 | 641 |
| 641 #endif // ENABLE_LOGGING_AND_PROFILING | 642 #endif // ENABLE_LOGGING_AND_PROFILING |
| 642 | 643 |
| 643 } } // namespace v8::internal | 644 } } // namespace v8::internal |
| 644 | 645 |
| 645 #endif // V8_PLATFORM_H_ | 646 #endif // V8_PLATFORM_H_ |
| OLD | NEW |