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

Side by Side Diff: test/cctest/test-profile-generator.cc

Issue 1635005: Allow new CPU profiling subsystem to coexist nicely with the old one. (Closed)
Patch Set: Fix TickSampleEvent Created 10 years, 8 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // 2 //
3 // Tests of profiles generator and utilities. 3 // Tests of profiles generator and utilities.
4 4
5 #ifdef ENABLE_CPP_PROFILES_PROCESSOR 5 #ifdef ENABLE_CPP_PROFILES_PROCESSOR
6 6
7 #include "v8.h" 7 #include "v8.h"
8 #include "profile-generator-inl.h" 8 #include "profile-generator-inl.h"
9 #include "cctest.h" 9 #include "cctest.h"
10 10
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 code_map.MoveCode(ToAddress(0x1500), ToAddress(0x1800)); 360 code_map.MoveCode(ToAddress(0x1500), ToAddress(0x1800));
361 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1500))); 361 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1500)));
362 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700))); 362 CHECK_EQ(&entry2, code_map.FindEntry(ToAddress(0x1700)));
363 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1800))); 363 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1800)));
364 code_map.DeleteCode(ToAddress(0x1700)); 364 code_map.DeleteCode(ToAddress(0x1700));
365 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1700))); 365 CHECK_EQ(NULL, code_map.FindEntry(ToAddress(0x1700)));
366 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1800))); 366 CHECK_EQ(&entry1, code_map.FindEntry(ToAddress(0x1800)));
367 } 367 }
368 368
369 369
370 namespace {
371
372 class TestSetup {
373 public:
374 TestSetup()
375 : old_flag_prof_browser_mode_(i::FLAG_prof_browser_mode) {
376 i::FLAG_prof_browser_mode = false;
377 }
378
379 ~TestSetup() {
380 i::FLAG_prof_browser_mode = old_flag_prof_browser_mode_;
381 }
382
383 private:
384 bool old_flag_prof_browser_mode_;
385 };
386
387 } // namespace
388
370 TEST(RecordTickSample) { 389 TEST(RecordTickSample) {
390 TestSetup test_setup;
371 CpuProfilesCollection profiles; 391 CpuProfilesCollection profiles;
372 profiles.StartProfiling("", 1); 392 profiles.StartProfiling("", 1);
373 ProfileGenerator generator(&profiles); 393 ProfileGenerator generator(&profiles);
374 CodeEntry* entry1 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa"); 394 CodeEntry* entry1 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "aaa");
375 CodeEntry* entry2 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb"); 395 CodeEntry* entry2 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "bbb");
376 CodeEntry* entry3 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc"); 396 CodeEntry* entry3 = generator.NewCodeEntry(i::Logger::FUNCTION_TAG, "ccc");
377 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); 397 generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200);
378 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100); 398 generator.code_map()->AddCode(ToAddress(0x1700), entry2, 0x100);
379 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50); 399 generator.code_map()->AddCode(ToAddress(0x1900), entry3, 0x50);
380 400
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 CHECK_EQ(entry1, node2->entry()); 437 CHECK_EQ(entry1, node2->entry());
418 ProfileNode* node3 = top_down_test_helper.Walk(entry1, entry2, entry3); 438 ProfileNode* node3 = top_down_test_helper.Walk(entry1, entry2, entry3);
419 CHECK_NE(NULL, node3); 439 CHECK_NE(NULL, node3);
420 CHECK_EQ(entry3, node3->entry()); 440 CHECK_EQ(entry3, node3->entry());
421 ProfileNode* node4 = top_down_test_helper.Walk(entry1, entry3, entry1); 441 ProfileNode* node4 = top_down_test_helper.Walk(entry1, entry3, entry1);
422 CHECK_NE(NULL, node4); 442 CHECK_NE(NULL, node4);
423 CHECK_EQ(entry1, node4->entry()); 443 CHECK_EQ(entry1, node4->entry());
424 } 444 }
425 445
426 #endif // ENABLE_CPP_PROFILES_PROCESSOR 446 #endif // ENABLE_CPP_PROFILES_PROCESSOR
OLDNEW
« src/cpu-profiler-inl.h ('K') | « test/cctest/test-cpu-profiler.cc ('k') | tools/gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698