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

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

Issue 22189002: Revert "Return start/end profiling time in microseconds instead of milliseconds" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « src/profile-generator.cc ('k') | no next file » | 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 413 TEST(ProfileStartEndTime) {
414 LocalContext env; 414 LocalContext env;
415 v8::HandleScope scope(env->GetIsolate()); 415 v8::HandleScope scope(env->GetIsolate());
416 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); 416 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
417 417
418 double time_before_profiling = i::OS::Ticks(); 418 double time_before_profiling = i::OS::TimeCurrentMillis();
419 v8::Local<v8::String> profile_name = v8::String::New("test"); 419 v8::Local<v8::String> profile_name = v8::String::New("test");
420 cpu_profiler->StartCpuProfiling(profile_name); 420 cpu_profiler->StartCpuProfiling(profile_name);
421 const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name); 421 const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name);
422 CHECK(time_before_profiling <= profile->GetStartTime()); 422 CHECK(time_before_profiling <= profile->GetStartTime());
423 CHECK(profile->GetStartTime() <= profile->GetEndTime()); 423 CHECK(profile->GetStartTime() <= profile->GetEndTime());
424 CHECK(profile->GetEndTime() <= i::OS::Ticks()); 424 CHECK(profile->GetEndTime() <= i::OS::TimeCurrentMillis());
425 } 425 }
426 426
427 427
428 static const v8::CpuProfile* RunProfiler( 428 static const v8::CpuProfile* RunProfiler(
429 LocalContext& env, v8::Handle<v8::Function> function, 429 LocalContext& env, v8::Handle<v8::Function> function,
430 v8::Handle<v8::Value> argv[], int argc, 430 v8::Handle<v8::Value> argv[], int argc,
431 unsigned min_js_samples) { 431 unsigned min_js_samples) {
432 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); 432 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
433 v8::Local<v8::String> profile_name = v8::String::New("my_profile"); 433 v8::Local<v8::String> profile_name = v8::String::New("my_profile");
434 434
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 1317
1318 CHECK_EQ(1, barNode->GetChildrenCount()); 1318 CHECK_EQ(1, barNode->GetChildrenCount());
1319 const v8::CpuProfileNode* nativeNode2 = GetChild(barNode, "CallJsFunction2"); 1319 const v8::CpuProfileNode* nativeNode2 = GetChild(barNode, "CallJsFunction2");
1320 1320
1321 CHECK_EQ(1, nativeNode2->GetChildrenCount()); 1321 CHECK_EQ(1, nativeNode2->GetChildrenCount());
1322 GetChild(nativeNode2, "foo"); 1322 GetChild(nativeNode2, "foo");
1323 1323
1324 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); 1324 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
1325 cpu_profiler->DeleteAllCpuProfiles(); 1325 cpu_profiler->DeleteAllCpuProfiles();
1326 } 1326 }
OLDNEW
« no previous file with comments | « src/profile-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698