OLD | NEW |
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 7187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7198 | 7198 |
7199 | 7199 |
7200 void CpuProfile::Delete() { | 7200 void CpuProfile::Delete() { |
7201 i::Isolate* isolate = i::Isolate::Current(); | 7201 i::Isolate* isolate = i::Isolate::Current(); |
7202 i::CpuProfiler* profiler = isolate->cpu_profiler(); | 7202 i::CpuProfiler* profiler = isolate->cpu_profiler(); |
7203 ASSERT(profiler != NULL); | 7203 ASSERT(profiler != NULL); |
7204 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); | 7204 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); |
7205 } | 7205 } |
7206 | 7206 |
7207 | 7207 |
7208 unsigned CpuProfile::GetUid() const { | |
7209 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); | |
7210 } | |
7211 | |
7212 | |
7213 Handle<String> CpuProfile::GetTitle() const { | 7208 Handle<String> CpuProfile::GetTitle() const { |
7214 i::Isolate* isolate = i::Isolate::Current(); | 7209 i::Isolate* isolate = i::Isolate::Current(); |
7215 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); | 7210 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); |
7216 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( | 7211 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( |
7217 profile->title())); | 7212 profile->title())); |
7218 } | 7213 } |
7219 | 7214 |
7220 | 7215 |
7221 const CpuProfileNode* CpuProfile::GetTopDownRoot() const { | 7216 const CpuProfileNode* CpuProfile::GetTopDownRoot() const { |
7222 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); | 7217 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); |
(...skipping 17 matching lines...) Expand all Loading... |
7240 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); | 7235 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); |
7241 return (profile->end_time() - i::Time::UnixEpoch()).InMicroseconds(); | 7236 return (profile->end_time() - i::Time::UnixEpoch()).InMicroseconds(); |
7242 } | 7237 } |
7243 | 7238 |
7244 | 7239 |
7245 int CpuProfile::GetSamplesCount() const { | 7240 int CpuProfile::GetSamplesCount() const { |
7246 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count(); | 7241 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count(); |
7247 } | 7242 } |
7248 | 7243 |
7249 | 7244 |
7250 int CpuProfiler::GetProfileCount() { | |
7251 return reinterpret_cast<i::CpuProfiler*>(this)->GetProfilesCount(); | |
7252 } | |
7253 | |
7254 | |
7255 void CpuProfiler::SetSamplingInterval(int us) { | 7245 void CpuProfiler::SetSamplingInterval(int us) { |
7256 ASSERT(us >= 0); | 7246 ASSERT(us >= 0); |
7257 return reinterpret_cast<i::CpuProfiler*>(this)->set_sampling_interval( | 7247 return reinterpret_cast<i::CpuProfiler*>(this)->set_sampling_interval( |
7258 i::TimeDelta::FromMicroseconds(us)); | 7248 i::TimeDelta::FromMicroseconds(us)); |
7259 } | 7249 } |
7260 | 7250 |
7261 | 7251 |
7262 const CpuProfile* CpuProfiler::GetCpuProfile(int index) { | |
7263 return reinterpret_cast<const CpuProfile*>( | |
7264 reinterpret_cast<i::CpuProfiler*>(this)->GetProfile(index)); | |
7265 } | |
7266 | |
7267 | |
7268 void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) { | 7252 void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) { |
7269 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling( | 7253 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling( |
7270 *Utils::OpenHandle(*title), record_samples); | 7254 *Utils::OpenHandle(*title), record_samples); |
7271 } | 7255 } |
7272 | 7256 |
7273 | 7257 |
7274 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) { | 7258 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title) { |
7275 return reinterpret_cast<const CpuProfile*>( | 7259 return reinterpret_cast<const CpuProfile*>( |
7276 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( | 7260 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( |
7277 *Utils::OpenHandle(*title))); | 7261 *Utils::OpenHandle(*title))); |
7278 } | 7262 } |
7279 | 7263 |
7280 | 7264 |
7281 void CpuProfiler::DeleteAllCpuProfiles() { | |
7282 reinterpret_cast<i::CpuProfiler*>(this)->DeleteAllProfiles(); | |
7283 } | |
7284 | |
7285 | |
7286 void CpuProfiler::SetIdle(bool is_idle) { | 7265 void CpuProfiler::SetIdle(bool is_idle) { |
7287 i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate(); | 7266 i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate(); |
7288 i::StateTag state = isolate->current_vm_state(); | 7267 i::StateTag state = isolate->current_vm_state(); |
7289 ASSERT(state == i::EXTERNAL || state == i::IDLE); | 7268 ASSERT(state == i::EXTERNAL || state == i::IDLE); |
7290 if (isolate->js_entry_sp() != NULL) return; | 7269 if (isolate->js_entry_sp() != NULL) return; |
7291 if (is_idle) { | 7270 if (is_idle) { |
7292 isolate->set_current_vm_state(i::IDLE); | 7271 isolate->set_current_vm_state(i::IDLE); |
7293 } else if (state == i::IDLE) { | 7272 } else if (state == i::IDLE) { |
7294 isolate->set_current_vm_state(i::EXTERNAL); | 7273 isolate->set_current_vm_state(i::EXTERNAL); |
7295 } | 7274 } |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7771 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7750 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7772 Address callback_address = | 7751 Address callback_address = |
7773 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7752 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7774 VMState<EXTERNAL> state(isolate); | 7753 VMState<EXTERNAL> state(isolate); |
7775 ExternalCallbackScope call_scope(isolate, callback_address); | 7754 ExternalCallbackScope call_scope(isolate, callback_address); |
7776 callback(info); | 7755 callback(info); |
7777 } | 7756 } |
7778 | 7757 |
7779 | 7758 |
7780 } } // namespace v8::internal | 7759 } } // namespace v8::internal |
OLD | NEW |