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

Side by Side Diff: src/platform-solaris.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-openbsd.cc ('k') | src/platform-win32.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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 instance_->StartSynchronously(); 747 instance_->StartSynchronously();
748 } else { 748 } else {
749 ASSERT(instance_->interval_ == sampler->interval()); 749 ASSERT(instance_->interval_ == sampler->interval());
750 } 750 }
751 } 751 }
752 752
753 static void RemoveActiveSampler(Sampler* sampler) { 753 static void RemoveActiveSampler(Sampler* sampler) {
754 ScopedLock lock(mutex_); 754 ScopedLock lock(mutex_);
755 SamplerRegistry::RemoveActiveSampler(sampler); 755 SamplerRegistry::RemoveActiveSampler(sampler);
756 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { 756 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) {
757 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_); 757 instance_->Join();
758 delete instance_; 758 delete instance_;
759 instance_ = NULL; 759 instance_ = NULL;
760 RestoreSignalHandler(); 760 RestoreSignalHandler();
761 } 761 }
762 } 762 }
763 763
764 // Implement Thread::Run(). 764 // Implement Thread::Run().
765 virtual void Run() { 765 virtual void Run() {
766 SamplerRegistry::State state; 766 SamplerRegistry::State state;
767 while ((state = SamplerRegistry::GetState()) != 767 while ((state = SamplerRegistry::GetState()) !=
768 SamplerRegistry::HAS_NO_SAMPLERS) { 768 SamplerRegistry::HAS_NO_SAMPLERS) {
769 // When CPU profiling is enabled both JavaScript and C++ code is 769 // When CPU profiling is enabled both JavaScript and C++ code is
770 // profiled. We must not suspend. 770 // profiled. We must not suspend.
771 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) { 771 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) {
772 if (!signal_handler_installed_) InstallSignalHandler(); 772 if (!signal_handler_installed_) InstallSignalHandler();
773 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this); 773 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this);
774 } else { 774 } else if (signal_handler_installed_) {
775 if (signal_handler_installed_) RestoreSignalHandler(); 775 RestoreSignalHandler();
776 if (RuntimeProfiler::WaitForSomeIsolateToEnterJS()) continue;
777 } 776 }
778 Sleep(); // TODO(svenpanne) Figure out if OS:Sleep(interval_) is enough. 777 Sleep(); // TODO(svenpanne) Figure out if OS:Sleep(interval_) is enough.
779 } 778 }
780 } 779 }
781 780
782 static void DoCpuProfile(Sampler* sampler, void* raw_sender) { 781 static void DoCpuProfile(Sampler* sampler, void* raw_sender) {
783 if (!sampler->IsProfiling()) return; 782 if (!sampler->IsProfiling()) return;
784 SignalSender* sender = reinterpret_cast<SignalSender*>(raw_sender); 783 SignalSender* sender = reinterpret_cast<SignalSender*>(raw_sender);
785 sender->SendProfilingSignal(sampler->platform_data()->vm_tid()); 784 sender->SendProfilingSignal(sampler->platform_data()->vm_tid());
786 } 785 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 } 866 }
868 867
869 868
870 void Sampler::Stop() { 869 void Sampler::Stop() {
871 ASSERT(IsActive()); 870 ASSERT(IsActive());
872 SignalSender::RemoveActiveSampler(this); 871 SignalSender::RemoveActiveSampler(this);
873 SetActive(false); 872 SetActive(false);
874 } 873 }
875 874
876 } } // namespace v8::internal 875 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-openbsd.cc ('k') | src/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698