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

Side by Side Diff: test/cctest/test-cpu-profiler.cc

Issue 22715004: Version 3.20.15 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Add TypedArray API and correctness patches r16033 and r16084 Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-code-stubs-x64.cc ('k') | test/cctest/test-global-handles.cc » ('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 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 isolate->GetCpuProfiler()->StartCpuProfiling(v8::String::New("Test")); 403 isolate->GetCpuProfiler()->StartCpuProfiling(v8::String::New("Test"));
404 isolate->GetCpuProfiler()->StopCpuProfiling(v8::String::New("Test")); 404 isolate->GetCpuProfiler()->StopCpuProfiling(v8::String::New("Test"));
405 } 405 }
406 CHECK(i::Isolate::Current()->IsInitialized()); 406 CHECK(i::Isolate::Current()->IsInitialized());
407 CHECK_NE(NULL, isolate->GetCpuProfiler()); 407 CHECK_NE(NULL, isolate->GetCpuProfiler());
408 isolate->Dispose(); 408 isolate->Dispose();
409 CHECK_EQ(NULL, isolate->GetCpuProfiler()); 409 CHECK_EQ(NULL, isolate->GetCpuProfiler());
410 } 410 }
411 411
412 412
413 TEST(ProfileStartEndTime) {
414 LocalContext env;
415 v8::HandleScope scope(env->GetIsolate());
416 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
417
418 int64_t time_before_profiling = i::OS::Ticks();
419 v8::Local<v8::String> profile_name = v8::String::New("test");
420 cpu_profiler->StartCpuProfiling(profile_name);
421 const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name);
422 CHECK(time_before_profiling <= profile->GetStartTime());
423 CHECK(profile->GetStartTime() <= profile->GetEndTime());
424 CHECK(profile->GetEndTime() <= i::OS::Ticks());
425 }
426
427
428 static const v8::CpuProfile* RunProfiler( 413 static const v8::CpuProfile* RunProfiler(
429 LocalContext& env, v8::Handle<v8::Function> function, 414 LocalContext& env, v8::Handle<v8::Function> function,
430 v8::Handle<v8::Value> argv[], int argc, 415 v8::Handle<v8::Value> argv[], int argc,
431 unsigned min_js_samples) { 416 unsigned min_js_samples) {
432 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); 417 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
433 v8::Local<v8::String> profile_name = v8::String::New("my_profile"); 418 v8::Local<v8::String> profile_name = v8::String::New("my_profile");
434 419
435 cpu_profiler->StartCpuProfiling(profile_name); 420 cpu_profiler->StartCpuProfiling(profile_name);
436 421
437 i::Sampler* sampler = 422 i::Sampler* sampler =
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 1302
1318 CHECK_EQ(1, barNode->GetChildrenCount()); 1303 CHECK_EQ(1, barNode->GetChildrenCount());
1319 const v8::CpuProfileNode* nativeNode2 = GetChild(barNode, "CallJsFunction2"); 1304 const v8::CpuProfileNode* nativeNode2 = GetChild(barNode, "CallJsFunction2");
1320 1305
1321 CHECK_EQ(1, nativeNode2->GetChildrenCount()); 1306 CHECK_EQ(1, nativeNode2->GetChildrenCount());
1322 GetChild(nativeNode2, "foo"); 1307 GetChild(nativeNode2, "foo");
1323 1308
1324 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); 1309 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
1325 cpu_profiler->DeleteAllCpuProfiles(); 1310 cpu_profiler->DeleteAllCpuProfiles();
1326 } 1311 }
OLDNEW
« no previous file with comments | « test/cctest/test-code-stubs-x64.cc ('k') | test/cctest/test-global-handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698