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

Side by Side Diff: src/platform-cygwin.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/isolate.cc ('k') | src/platform-freebsd.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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 instance_->StartSynchronously(); 643 instance_->StartSynchronously();
644 } else { 644 } else {
645 ASSERT(instance_->interval_ == sampler->interval()); 645 ASSERT(instance_->interval_ == sampler->interval());
646 } 646 }
647 } 647 }
648 648
649 static void RemoveActiveSampler(Sampler* sampler) { 649 static void RemoveActiveSampler(Sampler* sampler) {
650 ScopedLock lock(mutex_); 650 ScopedLock lock(mutex_);
651 SamplerRegistry::RemoveActiveSampler(sampler); 651 SamplerRegistry::RemoveActiveSampler(sampler);
652 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) { 652 if (SamplerRegistry::GetState() == SamplerRegistry::HAS_NO_SAMPLERS) {
653 RuntimeProfiler::StopRuntimeProfilerThreadBeforeShutdown(instance_); 653 instance_->Join();
654 delete instance_; 654 delete instance_;
655 instance_ = NULL; 655 instance_ = NULL;
656 } 656 }
657 } 657 }
658 658
659 // Implement Thread::Run(). 659 // Implement Thread::Run().
660 virtual void Run() { 660 virtual void Run() {
661 SamplerRegistry::State state; 661 SamplerRegistry::State state;
662 while ((state = SamplerRegistry::GetState()) != 662 while ((state = SamplerRegistry::GetState()) !=
663 SamplerRegistry::HAS_NO_SAMPLERS) { 663 SamplerRegistry::HAS_NO_SAMPLERS) {
664 // When CPU profiling is enabled both JavaScript and C++ code is 664 // When CPU profiling is enabled both JavaScript and C++ code is
665 // profiled. We must not suspend. 665 // profiled. We must not suspend.
666 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) { 666 if (state == SamplerRegistry::HAS_CPU_PROFILING_SAMPLERS) {
667 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this); 667 SamplerRegistry::IterateActiveSamplers(&DoCpuProfile, this);
668 } else {
669 if (RuntimeProfiler::WaitForSomeIsolateToEnterJS()) continue;
670 } 668 }
671 OS::Sleep(interval_); 669 OS::Sleep(interval_);
672 } 670 }
673 } 671 }
674 672
675 static void DoCpuProfile(Sampler* sampler, void* raw_sampler_thread) { 673 static void DoCpuProfile(Sampler* sampler, void* raw_sampler_thread) {
676 if (!sampler->isolate()->IsInitialized()) return; 674 if (!sampler->isolate()->IsInitialized()) return;
677 if (!sampler->IsProfiling()) return; 675 if (!sampler->IsProfiling()) return;
678 SamplerThread* sampler_thread = 676 SamplerThread* sampler_thread =
679 reinterpret_cast<SamplerThread*>(raw_sampler_thread); 677 reinterpret_cast<SamplerThread*>(raw_sampler_thread);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 770
773 771
774 void Sampler::Stop() { 772 void Sampler::Stop() {
775 ASSERT(IsActive()); 773 ASSERT(IsActive());
776 SamplerThread::RemoveActiveSampler(this); 774 SamplerThread::RemoveActiveSampler(this);
777 SetActive(false); 775 SetActive(false);
778 } 776 }
779 777
780 778
781 } } // namespace v8::internal 779 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698