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

Side by Side Diff: src/platform-solaris.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-openbsd.cc ('k') | src/platform-win32.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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } 665 }
666 if (v8::Locker::IsActive() && 666 if (v8::Locker::IsActive() &&
667 !isolate->thread_manager()->IsLockedByCurrentThread()) { 667 !isolate->thread_manager()->IsLockedByCurrentThread()) {
668 return; 668 return;
669 } 669 }
670 670
671 Sampler* sampler = isolate->logger()->sampler(); 671 Sampler* sampler = isolate->logger()->sampler();
672 if (sampler == NULL || !sampler->IsActive()) return; 672 if (sampler == NULL || !sampler->IsActive()) return;
673 673
674 TickSample sample_obj; 674 TickSample sample_obj;
675 TickSample* sample = CpuProfiler::StartTickSampleEvent(isolate); 675 TickSample* sample = CpuProfiler::TickSampleEvent(isolate);
676 if (sample == NULL) sample = &sample_obj; 676 if (sample == NULL) sample = &sample_obj;
677 677
678 // Extracting the sample from the context is extremely machine dependent. 678 // Extracting the sample from the context is extremely machine dependent.
679 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); 679 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
680 mcontext_t& mcontext = ucontext->uc_mcontext; 680 mcontext_t& mcontext = ucontext->uc_mcontext;
681 sample->state = isolate->current_vm_state(); 681 sample->state = isolate->current_vm_state();
682 682
683 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_PC]); 683 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_PC]);
684 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_SP]); 684 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_SP]);
685 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_FP]); 685 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_FP]);
686 686
687 sampler->SampleStack(sample); 687 sampler->SampleStack(sample);
688 sampler->Tick(sample); 688 sampler->Tick(sample);
689 CpuProfiler::FinishTickSampleEvent(isolate);
690 } 689 }
691 690
692 class Sampler::PlatformData : public Malloced { 691 class Sampler::PlatformData : public Malloced {
693 public: 692 public:
694 PlatformData() : vm_tid_(GetThreadID()) {} 693 PlatformData() : vm_tid_(GetThreadID()) {}
695 694
696 pthread_t vm_tid() const { return vm_tid_; } 695 pthread_t vm_tid() const { return vm_tid_; }
697 696
698 private: 697 private:
699 pthread_t vm_tid_; 698 pthread_t vm_tid_;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 data_ = new PlatformData; 882 data_ = new PlatformData;
884 } 883 }
885 884
886 885
887 Sampler::~Sampler() { 886 Sampler::~Sampler() {
888 ASSERT(!IsActive()); 887 ASSERT(!IsActive());
889 delete data_; 888 delete data_;
890 } 889 }
891 890
892 891
893 void Sampler::DoSample() {
894 // TODO(rogulenko): implement
895 }
896
897
898 void Sampler::Start() { 892 void Sampler::Start() {
899 ASSERT(!IsActive()); 893 ASSERT(!IsActive());
900 SetActive(true); 894 SetActive(true);
901 SignalSender::AddActiveSampler(this); 895 SignalSender::AddActiveSampler(this);
902 } 896 }
903 897
904 898
905 void Sampler::Stop() { 899 void Sampler::Stop() {
906 ASSERT(IsActive()); 900 ASSERT(IsActive());
907 SignalSender::RemoveActiveSampler(this); 901 SignalSender::RemoveActiveSampler(this);
908 SetActive(false); 902 SetActive(false);
909 } 903 }
910 904
911
912 void Sampler::StartSampling() {
913 }
914
915
916 void Sampler::StopSampling() {
917 }
918
919
920 } } // namespace v8::internal 905 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-openbsd.cc ('k') | src/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698