| OLD | NEW |
| 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 413 |
| 414 | 414 |
| 415 void CpuProfiler::StartProcessorIfNotStarted() { | 415 void CpuProfiler::StartProcessorIfNotStarted() { |
| 416 if (processor_ == NULL) { | 416 if (processor_ == NULL) { |
| 417 // Disable logging when using the new implementation. | 417 // Disable logging when using the new implementation. |
| 418 saved_logging_nesting_ = Logger::logging_nesting_; | 418 saved_logging_nesting_ = Logger::logging_nesting_; |
| 419 Logger::logging_nesting_ = 0; | 419 Logger::logging_nesting_ = 0; |
| 420 generator_ = new ProfileGenerator(profiles_); | 420 generator_ = new ProfileGenerator(profiles_); |
| 421 processor_ = new ProfilerEventsProcessor(generator_); | 421 processor_ = new ProfilerEventsProcessor(generator_); |
| 422 processor_->Start(); | 422 processor_->Start(); |
| 423 // Enable stack sampling. |
| 424 // It is important to have it started prior to logging, see issue 683: |
| 425 // http://code.google.com/p/v8/issues/detail?id=683 |
| 426 reinterpret_cast<Sampler*>(Logger::ticker_)->Start(); |
| 423 // Enumerate stuff we already have in the heap. | 427 // Enumerate stuff we already have in the heap. |
| 424 if (Heap::HasBeenSetup()) { | 428 if (Heap::HasBeenSetup()) { |
| 425 Logger::LogCodeObjects(); | 429 Logger::LogCodeObjects(); |
| 426 Logger::LogCompiledFunctions(); | 430 Logger::LogCompiledFunctions(); |
| 427 Logger::LogFunctionObjects(); | 431 Logger::LogFunctionObjects(); |
| 428 Logger::LogAccessorCallbacks(); | 432 Logger::LogAccessorCallbacks(); |
| 429 } | 433 } |
| 430 // Enable stack sampling. | |
| 431 reinterpret_cast<Sampler*>(Logger::ticker_)->Start(); | |
| 432 } | 434 } |
| 433 } | 435 } |
| 434 | 436 |
| 435 | 437 |
| 436 CpuProfile* CpuProfiler::StopCollectingProfile(const char* title) { | 438 CpuProfile* CpuProfiler::StopCollectingProfile(const char* title) { |
| 437 const double actual_sampling_rate = generator_->actual_sampling_rate(); | 439 const double actual_sampling_rate = generator_->actual_sampling_rate(); |
| 438 StopProcessorIfLastProfile(); | 440 StopProcessorIfLastProfile(); |
| 439 CpuProfile* result = profiles_->StopProfiling(title, actual_sampling_rate); | 441 CpuProfile* result = profiles_->StopProfiling(title, actual_sampling_rate); |
| 440 if (result != NULL) { | 442 if (result != NULL) { |
| 441 result->Print(); | 443 result->Print(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 void CpuProfiler::TearDown() { | 485 void CpuProfiler::TearDown() { |
| 484 #ifdef ENABLE_LOGGING_AND_PROFILING | 486 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 485 if (singleton_ != NULL) { | 487 if (singleton_ != NULL) { |
| 486 delete singleton_; | 488 delete singleton_; |
| 487 } | 489 } |
| 488 singleton_ = NULL; | 490 singleton_ = NULL; |
| 489 #endif | 491 #endif |
| 490 } | 492 } |
| 491 | 493 |
| 492 } } // namespace v8::internal | 494 } } // namespace v8::internal |
| OLD | NEW |