OLD | NEW |
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 8402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8413 int64_t CpuProfile::GetEndTime() const { | 8413 int64_t CpuProfile::GetEndTime() const { |
8414 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); | 8414 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); |
8415 return (profile->end_time() - base::TimeTicks()).InMicroseconds(); | 8415 return (profile->end_time() - base::TimeTicks()).InMicroseconds(); |
8416 } | 8416 } |
8417 | 8417 |
8418 | 8418 |
8419 int CpuProfile::GetSamplesCount() const { | 8419 int CpuProfile::GetSamplesCount() const { |
8420 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count(); | 8420 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count(); |
8421 } | 8421 } |
8422 | 8422 |
| 8423 CpuProfiler* CpuProfiler::New(Isolate* isolate) { |
| 8424 return reinterpret_cast<CpuProfiler*>( |
| 8425 new i::CpuProfiler(reinterpret_cast<i::Isolate*>(isolate))); |
| 8426 } |
| 8427 |
| 8428 void CpuProfiler::Dispose() { delete reinterpret_cast<i::CpuProfiler*>(this); } |
8423 | 8429 |
8424 void CpuProfiler::SetSamplingInterval(int us) { | 8430 void CpuProfiler::SetSamplingInterval(int us) { |
8425 DCHECK_GE(us, 0); | 8431 DCHECK_GE(us, 0); |
8426 return reinterpret_cast<i::CpuProfiler*>(this)->set_sampling_interval( | 8432 return reinterpret_cast<i::CpuProfiler*>(this)->set_sampling_interval( |
8427 base::TimeDelta::FromMicroseconds(us)); | 8433 base::TimeDelta::FromMicroseconds(us)); |
8428 } | 8434 } |
8429 | 8435 |
8430 void CpuProfiler::CollectSample() { | 8436 void CpuProfiler::CollectSample() { |
8431 reinterpret_cast<i::CpuProfiler*>(this)->CollectSample(); | 8437 reinterpret_cast<i::CpuProfiler*>(this)->CollectSample(); |
8432 } | 8438 } |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8937 Address callback_address = | 8943 Address callback_address = |
8938 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8944 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
8939 VMState<EXTERNAL> state(isolate); | 8945 VMState<EXTERNAL> state(isolate); |
8940 ExternalCallbackScope call_scope(isolate, callback_address); | 8946 ExternalCallbackScope call_scope(isolate, callback_address); |
8941 callback(info); | 8947 callback(info); |
8942 } | 8948 } |
8943 | 8949 |
8944 | 8950 |
8945 } // namespace internal | 8951 } // namespace internal |
8946 } // namespace v8 | 8952 } // namespace v8 |
OLD | NEW |