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

Side by Side Diff: src/cpu-profiler.cc

Issue 6712062: Fix DevTools CPU profiler after isolates merge. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 9 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
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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 Logger::CALLBACK_TAG, "set ", name, entry_point); 434 Logger::CALLBACK_TAG, "set ", name, entry_point);
435 } 435 }
436 436
437 437
438 CpuProfiler::CpuProfiler() 438 CpuProfiler::CpuProfiler()
439 : profiles_(new CpuProfilesCollection()), 439 : profiles_(new CpuProfilesCollection()),
440 next_profile_uid_(1), 440 next_profile_uid_(1),
441 token_enumerator_(new TokenEnumerator()), 441 token_enumerator_(new TokenEnumerator()),
442 generator_(NULL), 442 generator_(NULL),
443 processor_(NULL), 443 processor_(NULL),
444 need_to_stop_sampler_(false),
444 is_profiling_(false) { 445 is_profiling_(false) {
445 } 446 }
446 447
447 448
448 CpuProfiler::~CpuProfiler() { 449 CpuProfiler::~CpuProfiler() {
449 delete token_enumerator_; 450 delete token_enumerator_;
450 delete profiles_; 451 delete profiles_;
451 } 452 }
452 453
453 454
(...skipping 25 matching lines...) Expand all
479 bool saved_log_code_flag = FLAG_log_code; 480 bool saved_log_code_flag = FLAG_log_code;
480 FLAG_log_code = true; 481 FLAG_log_code = true;
481 LOGGER->LogCodeObjects(); 482 LOGGER->LogCodeObjects();
482 FLAG_log_code = saved_log_code_flag; 483 FLAG_log_code = saved_log_code_flag;
483 } 484 }
484 LOGGER->LogCompiledFunctions(); 485 LOGGER->LogCompiledFunctions();
485 LOGGER->LogAccessorCallbacks(); 486 LOGGER->LogAccessorCallbacks();
486 } 487 }
487 // Enable stack sampling. 488 // Enable stack sampling.
488 Sampler* sampler = reinterpret_cast<Sampler*>(LOGGER->ticker_); 489 Sampler* sampler = reinterpret_cast<Sampler*>(LOGGER->ticker_);
489 if (!sampler->IsActive()) sampler->Start(); 490 if (!sampler->IsActive()) {
491 sampler->Start();
492 need_to_stop_sampler_ = true;
493 }
490 sampler->IncreaseProfilingDepth(); 494 sampler->IncreaseProfilingDepth();
491 } 495 }
492 } 496 }
493 497
494 498
495 CpuProfile* CpuProfiler::StopCollectingProfile(const char* title) { 499 CpuProfile* CpuProfiler::StopCollectingProfile(const char* title) {
496 const double actual_sampling_rate = generator_->actual_sampling_rate(); 500 const double actual_sampling_rate = generator_->actual_sampling_rate();
497 StopProcessorIfLastProfile(title); 501 StopProcessorIfLastProfile(title);
498 CpuProfile* result = 502 CpuProfile* result =
499 profiles_->StopProfiling(TokenEnumerator::kNoSecurityToken, 503 profiles_->StopProfiling(TokenEnumerator::kNoSecurityToken,
(...skipping 13 matching lines...) Expand all
513 StopProcessorIfLastProfile(profile_title); 517 StopProcessorIfLastProfile(profile_title);
514 int token = token_enumerator_->GetTokenId(security_token); 518 int token = token_enumerator_->GetTokenId(security_token);
515 return profiles_->StopProfiling(token, profile_title, actual_sampling_rate); 519 return profiles_->StopProfiling(token, profile_title, actual_sampling_rate);
516 } 520 }
517 521
518 522
519 void CpuProfiler::StopProcessorIfLastProfile(const char* title) { 523 void CpuProfiler::StopProcessorIfLastProfile(const char* title) {
520 if (profiles_->IsLastProfile(title)) { 524 if (profiles_->IsLastProfile(title)) {
521 Sampler* sampler = reinterpret_cast<Sampler*>(LOGGER->ticker_); 525 Sampler* sampler = reinterpret_cast<Sampler*>(LOGGER->ticker_);
522 sampler->DecreaseProfilingDepth(); 526 sampler->DecreaseProfilingDepth();
523 sampler->Stop(); 527 if (need_to_stop_sampler_) {
528 sampler->Stop();
529 need_to_stop_sampler_ = false;
530 }
524 processor_->Stop(); 531 processor_->Stop();
525 processor_->Join(); 532 processor_->Join();
526 delete processor_; 533 delete processor_;
527 delete generator_; 534 delete generator_;
528 processor_ = NULL; 535 processor_ = NULL;
529 NoBarrier_Store(&is_profiling_, false); 536 NoBarrier_Store(&is_profiling_, false);
530 generator_ = NULL; 537 generator_ = NULL;
531 LOGGER->logging_nesting_ = saved_logging_nesting_; 538 LOGGER->logging_nesting_ = saved_logging_nesting_;
532 } 539 }
533 } 540 }
(...skipping 19 matching lines...) Expand all
553 #ifdef ENABLE_LOGGING_AND_PROFILING 560 #ifdef ENABLE_LOGGING_AND_PROFILING
554 Isolate* isolate = Isolate::Current(); 561 Isolate* isolate = Isolate::Current();
555 if (isolate->cpu_profiler() != NULL) { 562 if (isolate->cpu_profiler() != NULL) {
556 delete isolate->cpu_profiler(); 563 delete isolate->cpu_profiler();
557 } 564 }
558 isolate->set_cpu_profiler(NULL); 565 isolate->set_cpu_profiler(NULL);
559 #endif 566 #endif
560 } 567 }
561 568
562 } } // namespace v8::internal 569 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/cpu-profiler.h ('k') | src/platform-linux.cc » ('j') | src/platform-linux.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698