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

Side by Side Diff: src/platform-freebsd.cc

Issue 14057003: Remove profiler thread related methods from RuntimeProfiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed unused static fields Created 7 years, 8 months 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/platform-cygwin.cc ('k') | src/platform-linux.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 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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 instance_->StartSynchronously(); 769 instance_->StartSynchronously();
770 } else { 770 } else {
771 ASSERT(instance_->interval_ == sampler->interval()); 771 ASSERT(instance_->interval_ == sampler->interval());
772 } 772 }
773 } 773 }
774 774
775 static void RemoveActiveSampler(Sampler* sampler) { 775 static void RemoveActiveSampler(Sampler* sampler) {
776 ScopedLock lock(mutex_); 776 ScopedLock lock(mutex_);
777 SamplerRegistry::RemoveActiveSampler(sampler); 777 SamplerRegistry::RemoveActiveSampler(sampler);
778 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { 778 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) {
779 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_); 779 instance_->Join();
780 delete instance_; 780 delete instance_;
781 instance_ = NULL; 781 instance_ = NULL;
782 782
783 // Restore the old signal handler. 783 // Restore the old signal handler.
784 if (signal_handler_installed_) { 784 if (signal_handler_installed_) {
785 sigaction(SIGPROF, &old_signal_handler_, 0); 785 sigaction(SIGPROF, &old_signal_handler_, 0);
786 signal_handler_installed_ = false; 786 signal_handler_installed_ = false;
787 } 787 }
788 } 788 }
789 } 789 }
790 790
791 // Implement Thread::Run(). 791 // Implement Thread::Run().
792 virtual void Run() { 792 virtual void Run() {
793 SamplerRegistry::State state; 793 SamplerRegistry::State state;
794 while ((state = SamplerRegistry::GetState()) != 794 while ((state = SamplerRegistry::GetState()) !=
795 SamplerRegistry::HAS_NO_SAMPLERS) { 795 SamplerRegistry::HAS_NO_SAMPLERS) {
796 // When CPU profiling is enabled both JavaScript and C++ code is 796 // When CPU profiling is enabled both JavaScript and C++ code is
797 // profiled. We must not suspend. 797 // profiled. We must not suspend.
798 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) { 798 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) {
799 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this); 799 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this);
800 } else {
801 if (RuntimeProfiler::WaitForSomeIsolateToEnterJS()) continue;
802 } 800 }
803 Sleep(); // TODO(svenpanne) Figure out if OS:Sleep(interval_) is enough. 801 Sleep(); // TODO(svenpanne) Figure out if OS:Sleep(interval_) is enough.
804 } 802 }
805 } 803 }
806 804
807 static void DoCpuProfile(Sampler* sampler, void* raw_sender) { 805 static void DoCpuProfile(Sampler* sampler, void* raw_sender) {
808 if (!sampler->IsProfiling()) return; 806 if (!sampler->IsProfiling()) return;
809 SignalSender* sender = reinterpret_cast<SignalSender*>(raw_sender); 807 SignalSender* sender = reinterpret_cast<SignalSender*>(raw_sender);
810 sender->SendProfilingSignal(sampler->platform_data()->vm_tid()); 808 sender->SendProfilingSignal(sampler->platform_data()->vm_tid());
811 } 809 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 891
894 892
895 void Sampler::Stop() { 893 void Sampler::Stop() {
896 ASSERT(IsActive()); 894 ASSERT(IsActive());
897 SignalSender::RemoveActiveSampler(this); 895 SignalSender::RemoveActiveSampler(this);
898 SetActive(false); 896 SetActive(false);
899 } 897 }
900 898
901 899
902 } } // namespace v8::internal 900 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-cygwin.cc ('k') | src/platform-linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698