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

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

Issue 1635005: Allow new CPU profiling subsystem to coexist nicely with the old one. (Closed)
Patch Set: Fix TickSampleEvent Created 10 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 return false; 720 return false;
721 } 721 }
722 722
723 723
724 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) { 724 static void ProfilerSignalHandler(int signal, siginfo_t* info, void* context) {
725 #ifndef V8_HOST_ARCH_MIPS 725 #ifndef V8_HOST_ARCH_MIPS
726 USE(info); 726 USE(info);
727 if (signal != SIGPROF) return; 727 if (signal != SIGPROF) return;
728 if (active_sampler_ == NULL) return; 728 if (active_sampler_ == NULL) return;
729 729
730 TickSample sample_obj;
731 TickSample* sample = NULL;
730 #ifdef ENABLE_CPP_PROFILES_PROCESSOR 732 #ifdef ENABLE_CPP_PROFILES_PROCESSOR
731 TickSample* sample = CpuProfiler::TickSampleEvent(); 733 sample = CpuProfiler::TickSampleEvent();
732 if (sample == NULL) return;
733 sample->pc = NULL; // Impossible value if sampling succeeds.
734 sample->frames_count = 0;
735 #else
736 TickSample sample_obj;
737 TickSample* sample = &sample_obj;
738 #endif 734 #endif
735 if (sample == NULL) sample = &sample_obj;
739 736
740 // We always sample the VM state. 737 // We always sample the VM state.
741 sample->state = VMState::current_state(); 738 sample->state = VMState::current_state();
742 // If profiling, we extract the current pc and sp. 739 // If profiling, we extract the current pc and sp.
743 if (active_sampler_->IsProfiling()) { 740 if (active_sampler_->IsProfiling()) {
744 // Extracting the sample from the context is extremely machine dependent. 741 // Extracting the sample from the context is extremely machine dependent.
745 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); 742 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
746 mcontext_t& mcontext = ucontext->uc_mcontext; 743 mcontext_t& mcontext = ucontext->uc_mcontext;
747 #if V8_HOST_ARCH_IA32 744 #if V8_HOST_ARCH_IA32
748 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]); 745 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_EIP]);
(...skipping 15 matching lines...) Expand all
764 sample->fp = reinterpret_cast<Address>(mcontext.arm_fp); 761 sample->fp = reinterpret_cast<Address>(mcontext.arm_fp);
765 #endif 762 #endif
766 #elif V8_HOST_ARCH_MIPS 763 #elif V8_HOST_ARCH_MIPS
767 // Implement this on MIPS. 764 // Implement this on MIPS.
768 UNIMPLEMENTED(); 765 UNIMPLEMENTED();
769 #endif 766 #endif
770 if (IsVmThread()) { 767 if (IsVmThread()) {
771 active_sampler_->SampleStack(sample); 768 active_sampler_->SampleStack(sample);
772 } 769 }
773 } 770 }
774 #ifndef ENABLE_CPP_PROFILES_PROCESSOR 771
775 active_sampler_->Tick(sample); 772 active_sampler_->Tick(sample);
776 #endif 773 #endif
777 #endif
778 } 774 }
779 775
780 776
781 class Sampler::PlatformData : public Malloced { 777 class Sampler::PlatformData : public Malloced {
782 public: 778 public:
783 PlatformData() { 779 PlatformData() {
784 signal_handler_installed_ = false; 780 signal_handler_installed_ = false;
785 } 781 }
786 782
787 bool signal_handler_installed_; 783 bool signal_handler_installed_;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 836
841 // This sampler is no longer the active sampler. 837 // This sampler is no longer the active sampler.
842 active_sampler_ = NULL; 838 active_sampler_ = NULL;
843 active_ = false; 839 active_ = false;
844 } 840 }
845 841
846 842
847 #endif // ENABLE_LOGGING_AND_PROFILING 843 #endif // ENABLE_LOGGING_AND_PROFILING
848 844
849 } } // namespace v8::internal 845 } } // namespace v8::internal
OLDNEW
« src/cpu-profiler-inl.h ('K') | « src/log.cc ('k') | src/platform-macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698