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

Side by Side Diff: src/platform-cygwin.cc

Issue 11428103: Revert "Perform CPU sampling by CPU sampling thread only iff processing thread is not running." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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.h ('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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 692
693 void SampleContext(Sampler* sampler) { 693 void SampleContext(Sampler* sampler) {
694 HANDLE profiled_thread = sampler->platform_data()->profiled_thread(); 694 HANDLE profiled_thread = sampler->platform_data()->profiled_thread();
695 if (profiled_thread == NULL) return; 695 if (profiled_thread == NULL) return;
696 696
697 // Context used for sampling the register state of the profiled thread. 697 // Context used for sampling the register state of the profiled thread.
698 CONTEXT context; 698 CONTEXT context;
699 memset(&context, 0, sizeof(context)); 699 memset(&context, 0, sizeof(context));
700 700
701 TickSample sample_obj; 701 TickSample sample_obj;
702 TickSample* sample = CpuProfiler::StartTickSampleEvent(sampler->isolate()); 702 TickSample* sample = CpuProfiler::TickSampleEvent(sampler->isolate());
703 if (sample == NULL) sample = &sample_obj; 703 if (sample == NULL) sample = &sample_obj;
704 704
705 static const DWORD kSuspendFailed = static_cast<DWORD>(-1); 705 static const DWORD kSuspendFailed = static_cast<DWORD>(-1);
706 if (SuspendThread(profiled_thread) == kSuspendFailed) return; 706 if (SuspendThread(profiled_thread) == kSuspendFailed) return;
707 sample->state = sampler->isolate()->current_vm_state(); 707 sample->state = sampler->isolate()->current_vm_state();
708 708
709 context.ContextFlags = CONTEXT_FULL; 709 context.ContextFlags = CONTEXT_FULL;
710 if (GetThreadContext(profiled_thread, &context) != 0) { 710 if (GetThreadContext(profiled_thread, &context) != 0) {
711 #if V8_HOST_ARCH_X64 711 #if V8_HOST_ARCH_X64
712 sample->pc = reinterpret_cast<Address>(context.Rip); 712 sample->pc = reinterpret_cast<Address>(context.Rip);
713 sample->sp = reinterpret_cast<Address>(context.Rsp); 713 sample->sp = reinterpret_cast<Address>(context.Rsp);
714 sample->fp = reinterpret_cast<Address>(context.Rbp); 714 sample->fp = reinterpret_cast<Address>(context.Rbp);
715 #else 715 #else
716 sample->pc = reinterpret_cast<Address>(context.Eip); 716 sample->pc = reinterpret_cast<Address>(context.Eip);
717 sample->sp = reinterpret_cast<Address>(context.Esp); 717 sample->sp = reinterpret_cast<Address>(context.Esp);
718 sample->fp = reinterpret_cast<Address>(context.Ebp); 718 sample->fp = reinterpret_cast<Address>(context.Ebp);
719 #endif 719 #endif
720 sampler->SampleStack(sample); 720 sampler->SampleStack(sample);
721 sampler->Tick(sample); 721 sampler->Tick(sample);
722 } 722 }
723 CpuProfiler::FinishTickSampleEvent(sampler->isolate());
724 ResumeThread(profiled_thread); 723 ResumeThread(profiled_thread);
725 } 724 }
726 725
727 const int interval_; 726 const int interval_;
728 RuntimeProfilerRateLimiter rate_limiter_; 727 RuntimeProfilerRateLimiter rate_limiter_;
729 728
730 // Protects the process wide state below. 729 // Protects the process wide state below.
731 static Mutex* mutex_; 730 static Mutex* mutex_;
732 static SamplerThread* instance_; 731 static SamplerThread* instance_;
733 732
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 data_ = new PlatformData; 767 data_ = new PlatformData;
769 } 768 }
770 769
771 770
772 Sampler::~Sampler() { 771 Sampler::~Sampler() {
773 ASSERT(!IsActive()); 772 ASSERT(!IsActive());
774 delete data_; 773 delete data_;
775 } 774 }
776 775
777 776
778 void Sampler::DoSample() {
779 // TODO(rogulenko): implement
780 }
781
782
783 void Sampler::Start() { 777 void Sampler::Start() {
784 ASSERT(!IsActive()); 778 ASSERT(!IsActive());
785 SetActive(true); 779 SetActive(true);
786 SamplerThread::AddActiveSampler(this); 780 SamplerThread::AddActiveSampler(this);
787 } 781 }
788 782
789 783
790 void Sampler::Stop() { 784 void Sampler::Stop() {
791 ASSERT(IsActive()); 785 ASSERT(IsActive());
792 SamplerThread::RemoveActiveSampler(this); 786 SamplerThread::RemoveActiveSampler(this);
793 SetActive(false); 787 SetActive(false);
794 } 788 }
795 789
796 790
797 void Sampler::StartSampling() {
798 }
799
800
801 void Sampler::StopSampling() {
802 }
803
804
805 } } // namespace v8::internal 791 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform.h ('k') | src/platform-freebsd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698