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

Side by Side Diff: src/platform-linux.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-freebsd.cc ('k') | src/platform-macos.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 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 instance_->StartSynchronously(); 1187 instance_->StartSynchronously();
1188 } else { 1188 } else {
1189 ASSERT(instance_->interval_ == sampler->interval()); 1189 ASSERT(instance_->interval_ == sampler->interval());
1190 } 1190 }
1191 } 1191 }
1192 1192
1193 static void RemoveActiveSampler(Sampler* sampler) { 1193 static void RemoveActiveSampler(Sampler* sampler) {
1194 ScopedLock lock(mutex_); 1194 ScopedLock lock(mutex_);
1195 SamplerRegistry::RemoveActiveSampler(sampler); 1195 SamplerRegistry::RemoveActiveSampler(sampler);
1196 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { 1196 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) {
1197 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_); 1197 instance_->Join();
1198 delete instance_; 1198 delete instance_;
1199 instance_ = NULL; 1199 instance_ = NULL;
1200 RestoreSignalHandler(); 1200 RestoreSignalHandler();
1201 } 1201 }
1202 } 1202 }
1203 1203
1204 // Implement Thread::Run(). 1204 // Implement Thread::Run().
1205 virtual void Run() { 1205 virtual void Run() {
1206 SamplerRegistry::State state; 1206 SamplerRegistry::State state;
1207 while ((state = SamplerRegistry::GetState()) != 1207 while ((state = SamplerRegistry::GetState()) !=
1208 SamplerRegistry::HAS_NO_SAMPLERS) { 1208 SamplerRegistry::HAS_NO_SAMPLERS) {
1209 // When CPU profiling is enabled both JavaScript and C++ code is 1209 // When CPU profiling is enabled both JavaScript and C++ code is
1210 // profiled. We must not suspend. 1210 // profiled. We must not suspend.
1211 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) { 1211 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) {
1212 if (!signal_handler_installed_) InstallSignalHandler(); 1212 if (!signal_handler_installed_) InstallSignalHandler();
1213 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this); 1213 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this);
1214 } else { 1214 } else {
1215 if (signal_handler_installed_) RestoreSignalHandler(); 1215 if (signal_handler_installed_) RestoreSignalHandler();
1216 if (RuntimeProfiler::WaitForSomeIsolateToEnterJS()) continue;
1217 } 1216 }
1218 Sleep(); // TODO(svenpanne) Figure out if OS:Sleep(interval_) is enough. 1217 Sleep(); // TODO(svenpanne) Figure out if OS:Sleep(interval_) is enough.
1219 } 1218 }
1220 } 1219 }
1221 1220
1222 static void DoCpuProfile(Sampler* sampler, void* raw_sender) { 1221 static void DoCpuProfile(Sampler* sampler, void* raw_sender) {
1223 if (!sampler->IsProfiling()) return; 1222 if (!sampler->IsProfiling()) return;
1224 SignalSender* sender = reinterpret_cast<SignalSender*>(raw_sender); 1223 SignalSender* sender = reinterpret_cast<SignalSender*>(raw_sender);
1225 sender->SendProfilingSignal(sampler->platform_data()->vm_tid()); 1224 sender->SendProfilingSignal(sampler->platform_data()->vm_tid());
1226 } 1225 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 1335
1337 1336
1338 void Sampler::Stop() { 1337 void Sampler::Stop() {
1339 ASSERT(IsActive()); 1338 ASSERT(IsActive());
1340 SignalSender::RemoveActiveSampler(this); 1339 SignalSender::RemoveActiveSampler(this);
1341 SetActive(false); 1340 SetActive(false);
1342 } 1341 }
1343 1342
1344 1343
1345 } } // namespace v8::internal 1344 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-freebsd.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698