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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 void DecreaseProfilingDepth() { NoBarrier_AtomicIncrement(&profiling_, -1); } | 606 void DecreaseProfilingDepth() { NoBarrier_AtomicIncrement(&profiling_, -1); } |
607 | 607 |
608 // Whether the sampler is running (that is, consumes resources). | 608 // Whether the sampler is running (that is, consumes resources). |
609 bool IsActive() const { return NoBarrier_Load(&active_); } | 609 bool IsActive() const { return NoBarrier_Load(&active_); } |
610 | 610 |
611 // Used in tests to make sure that stack sampling is performed. | 611 // Used in tests to make sure that stack sampling is performed. |
612 int samples_taken() const { return samples_taken_; } | 612 int samples_taken() const { return samples_taken_; } |
613 void ResetSamplesTaken() { samples_taken_ = 0; } | 613 void ResetSamplesTaken() { samples_taken_ = 0; } |
614 | 614 |
615 class PlatformData; | 615 class PlatformData; |
| 616 PlatformData* data() { return data_; } |
616 | 617 |
617 protected: | 618 protected: |
618 virtual void DoSampleStack(TickSample* sample) = 0; | 619 virtual void DoSampleStack(TickSample* sample) = 0; |
619 | 620 |
620 private: | 621 private: |
621 void SetActive(bool value) { NoBarrier_Store(&active_, value); } | 622 void SetActive(bool value) { NoBarrier_Store(&active_, value); } |
622 void IncSamplesTaken() { if (++samples_taken_ < 0) samples_taken_ = 0; } | 623 void IncSamplesTaken() { if (++samples_taken_ < 0) samples_taken_ = 0; } |
623 | 624 |
624 const int interval_; | 625 const int interval_; |
625 Atomic32 profiling_; | 626 Atomic32 profiling_; |
626 Atomic32 active_; | 627 Atomic32 active_; |
627 PlatformData* data_; // Platform specific data. | 628 PlatformData* data_; // Platform specific data. |
628 int samples_taken_; // Counts stack samples taken. | 629 int samples_taken_; // Counts stack samples taken. |
629 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 630 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
630 }; | 631 }; |
631 | 632 |
632 #endif // ENABLE_LOGGING_AND_PROFILING | 633 #endif // ENABLE_LOGGING_AND_PROFILING |
633 | 634 |
634 } } // namespace v8::internal | 635 } } // namespace v8::internal |
635 | 636 |
636 #endif // V8_PLATFORM_H_ | 637 #endif // V8_PLATFORM_H_ |
OLD | NEW |