OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 FLAG_log_code = saved_log_code_flag; | 512 FLAG_log_code = saved_log_code_flag; |
513 } | 513 } |
514 isolate->logger()->LogCompiledFunctions(); | 514 isolate->logger()->LogCompiledFunctions(); |
515 isolate->logger()->LogAccessorCallbacks(); | 515 isolate->logger()->LogAccessorCallbacks(); |
516 } | 516 } |
517 // Enable stack sampling. | 517 // Enable stack sampling. |
518 if (!sampler->IsActive()) { | 518 if (!sampler->IsActive()) { |
519 sampler->Start(); | 519 sampler->Start(); |
520 need_to_stop_sampler_ = true; | 520 need_to_stop_sampler_ = true; |
521 } | 521 } |
| 522 sampler->SetHasProcessingThread(true); |
522 sampler->IncreaseProfilingDepth(); | 523 sampler->IncreaseProfilingDepth(); |
523 processor_->Start(); | 524 processor_->Start(); |
524 } | 525 } |
525 } | 526 } |
526 | 527 |
527 | 528 |
528 CpuProfile* CpuProfiler::StopCollectingProfile(const char* title) { | 529 CpuProfile* CpuProfiler::StopCollectingProfile(const char* title) { |
529 const double actual_sampling_rate = generator_->actual_sampling_rate(); | 530 const double actual_sampling_rate = generator_->actual_sampling_rate(); |
530 StopProcessorIfLastProfile(title); | 531 StopProcessorIfLastProfile(title); |
531 CpuProfile* result = | 532 CpuProfile* result = |
(...skipping 22 matching lines...) Expand all Loading... |
554 } | 555 } |
555 | 556 |
556 | 557 |
557 void CpuProfiler::StopProcessor() { | 558 void CpuProfiler::StopProcessor() { |
558 NoBarrier_Store(&is_profiling_, false); | 559 NoBarrier_Store(&is_profiling_, false); |
559 processor_->Stop(); | 560 processor_->Stop(); |
560 processor_->Join(); | 561 processor_->Join(); |
561 Logger* logger = Isolate::Current()->logger(); | 562 Logger* logger = Isolate::Current()->logger(); |
562 Sampler* sampler = logger->sampler(); | 563 Sampler* sampler = logger->sampler(); |
563 sampler->DecreaseProfilingDepth(); | 564 sampler->DecreaseProfilingDepth(); |
| 565 sampler->SetHasProcessingThread(false); |
564 if (need_to_stop_sampler_) { | 566 if (need_to_stop_sampler_) { |
565 sampler->Stop(); | 567 sampler->Stop(); |
566 need_to_stop_sampler_ = false; | 568 need_to_stop_sampler_ = false; |
567 } | 569 } |
568 delete processor_; | 570 delete processor_; |
569 delete generator_; | 571 delete generator_; |
570 processor_ = NULL; | 572 processor_ = NULL; |
571 generator_ = NULL; | 573 generator_ = NULL; |
572 logger->logging_nesting_ = saved_logging_nesting_; | 574 logger->logging_nesting_ = saved_logging_nesting_; |
573 } | 575 } |
574 | 576 |
575 | 577 |
576 void CpuProfiler::SetUp() { | 578 void CpuProfiler::SetUp() { |
577 Isolate* isolate = Isolate::Current(); | 579 Isolate* isolate = Isolate::Current(); |
578 if (isolate->cpu_profiler() == NULL) { | 580 if (isolate->cpu_profiler() == NULL) { |
579 isolate->set_cpu_profiler(new CpuProfiler()); | 581 isolate->set_cpu_profiler(new CpuProfiler()); |
580 } | 582 } |
581 } | 583 } |
582 | 584 |
583 | 585 |
584 void CpuProfiler::TearDown() { | 586 void CpuProfiler::TearDown() { |
585 Isolate* isolate = Isolate::Current(); | 587 Isolate* isolate = Isolate::Current(); |
586 if (isolate->cpu_profiler() != NULL) { | 588 if (isolate->cpu_profiler() != NULL) { |
587 delete isolate->cpu_profiler(); | 589 delete isolate->cpu_profiler(); |
588 } | 590 } |
589 isolate->set_cpu_profiler(NULL); | 591 isolate->set_cpu_profiler(NULL); |
590 } | 592 } |
591 | 593 |
592 } } // namespace v8::internal | 594 } } // namespace v8::internal |
OLD | NEW |