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

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: 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-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 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 } 2037 }
2038 2038
2039 void SampleContext(Sampler* sampler) { 2039 void SampleContext(Sampler* sampler) {
2040 HANDLE profiled_thread = sampler->platform_data()->profiled_thread(); 2040 HANDLE profiled_thread = sampler->platform_data()->profiled_thread();
2041 if (profiled_thread == NULL) return; 2041 if (profiled_thread == NULL) return;
2042 2042
2043 // Context used for sampling the register state of the profiled thread. 2043 // Context used for sampling the register state of the profiled thread.
2044 CONTEXT context; 2044 CONTEXT context;
2045 memset(&context, 0, sizeof(context)); 2045 memset(&context, 0, sizeof(context));
2046 2046
2047 TickSample sample_obj;
2047 TickSample* sample = CpuProfiler::StartTickSampleEvent(sampler->isolate()); 2048 TickSample* sample = CpuProfiler::StartTickSampleEvent(sampler->isolate());
2048 if (sample == NULL) return; 2049 if (sample == NULL) sample = &sample_obj;
2049 2050
2050 static const DWORD kSuspendFailed = static_cast<DWORD>(-1); 2051 static const DWORD kSuspendFailed = static_cast<DWORD>(-1);
2051 if (SuspendThread(profiled_thread) == kSuspendFailed) return; 2052 if (SuspendThread(profiled_thread) == kSuspendFailed) return;
2052 sample->state = sampler->isolate()->current_vm_state(); 2053 sample->state = sampler->isolate()->current_vm_state();
2053 2054
2054 context.ContextFlags = CONTEXT_FULL; 2055 context.ContextFlags = CONTEXT_FULL;
2055 if (GetThreadContext(profiled_thread, &context) != 0) { 2056 if (GetThreadContext(profiled_thread, &context) != 0) {
2056 #if V8_HOST_ARCH_X64 2057 #if V8_HOST_ARCH_X64
2057 sample->pc = reinterpret_cast<Address>(context.Rip); 2058 sample->pc = reinterpret_cast<Address>(context.Rip);
2058 sample->sp = reinterpret_cast<Address>(context.Rsp); 2059 sample->sp = reinterpret_cast<Address>(context.Rsp);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2132 } 2133 }
2133 2134
2134 2135
2135 void Sampler::Stop() { 2136 void Sampler::Stop() {
2136 ASSERT(IsActive()); 2137 ASSERT(IsActive());
2137 SamplerThread::RemoveActiveSampler(this); 2138 SamplerThread::RemoveActiveSampler(this);
2138 SetActive(false); 2139 SetActive(false);
2139 } 2140 }
2140 2141
2141 2142
2143 void Sampler::StartSampling() {
2144 }
2145
2146
2147 void Sampler::StopSampling() {
2148 }
2149
2150
2142 } } // namespace v8::internal 2151 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/platform-solaris.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698