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

Side by Side Diff: src/platform-win32.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-solaris.cc ('k') | src/runtime-profiler.h » ('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 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 instance_->StartSynchronously(); 2020 instance_->StartSynchronously();
2021 } else { 2021 } else {
2022 ASSERT(instance_->interval_ == sampler->interval()); 2022 ASSERT(instance_->interval_ == sampler->interval());
2023 } 2023 }
2024 } 2024 }
2025 2025
2026 static void RemoveActiveSampler(Sampler* sampler) { 2026 static void RemoveActiveSampler(Sampler* sampler) {
2027 ScopedLock lock(mutex_); 2027 ScopedLock lock(mutex_);
2028 SamplerRegistry::RemoveActiveSampler(sampler); 2028 SamplerRegistry::RemoveActiveSampler(sampler);
2029 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { 2029 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) {
2030 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_); 2030 instance_->Join();
2031 delete instance_; 2031 delete instance_;
2032 instance_ = NULL; 2032 instance_ = NULL;
2033 } 2033 }
2034 } 2034 }
2035 2035
2036 // Implement Thread::Run(). 2036 // Implement Thread::Run().
2037 virtual void Run() { 2037 virtual void Run() {
2038 SamplerRegistry::State state; 2038 SamplerRegistry::State state;
2039 while ((state = SamplerRegistry::GetState()) != 2039 while ((state = SamplerRegistry::GetState()) !=
2040 SamplerRegistry::HAS_NO_SAMPLERS) { 2040 SamplerRegistry::HAS_NO_SAMPLERS) {
2041 // When CPU profiling is enabled both JavaScript and C++ code is 2041 // When CPU profiling is enabled both JavaScript and C++ code is
2042 // profiled. We must not suspend. 2042 // profiled. We must not suspend.
2043 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) { 2043 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) {
2044 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this); 2044 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this);
2045 } else {
2046 if (RuntimeProfiler::WaitForSomeIsolateToEnterJS()) continue;
2047 } 2045 }
2048 OS::Sleep(interval_); 2046 OS::Sleep(interval_);
2049 } 2047 }
2050 } 2048 }
2051 2049
2052 static void DoCpuProfile(Sampler* sampler, void* raw_sampler_thread) { 2050 static void DoCpuProfile(Sampler* sampler, void* raw_sampler_thread) {
2053 if (!sampler->isolate()->IsInitialized()) return; 2051 if (!sampler->isolate()->IsInitialized()) return;
2054 if (!sampler->IsProfiling()) return; 2052 if (!sampler->IsProfiling()) return;
2055 SamplerThread* sampler_thread = 2053 SamplerThread* sampler_thread =
2056 reinterpret_cast<SamplerThread*>(raw_sampler_thread); 2054 reinterpret_cast<SamplerThread*>(raw_sampler_thread);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2149 2147
2150 2148
2151 void Sampler::Stop() { 2149 void Sampler::Stop() {
2152 ASSERT(IsActive()); 2150 ASSERT(IsActive());
2153 SamplerThread::RemoveActiveSampler(this); 2151 SamplerThread::RemoveActiveSampler(this);
2154 SetActive(false); 2152 SetActive(false);
2155 } 2153 }
2156 2154
2157 2155
2158 } } // namespace v8::internal 2156 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-solaris.cc ('k') | src/runtime-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698