| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 v8::Local<v8::Value> argv[], int argc, | 415 v8::Local<v8::Value> argv[], int argc, |
| 416 unsigned min_js_samples = 0, | 416 unsigned min_js_samples = 0, |
| 417 unsigned min_external_samples = 0, | 417 unsigned min_external_samples = 0, |
| 418 bool collect_samples = false) { | 418 bool collect_samples = false) { |
| 419 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); | 419 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); |
| 420 v8::Local<v8::String> profile_name = v8_str("my_profile"); | 420 v8::Local<v8::String> profile_name = v8_str("my_profile"); |
| 421 | 421 |
| 422 cpu_profiler->SetSamplingInterval(100); | 422 cpu_profiler->SetSamplingInterval(100); |
| 423 cpu_profiler->StartProfiling(profile_name, collect_samples); | 423 cpu_profiler->StartProfiling(profile_name, collect_samples); |
| 424 | 424 |
| 425 v8::sampler::Sampler* sampler = | 425 i::Sampler* sampler = |
| 426 reinterpret_cast<i::Isolate*>(env->GetIsolate())->logger()->sampler(); | 426 reinterpret_cast<i::Isolate*>(env->GetIsolate())->logger()->sampler(); |
| 427 sampler->StartCountingSamples(); | 427 sampler->StartCountingSamples(); |
| 428 do { | 428 do { |
| 429 function->Call(env, env->Global(), argc, argv).ToLocalChecked(); | 429 function->Call(env, env->Global(), argc, argv).ToLocalChecked(); |
| 430 } while (sampler->js_sample_count() < min_js_samples || | 430 } while (sampler->js_sample_count() < min_js_samples || |
| 431 sampler->external_sample_count() < min_external_samples); | 431 sampler->external_sample_count() < min_external_samples); |
| 432 | 432 |
| 433 v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name); | 433 v8::CpuProfile* profile = cpu_profiler->StopProfiling(profile_name); |
| 434 | 434 |
| 435 CHECK(profile); | 435 CHECK(profile); |
| (...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 iprofile->Print(); | 2023 iprofile->Print(); |
| 2024 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); | 2024 v8::CpuProfile* profile = reinterpret_cast<v8::CpuProfile*>(iprofile); |
| 2025 | 2025 |
| 2026 const char* branch[] = {"", "test"}; | 2026 const char* branch[] = {"", "test"}; |
| 2027 const ProfileNode* itest_node = | 2027 const ProfileNode* itest_node = |
| 2028 GetSimpleBranch(env, profile, branch, arraysize(branch)); | 2028 GetSimpleBranch(env, profile, branch, arraysize(branch)); |
| 2029 CHECK_EQ(0U, itest_node->deopt_infos().size()); | 2029 CHECK_EQ(0U, itest_node->deopt_infos().size()); |
| 2030 | 2030 |
| 2031 iprofiler->DeleteProfile(iprofile); | 2031 iprofiler->DeleteProfile(iprofile); |
| 2032 } | 2032 } |
| OLD | NEW |