diff options
Diffstat (limited to 'deps/v8/test/cctest/test-cpu-profiler.cc')
-rw-r--r-- | deps/v8/test/cctest/test-cpu-profiler.cc | 104 |
1 files changed, 53 insertions, 51 deletions
diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc index 04d7ecb4f..0bf80003f 100644 --- a/deps/v8/test/cctest/test-cpu-profiler.cc +++ b/deps/v8/test/cctest/test-cpu-profiler.cc @@ -300,100 +300,102 @@ TEST(DeleteAllCpuProfiles) { TEST(DeleteCpuProfile) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); + v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); - CHECK_EQ(0, v8::CpuProfiler::GetProfilesCount()); + CHECK_EQ(0, cpu_profiler->GetProfileCount()); v8::Local<v8::String> name1 = v8::String::New("1"); - v8::CpuProfiler::StartProfiling(name1); - const v8::CpuProfile* p1 = v8::CpuProfiler::StopProfiling(name1); + cpu_profiler->StartCpuProfiling(name1); + const v8::CpuProfile* p1 = cpu_profiler->StopCpuProfiling(name1); CHECK_NE(NULL, p1); - CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); + CHECK_EQ(1, cpu_profiler->GetProfileCount()); unsigned uid1 = p1->GetUid(); - CHECK_EQ(p1, v8::CpuProfiler::FindProfile(uid1)); + CHECK_EQ(p1, cpu_profiler->FindCpuProfile(uid1)); const_cast<v8::CpuProfile*>(p1)->Delete(); - CHECK_EQ(0, v8::CpuProfiler::GetProfilesCount()); - CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid1)); + CHECK_EQ(0, cpu_profiler->GetProfileCount()); + CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid1)); v8::Local<v8::String> name2 = v8::String::New("2"); - v8::CpuProfiler::StartProfiling(name2); - const v8::CpuProfile* p2 = v8::CpuProfiler::StopProfiling(name2); + cpu_profiler->StartCpuProfiling(name2); + const v8::CpuProfile* p2 = cpu_profiler->StopCpuProfiling(name2); CHECK_NE(NULL, p2); - CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); + CHECK_EQ(1, cpu_profiler->GetProfileCount()); unsigned uid2 = p2->GetUid(); CHECK_NE(static_cast<int>(uid1), static_cast<int>(uid2)); - CHECK_EQ(p2, v8::CpuProfiler::FindProfile(uid2)); - CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid1)); + CHECK_EQ(p2, cpu_profiler->FindCpuProfile(uid2)); + CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid1)); v8::Local<v8::String> name3 = v8::String::New("3"); - v8::CpuProfiler::StartProfiling(name3); - const v8::CpuProfile* p3 = v8::CpuProfiler::StopProfiling(name3); + cpu_profiler->StartCpuProfiling(name3); + const v8::CpuProfile* p3 = cpu_profiler->StopCpuProfiling(name3); CHECK_NE(NULL, p3); - CHECK_EQ(2, v8::CpuProfiler::GetProfilesCount()); + CHECK_EQ(2, cpu_profiler->GetProfileCount()); unsigned uid3 = p3->GetUid(); CHECK_NE(static_cast<int>(uid1), static_cast<int>(uid3)); - CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); - CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid1)); + CHECK_EQ(p3, cpu_profiler->FindCpuProfile(uid3)); + CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid1)); const_cast<v8::CpuProfile*>(p2)->Delete(); - CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); - CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); - CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); + CHECK_EQ(1, cpu_profiler->GetProfileCount()); + CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid2)); + CHECK_EQ(p3, cpu_profiler->FindCpuProfile(uid3)); const_cast<v8::CpuProfile*>(p3)->Delete(); - CHECK_EQ(0, v8::CpuProfiler::GetProfilesCount()); - CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid3)); - CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); - CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid1)); + CHECK_EQ(0, cpu_profiler->GetProfileCount()); + CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid3)); + CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid2)); + CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid1)); } TEST(DeleteCpuProfileDifferentTokens) { LocalContext env; v8::HandleScope scope(env->GetIsolate()); + v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); - CHECK_EQ(0, v8::CpuProfiler::GetProfilesCount()); + CHECK_EQ(0, cpu_profiler->GetProfileCount()); v8::Local<v8::String> name1 = v8::String::New("1"); - v8::CpuProfiler::StartProfiling(name1); - const v8::CpuProfile* p1 = v8::CpuProfiler::StopProfiling(name1); + cpu_profiler->StartCpuProfiling(name1); + const v8::CpuProfile* p1 = cpu_profiler->StopCpuProfiling(name1); CHECK_NE(NULL, p1); - CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); + CHECK_EQ(1, cpu_profiler->GetProfileCount()); unsigned uid1 = p1->GetUid(); - CHECK_EQ(p1, v8::CpuProfiler::FindProfile(uid1)); + CHECK_EQ(p1, cpu_profiler->FindCpuProfile(uid1)); v8::Local<v8::String> token1 = v8::String::New("token1"); - const v8::CpuProfile* p1_t1 = v8::CpuProfiler::FindProfile(uid1, token1); + const v8::CpuProfile* p1_t1 = cpu_profiler->FindCpuProfile(uid1, token1); CHECK_NE(NULL, p1_t1); CHECK_NE(p1, p1_t1); - CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); + CHECK_EQ(1, cpu_profiler->GetProfileCount()); const_cast<v8::CpuProfile*>(p1)->Delete(); - CHECK_EQ(0, v8::CpuProfiler::GetProfilesCount()); - CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid1)); - CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid1, token1)); + CHECK_EQ(0, cpu_profiler->GetProfileCount()); + CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid1)); + CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid1, token1)); const_cast<v8::CpuProfile*>(p1_t1)->Delete(); - CHECK_EQ(0, v8::CpuProfiler::GetProfilesCount()); + CHECK_EQ(0, cpu_profiler->GetProfileCount()); v8::Local<v8::String> name2 = v8::String::New("2"); - v8::CpuProfiler::StartProfiling(name2); + cpu_profiler->StartCpuProfiling(name2); v8::Local<v8::String> token2 = v8::String::New("token2"); - const v8::CpuProfile* p2_t2 = v8::CpuProfiler::StopProfiling(name2, token2); + const v8::CpuProfile* p2_t2 = cpu_profiler->StopCpuProfiling(name2, token2); CHECK_NE(NULL, p2_t2); - CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); + CHECK_EQ(1, cpu_profiler->GetProfileCount()); unsigned uid2 = p2_t2->GetUid(); CHECK_NE(static_cast<int>(uid1), static_cast<int>(uid2)); - const v8::CpuProfile* p2 = v8::CpuProfiler::FindProfile(uid2); + const v8::CpuProfile* p2 = cpu_profiler->FindCpuProfile(uid2); CHECK_NE(p2_t2, p2); v8::Local<v8::String> name3 = v8::String::New("3"); - v8::CpuProfiler::StartProfiling(name3); - const v8::CpuProfile* p3 = v8::CpuProfiler::StopProfiling(name3); + cpu_profiler->StartCpuProfiling(name3); + const v8::CpuProfile* p3 = cpu_profiler->StopCpuProfiling(name3); CHECK_NE(NULL, p3); - CHECK_EQ(2, v8::CpuProfiler::GetProfilesCount()); + CHECK_EQ(2, cpu_profiler->GetProfileCount()); unsigned uid3 = p3->GetUid(); CHECK_NE(static_cast<int>(uid1), static_cast<int>(uid3)); - CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); + CHECK_EQ(p3, cpu_profiler->FindCpuProfile(uid3)); const_cast<v8::CpuProfile*>(p2_t2)->Delete(); - CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); - CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); - CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); + CHECK_EQ(1, cpu_profiler->GetProfileCount()); + CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid2)); + CHECK_EQ(p3, cpu_profiler->FindCpuProfile(uid3)); const_cast<v8::CpuProfile*>(p2)->Delete(); - CHECK_EQ(1, v8::CpuProfiler::GetProfilesCount()); - CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid2)); - CHECK_EQ(p3, v8::CpuProfiler::FindProfile(uid3)); + CHECK_EQ(1, cpu_profiler->GetProfileCount()); + CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid2)); + CHECK_EQ(p3, cpu_profiler->FindCpuProfile(uid3)); const_cast<v8::CpuProfile*>(p3)->Delete(); - CHECK_EQ(0, v8::CpuProfiler::GetProfilesCount()); - CHECK_EQ(NULL, v8::CpuProfiler::FindProfile(uid3)); + CHECK_EQ(0, cpu_profiler->GetProfileCount()); + CHECK_EQ(NULL, cpu_profiler->FindCpuProfile(uid3)); } |