| 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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 // Whether the sampler is running (that is, consumes resources). | 613 // Whether the sampler is running (that is, consumes resources). |
| 614 bool IsActive() const { return NoBarrier_Load(&active_); } | 614 bool IsActive() const { return NoBarrier_Load(&active_); } |
| 615 | 615 |
| 616 Isolate* isolate() { return isolate_; } | 616 Isolate* isolate() { return isolate_; } |
| 617 | 617 |
| 618 // Used in tests to make sure that stack sampling is performed. | 618 // Used in tests to make sure that stack sampling is performed. |
| 619 int samples_taken() const { return samples_taken_; } | 619 int samples_taken() const { return samples_taken_; } |
| 620 void ResetSamplesTaken() { samples_taken_ = 0; } | 620 void ResetSamplesTaken() { samples_taken_ = 0; } |
| 621 | 621 |
| 622 class PlatformData; | 622 class PlatformData; |
| 623 PlatformData* data() { return data_; } |
| 623 | 624 |
| 624 PlatformData* platform_data() { return data_; } | 625 PlatformData* platform_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 Isolate* isolate_; | 634 Isolate* isolate_; |
| 634 const int interval_; | 635 const int interval_; |
| 635 Atomic32 profiling_; | 636 Atomic32 profiling_; |
| 636 Atomic32 active_; | 637 Atomic32 active_; |
| 637 PlatformData* data_; // Platform specific data. | 638 PlatformData* data_; // Platform specific data. |
| 638 int samples_taken_; // Counts stack samples taken. | 639 int samples_taken_; // Counts stack samples taken. |
| 639 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 640 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
| 640 }; | 641 }; |
| 641 | 642 |
| 642 | 643 |
| 643 #endif // ENABLE_LOGGING_AND_PROFILING | 644 #endif // ENABLE_LOGGING_AND_PROFILING |
| 644 | 645 |
| 645 } } // namespace v8::internal | 646 } } // namespace v8::internal |
| 646 | 647 |
| 647 #endif // V8_PLATFORM_H_ | 648 #endif // V8_PLATFORM_H_ |
| OLD | NEW |