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

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

Issue 11231002: Perform CPU sampling by CPU sampling thread only iff processing thread is not running. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: fixed crash in tests due to absent sampler Created 8 years, 1 month 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
« 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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 } 691 }
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 = CpuProfiler::StartTickSampleEvent(sampler->isolate()); 702 TickSample* sample = CpuProfiler::StartTickSampleEvent(sampler->isolate());
702 if (sample == NULL) return; 703 if (sample == NULL) sample = &sample_obj;
703 704
704 static const DWORD kSuspendFailed = static_cast<DWORD>(-1); 705 static const DWORD kSuspendFailed = static_cast<DWORD>(-1);
705 if (SuspendThread(profiled_thread) == kSuspendFailed) return; 706 if (SuspendThread(profiled_thread) == kSuspendFailed) return;
706 sample->state = sampler->isolate()->current_vm_state(); 707 sample->state = sampler->isolate()->current_vm_state();
707 708
708 context.ContextFlags = CONTEXT_FULL; 709 context.ContextFlags = CONTEXT_FULL;
709 if (GetThreadContext(profiled_thread, &context) != 0) { 710 if (GetThreadContext(profiled_thread, &context) != 0) {
710 #if V8_HOST_ARCH_X64 711 #if V8_HOST_ARCH_X64
711 sample->pc = reinterpret_cast<Address>(context.Rip); 712 sample->pc = reinterpret_cast<Address>(context.Rip);
712 sample->sp = reinterpret_cast<Address>(context.Rsp); 713 sample->sp = reinterpret_cast<Address>(context.Rsp);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 } 787 }
787 788
788 789
789 void Sampler::Stop() { 790 void Sampler::Stop() {
790 ASSERT(IsActive()); 791 ASSERT(IsActive());
791 SamplerThread::RemoveActiveSampler(this); 792 SamplerThread::RemoveActiveSampler(this);
792 SetActive(false); 793 SetActive(false);
793 } 794 }
794 795
795 796
797 void Sampler::StartSampling() {
798 }
799
800
801 void Sampler::StopSampling() {
802 }
803
804
796 } } // namespace v8::internal 805 } } // 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