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 10871039: Replacing circular queue by single buffer in CPU Profiler. (Closed) Base URL: http://git.chromium.org/external/v8.git@profiling
Patch Set: an attempt to fix a test that strangely crashed only once Created 8 years, 3 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 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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 return; 662 return;
663 } 663 }
664 if (v8::Locker::IsActive() && 664 if (v8::Locker::IsActive() &&
665 !isolate->thread_manager()->IsLockedByCurrentThread()) { 665 !isolate->thread_manager()->IsLockedByCurrentThread()) {
666 return; 666 return;
667 } 667 }
668 668
669 Sampler* sampler = isolate->logger()->sampler(); 669 Sampler* sampler = isolate->logger()->sampler();
670 if (sampler == NULL || !sampler->IsActive()) return; 670 if (sampler == NULL || !sampler->IsActive()) return;
671 671
672 TickSample sample_obj; 672 TickSample* sample = CpuProfiler::StartTickSampleEvent(isolate);
673 TickSample* sample = CpuProfiler::TickSampleEvent(isolate); 673 if (sample == NULL) return;
674 if (sample == NULL) sample = &sample_obj;
675 674
676 // Extracting the sample from the context is extremely machine dependent. 675 // Extracting the sample from the context is extremely machine dependent.
677 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context); 676 ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
678 mcontext_t& mcontext = ucontext->uc_mcontext; 677 mcontext_t& mcontext = ucontext->uc_mcontext;
679 sample->state = isolate->current_vm_state(); 678 sample->state = isolate->current_vm_state();
680 679
681 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_PC]); 680 sample->pc = reinterpret_cast<Address>(mcontext.gregs[REG_PC]);
682 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_SP]); 681 sample->sp = reinterpret_cast<Address>(mcontext.gregs[REG_SP]);
683 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_FP]); 682 sample->fp = reinterpret_cast<Address>(mcontext.gregs[REG_FP]);
684 683
685 sampler->SampleStack(sample); 684 sampler->SampleStack(sample);
686 sampler->Tick(sample); 685 sampler->Tick(sample);
686 CpuProfiler::FinishTickSampleEvent(isolate);
687 } 687 }
688 688
689 class Sampler::PlatformData : public Malloced { 689 class Sampler::PlatformData : public Malloced {
690 public: 690 public:
691 PlatformData() : vm_tid_(GetThreadID()) {} 691 PlatformData() : vm_tid_(GetThreadID()) {}
692 692
693 pthread_t vm_tid() const { return vm_tid_; } 693 pthread_t vm_tid() const { return vm_tid_; }
694 694
695 private: 695 private:
696 pthread_t vm_tid_; 696 pthread_t vm_tid_;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 } 899 }
900 900
901 901
902 void Sampler::Stop() { 902 void Sampler::Stop() {
903 ASSERT(IsActive()); 903 ASSERT(IsActive());
904 SignalSender::RemoveActiveSampler(this); 904 SignalSender::RemoveActiveSampler(this);
905 SetActive(false); 905 SetActive(false);
906 } 906 }
907 907
908 } } // namespace v8::internal 908 } } // namespace v8::internal
OLDNEW
« src/cpu-profiler-inl.h ('K') | « src/platform-openbsd.cc ('k') | src/platform-win32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698