OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 private: | 726 private: |
727 // Note: for profiled_thread_ Mach primitives are used instead of PThread's | 727 // Note: for profiled_thread_ Mach primitives are used instead of PThread's |
728 // because the latter doesn't provide thread manipulation primitives required. | 728 // because the latter doesn't provide thread manipulation primitives required. |
729 // For details, consult "Mac OS X Internals" book, Section 7.3. | 729 // For details, consult "Mac OS X Internals" book, Section 7.3. |
730 thread_act_t profiled_thread_; | 730 thread_act_t profiled_thread_; |
731 }; | 731 }; |
732 | 732 |
733 | 733 |
734 class SamplerThread : public Thread { | 734 class SamplerThread : public Thread { |
735 public: | 735 public: |
736 static const int kSamplerThreadStackSize = 32 * KB; | 736 static const int kSamplerThreadStackSize = 64 * KB; |
737 | 737 |
738 explicit SamplerThread(int interval) | 738 explicit SamplerThread(int interval) |
739 : Thread(Thread::Options("SamplerThread", kSamplerThreadStackSize)), | 739 : Thread(Thread::Options("SamplerThread", kSamplerThreadStackSize)), |
740 interval_(interval) {} | 740 interval_(interval) {} |
741 | 741 |
742 static void AddActiveSampler(Sampler* sampler) { | 742 static void AddActiveSampler(Sampler* sampler) { |
743 ScopedLock lock(mutex_); | 743 ScopedLock lock(mutex_); |
744 SamplerRegistry::AddActiveSampler(sampler); | 744 SamplerRegistry::AddActiveSampler(sampler); |
745 if (instance_ == NULL) { | 745 if (instance_ == NULL) { |
746 instance_ = new SamplerThread(sampler->interval()); | 746 instance_ = new SamplerThread(sampler->interval()); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 | 886 |
887 | 887 |
888 void Sampler::Stop() { | 888 void Sampler::Stop() { |
889 ASSERT(IsActive()); | 889 ASSERT(IsActive()); |
890 SamplerThread::RemoveActiveSampler(this); | 890 SamplerThread::RemoveActiveSampler(this); |
891 SetActive(false); | 891 SetActive(false); |
892 } | 892 } |
893 | 893 |
894 | 894 |
895 } } // namespace v8::internal | 895 } } // namespace v8::internal |
OLD | NEW |