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

Side by Side Diff: src/api.cc

Issue 1631043002: Add CollectSample API function to CpuProfiler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix tests. Created 4 years, 10 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
« no previous file with comments | « include/v8-profiler.h ('k') | src/profiler/cpu-profiler.h » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 8031 matching lines...) Expand 10 before | Expand all | Expand 10 after
8042 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count(); 8042 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count();
8043 } 8043 }
8044 8044
8045 8045
8046 void CpuProfiler::SetSamplingInterval(int us) { 8046 void CpuProfiler::SetSamplingInterval(int us) {
8047 DCHECK_GE(us, 0); 8047 DCHECK_GE(us, 0);
8048 return reinterpret_cast<i::CpuProfiler*>(this)->set_sampling_interval( 8048 return reinterpret_cast<i::CpuProfiler*>(this)->set_sampling_interval(
8049 base::TimeDelta::FromMicroseconds(us)); 8049 base::TimeDelta::FromMicroseconds(us));
8050 } 8050 }
8051 8051
8052 void CpuProfiler::CollectSample() {
8053 reinterpret_cast<i::CpuProfiler*>(this)->CollectSample();
8054 }
8052 8055
8053 void CpuProfiler::StartProfiling(Local<String> title, bool record_samples) { 8056 void CpuProfiler::StartProfiling(Local<String> title, bool record_samples) {
8054 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling( 8057 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling(
8055 *Utils::OpenHandle(*title), record_samples); 8058 *Utils::OpenHandle(*title), record_samples);
8056 } 8059 }
8057 8060
8058 8061
8059 CpuProfile* CpuProfiler::StopProfiling(Local<String> title) { 8062 CpuProfile* CpuProfiler::StopProfiling(Local<String> title) {
8060 return reinterpret_cast<CpuProfile*>( 8063 return reinterpret_cast<CpuProfile*>(
8061 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( 8064 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling(
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
8550 Address callback_address = 8553 Address callback_address =
8551 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8554 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8552 VMState<EXTERNAL> state(isolate); 8555 VMState<EXTERNAL> state(isolate);
8553 ExternalCallbackScope call_scope(isolate, callback_address); 8556 ExternalCallbackScope call_scope(isolate, callback_address);
8554 callback(info); 8557 callback(info);
8555 } 8558 }
8556 8559
8557 8560
8558 } // namespace internal 8561 } // namespace internal
8559 } // namespace v8 8562 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8-profiler.h ('k') | src/profiler/cpu-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698