| 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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 EmbeddedVector<Address, kMaxFramesCount> stack; // Call stack. | 503 EmbeddedVector<Address, kMaxFramesCount> stack; // Call stack. |
| 504 int frames_count; // Number of captured frames. | 504 int frames_count; // Number of captured frames. |
| 505 }; | 505 }; |
| 506 | 506 |
| 507 class Sampler { | 507 class Sampler { |
| 508 public: | 508 public: |
| 509 // Initialize sampler. | 509 // Initialize sampler. |
| 510 explicit Sampler(int interval, bool profiling); | 510 explicit Sampler(int interval, bool profiling); |
| 511 virtual ~Sampler(); | 511 virtual ~Sampler(); |
| 512 | 512 |
| 513 // Performs stack sampling. |
| 514 virtual void SampleStack(TickSample* sample) = 0; |
| 515 |
| 513 // This method is called for each sampling period with the current | 516 // This method is called for each sampling period with the current |
| 514 // program counter. | 517 // program counter. |
| 515 virtual void Tick(TickSample* sample) = 0; | 518 virtual void Tick(TickSample* sample) = 0; |
| 516 | 519 |
| 517 // Start and stop sampler. | 520 // Start and stop sampler. |
| 518 void Start(); | 521 void Start(); |
| 519 void Stop(); | 522 void Stop(); |
| 520 | 523 |
| 521 // Is the sampler used for profiling. | 524 // Is the sampler used for profiling. |
| 522 inline bool IsProfiling() { return profiling_; } | 525 inline bool IsProfiling() { return profiling_; } |
| 523 | 526 |
| 524 // Whether the sampler is running (that is, consumes resources). | 527 // Whether the sampler is running (that is, consumes resources). |
| 525 inline bool IsActive() { return active_; } | 528 inline bool IsActive() { return active_; } |
| 526 | 529 |
| 527 class PlatformData; | 530 class PlatformData; |
| 528 | 531 |
| 529 private: | 532 private: |
| 530 int interval_; | 533 const int interval_; |
| 531 bool profiling_; | 534 const bool profiling_; |
| 532 bool active_; | 535 bool active_; |
| 533 PlatformData* data_; // Platform specific data. | 536 PlatformData* data_; // Platform specific data. |
| 534 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); | 537 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); |
| 535 }; | 538 }; |
| 536 | 539 |
| 537 #endif // ENABLE_LOGGING_AND_PROFILING | 540 #endif // ENABLE_LOGGING_AND_PROFILING |
| 538 | 541 |
| 539 } } // namespace v8::internal | 542 } } // namespace v8::internal |
| 540 | 543 |
| 541 #endif // V8_PLATFORM_H_ | 544 #endif // V8_PLATFORM_H_ |
| OLD | NEW |