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

Side by Side Diff: src/platform-win32.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: Created 8 years, 2 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
« src/platform-cygwin.cc ('K') | « src/platform-solaris.cc ('k') | no next file » | 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 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 } 2031 }
2032 2032
2033 void SampleContext(Sampler* sampler) { 2033 void SampleContext(Sampler* sampler) {
2034 HANDLE profiled_thread = sampler->platform_data()->profiled_thread(); 2034 HANDLE profiled_thread = sampler->platform_data()->profiled_thread();
2035 if (profiled_thread == NULL) return; 2035 if (profiled_thread == NULL) return;
2036 2036
2037 // Context used for sampling the register state of the profiled thread. 2037 // Context used for sampling the register state of the profiled thread.
2038 CONTEXT context; 2038 CONTEXT context;
2039 memset(&context, 0, sizeof(context)); 2039 memset(&context, 0, sizeof(context));
2040 2040
2041 TickSample* sample = CpuProfiler::StartTickSampleEvent(sampler->isolate()); 2041 TickSample sample_obj;
2042 if (sample == NULL) return; 2042 TickSample* sample = CpuProfiler::StartTickSampleEvent(isolate);
2043 if (sample == NULL) sample = &sample_obj;
2043 2044
2044 static const DWORD kSuspendFailed = static_cast<DWORD>(-1); 2045 static const DWORD kSuspendFailed = static_cast<DWORD>(-1);
2045 if (SuspendThread(profiled_thread) == kSuspendFailed) return; 2046 if (SuspendThread(profiled_thread) == kSuspendFailed) return;
2046 sample->state = sampler->isolate()->current_vm_state(); 2047 sample->state = sampler->isolate()->current_vm_state();
2047 2048
2048 context.ContextFlags = CONTEXT_FULL; 2049 context.ContextFlags = CONTEXT_FULL;
2049 if (GetThreadContext(profiled_thread, &context) != 0) { 2050 if (GetThreadContext(profiled_thread, &context) != 0) {
2050 #if V8_HOST_ARCH_X64 2051 #if V8_HOST_ARCH_X64
2051 sample->pc = reinterpret_cast<Address>(context.Rip); 2052 sample->pc = reinterpret_cast<Address>(context.Rip);
2052 sample->sp = reinterpret_cast<Address>(context.Rsp); 2053 sample->sp = reinterpret_cast<Address>(context.Rsp);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 } 2127 }
2127 2128
2128 2129
2129 void Sampler::Stop() { 2130 void Sampler::Stop() {
2130 ASSERT(IsActive()); 2131 ASSERT(IsActive());
2131 SamplerThread::RemoveActiveSampler(this); 2132 SamplerThread::RemoveActiveSampler(this);
2132 SetActive(false); 2133 SetActive(false);
2133 } 2134 }
2134 2135
2135 2136
2137 void Sampler::StartSampling() {
2138 }
2139
2140
2141 void Sampler::StopSampling() {
2142 }
2143
2144
2136 } } // namespace v8::internal 2145 } } // namespace v8::internal
OLDNEW
« src/platform-cygwin.cc ('K') | « src/platform-solaris.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698