Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: src/platform.h

Issue 5325003: Simplify ProfLazyMode test on Linux. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments addressed Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/log.cc ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 Address function; // The last called JS function. 547 Address function; // The last called JS function.
548 static const int kMaxFramesCount = 64; 548 static const int kMaxFramesCount = 64;
549 Address stack[kMaxFramesCount]; // Call stack. 549 Address stack[kMaxFramesCount]; // Call stack.
550 int frames_count; // Number of captured frames. 550 int frames_count; // Number of captured frames.
551 }; 551 };
552 552
553 #ifdef ENABLE_LOGGING_AND_PROFILING 553 #ifdef ENABLE_LOGGING_AND_PROFILING
554 class Sampler { 554 class Sampler {
555 public: 555 public:
556 // Initialize sampler. 556 // Initialize sampler.
557 explicit Sampler(int interval, bool profiling); 557 Sampler(int interval, bool profiling);
558 virtual ~Sampler(); 558 virtual ~Sampler();
559 559
560 // Performs stack sampling. 560 // Performs stack sampling.
561 virtual void SampleStack(TickSample* sample) = 0; 561 void SampleStack(TickSample* sample) {
562 DoSampleStack(sample);
563 IncSamplesTaken();
564 }
562 565
563 // This method is called for each sampling period with the current 566 // This method is called for each sampling period with the current
564 // program counter. 567 // program counter.
565 virtual void Tick(TickSample* sample) = 0; 568 virtual void Tick(TickSample* sample) = 0;
566 569
567 // Start and stop sampler. 570 // Start and stop sampler.
568 void Start(); 571 void Start();
569 void Stop(); 572 void Stop();
570 573
571 // Is the sampler used for profiling? 574 // Is the sampler used for profiling?
572 bool IsProfiling() const { return profiling_; } 575 bool IsProfiling() const { return profiling_; }
573 576
574 // Is the sampler running in sync with the JS thread? On platforms 577 // Is the sampler running in sync with the JS thread? On platforms
575 // where the sampler is implemented with a thread that wakes up 578 // where the sampler is implemented with a thread that wakes up
576 // every now and then, having a synchronous sampler implies 579 // every now and then, having a synchronous sampler implies
577 // suspending/resuming the JS thread. 580 // suspending/resuming the JS thread.
578 bool IsSynchronous() const { return synchronous_; } 581 bool IsSynchronous() const { return synchronous_; }
579 582
580 // Whether the sampler is running (that is, consumes resources). 583 // Whether the sampler is running (that is, consumes resources).
581 bool IsActive() const { return active_; } 584 bool IsActive() const { return active_; }
582 585
586 int samples_taken() const { return samples_taken_; }
587 void ResetSamplesTaken() { samples_taken_ = 0; }
588
583 class PlatformData; 589 class PlatformData;
584 590
591 protected:
592 virtual void DoSampleStack(TickSample* sample) = 0;
593
585 private: 594 private:
595 void IncSamplesTaken() { if (++samples_taken_ < 0) samples_taken_ = 0; }
596
586 const int interval_; 597 const int interval_;
587 const bool profiling_; 598 const bool profiling_;
588 const bool synchronous_; 599 const bool synchronous_;
589 bool active_; 600 bool active_;
590 PlatformData* data_; // Platform specific data. 601 PlatformData* data_; // Platform specific data.
602 int samples_taken_; // Counts stack samples taken. Used in tests.
Vitaly Repeshko 2010/11/25 15:48:46 Please put this comment before the getter and rese
mnaganov (inactive) 2010/11/25 15:53:22 Done.
591 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler); 603 DISALLOW_IMPLICIT_CONSTRUCTORS(Sampler);
592 }; 604 };
593 605
594 #endif // ENABLE_LOGGING_AND_PROFILING 606 #endif // ENABLE_LOGGING_AND_PROFILING
595 607
596 } } // namespace v8::internal 608 } } // namespace v8::internal
597 609
598 #endif // V8_PLATFORM_H_ 610 #endif // V8_PLATFORM_H_
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698