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

Side by Side Diff: src/platform-openbsd.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-macos.cc ('k') | src/platform-solaris.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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 instance_->StartSynchronously(); 831 instance_->StartSynchronously();
832 } else { 832 } else {
833 ASSERT(instance_->interval_ == sampler->interval()); 833 ASSERT(instance_->interval_ == sampler->interval());
834 } 834 }
835 } 835 }
836 836
837 static void RemoveActiveSampler(Sampler* sampler) { 837 static void RemoveActiveSampler(Sampler* sampler) {
838 ScopedLock lock(mutex_); 838 ScopedLock lock(mutex_);
839 SamplerRegistry::RemoveActiveSampler(sampler); 839 SamplerRegistry::RemoveActiveSampler(sampler);
840 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { 840 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) {
841 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_); 841 instance_->Join();
842 delete instance_; 842 delete instance_;
843 instance_ = NULL; 843 instance_ = NULL;
844 RestoreSignalHandler(); 844 RestoreSignalHandler();
845 } 845 }
846 } 846 }
847 847
848 // Implement Thread::Run(). 848 // Implement Thread::Run().
849 virtual void Run() { 849 virtual void Run() {
850 SamplerRegistry::State state; 850 SamplerRegistry::State state;
851 while ((state = SamplerRegistry::GetState()) != 851 while ((state = SamplerRegistry::GetState()) !=
852 SamplerRegistry::HAS_NO_SAMPLERS) { 852 SamplerRegistry::HAS_NO_SAMPLERS) {
853 // When CPU profiling is enabled both JavaScript and C++ code is 853 // When CPU profiling is enabled both JavaScript and C++ code is
854 // profiled. We must not suspend. 854 // profiled. We must not suspend.
855 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) { 855 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) {
856 if (!signal_handler_installed_) InstallSignalHandler(); 856 if (!signal_handler_installed_) InstallSignalHandler();
857 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this); 857 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this);
858 } else { 858 } else if (signal_handler_installed_) {
859 if (signal_handler_installed_) RestoreSignalHandler(); 859 RestoreSignalHandler();
860 if (RuntimeProfiler::WaitForSomeIsolateToEnterJS()) continue;
861 } 860 }
862 Sleep(); // TODO(svenpanne) Figure out if OS:Sleep(interval_) is enough. 861 Sleep(); // TODO(svenpanne) Figure out if OS:Sleep(interval_) is enough.
863 } 862 }
864 } 863 }
865 864
866 static void DoCpuProfile(Sampler* sampler, void* raw_sender) { 865 static void DoCpuProfile(Sampler* sampler, void* raw_sender) {
867 if (!sampler->IsProfiling()) return; 866 if (!sampler->IsProfiling()) return;
868 SignalSender* sender = reinterpret_cast<SignalSender*>(raw_sender); 867 SignalSender* sender = reinterpret_cast<SignalSender*>(raw_sender);
869 sender->SendProfilingSignal(sampler->platform_data()->vm_tid()); 868 sender->SendProfilingSignal(sampler->platform_data()->vm_tid());
870 } 869 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 949
951 950
952 void Sampler::Stop() { 951 void Sampler::Stop() {
953 ASSERT(IsActive()); 952 ASSERT(IsActive());
954 SignalSender::RemoveActiveSampler(this); 953 SignalSender::RemoveActiveSampler(this);
955 SetActive(false); 954 SetActive(false);
956 } 955 }
957 956
958 957
959 } } // namespace v8::internal 958 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-macos.cc ('k') | src/platform-solaris.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698