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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 virtual void SampleStack(TickSample* sample) = 0; | 556 virtual void SampleStack(TickSample* sample) = 0; |
557 | 557 |
558 // This method is called for each sampling period with the current | 558 // This method is called for each sampling period with the current |
559 // program counter. | 559 // program counter. |
560 virtual void Tick(TickSample* sample) = 0; | 560 virtual void Tick(TickSample* sample) = 0; |
561 | 561 |
562 // Start and stop sampler. | 562 // Start and stop sampler. |
563 void Start(); | 563 void Start(); |
564 void Stop(); | 564 void Stop(); |
565 | 565 |
566 // Is the sampler used for profiling. | 566 // Is the sampler used for profiling? |
567 inline bool IsProfiling() { return profiling_; } | 567 bool IsProfiling() const { return profiling_; } |
| 568 |
| 569 // Is the sampler running in sync with the JS thread? On platforms |
| 570 // where the sampler is implemented with a thread that wakes up |
| 571 // every now and then, having a synchronous sampler implies |
| 572 // suspending/resuming the JS thread. |
| 573 bool IsSynchronous() const { return synchronous_; } |
568 | 574 |
569 // Whether the sampler is running (that is, consumes resources). | 575 // Whether the sampler is running (that is, consumes resources). |
570 inline bool IsActive() { return active_; } | 576 bool IsActive() const { return active_; } |
571 | 577 |
572 class PlatformData; | 578 class PlatformData; |
573 | 579 |
574 private: | 580 private: |
575 const int interval_; | 581 const int interval_; |
576 const bool profiling_; | 582 const bool profiling_; |
| 583 const bool synchronous_; |
577 bool active_; | 584 bool active_; |
578 PlatformData* data_; // Platform specific data. | 585 PlatformData* data_; // Platform specific data. |
579 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 586 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
580 }; | 587 }; |
581 | 588 |
582 #endif // ENABLE_LOGGING_AND_PROFILING | 589 #endif // ENABLE_LOGGING_AND_PROFILING |
583 | 590 |
584 } } // namespace v8::internal | 591 } } // namespace v8::internal |
585 | 592 |
586 #endif // V8_PLATFORM_H_ | 593 #endif // V8_PLATFORM_H_ |
OLD | NEW |