| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 Logger::LogFunctionObjects(); | 429 Logger::LogFunctionObjects(); |
| 430 Logger::LogAccessorCallbacks(); | 430 Logger::LogAccessorCallbacks(); |
| 431 } | 431 } |
| 432 // Enable stack sampling. | 432 // Enable stack sampling. |
| 433 reinterpret_cast<Sampler*>(Logger::ticker_)->Start(); | 433 reinterpret_cast<Sampler*>(Logger::ticker_)->Start(); |
| 434 } | 434 } |
| 435 } | 435 } |
| 436 | 436 |
| 437 | 437 |
| 438 CpuProfile* CpuProfiler::StopCollectingProfile(const char* title) { | 438 CpuProfile* CpuProfiler::StopCollectingProfile(const char* title) { |
| 439 const double actual_sampling_rate = generator_->actual_sampling_rate(); |
| 439 StopProcessorIfLastProfile(); | 440 StopProcessorIfLastProfile(); |
| 440 CpuProfile* result = profiles_->StopProfiling(title); | 441 CpuProfile* result = profiles_->StopProfiling(title, actual_sampling_rate); |
| 441 if (result != NULL) { | 442 if (result != NULL) { |
| 442 result->Print(); | 443 result->Print(); |
| 443 } | 444 } |
| 444 return result; | 445 return result; |
| 445 } | 446 } |
| 446 | 447 |
| 447 | 448 |
| 448 CpuProfile* CpuProfiler::StopCollectingProfile(String* title) { | 449 CpuProfile* CpuProfiler::StopCollectingProfile(String* title) { |
| 450 const double actual_sampling_rate = generator_->actual_sampling_rate(); |
| 449 StopProcessorIfLastProfile(); | 451 StopProcessorIfLastProfile(); |
| 450 return profiles_->StopProfiling(title); | 452 return profiles_->StopProfiling(title, actual_sampling_rate); |
| 451 } | 453 } |
| 452 | 454 |
| 453 | 455 |
| 454 void CpuProfiler::StopProcessorIfLastProfile() { | 456 void CpuProfiler::StopProcessorIfLastProfile() { |
| 455 if (profiles_->is_last_profile()) { | 457 if (profiles_->is_last_profile()) { |
| 456 reinterpret_cast<Sampler*>(Logger::ticker_)->Stop(); | 458 reinterpret_cast<Sampler*>(Logger::ticker_)->Stop(); |
| 457 processor_->Stop(); | 459 processor_->Stop(); |
| 458 processor_->Join(); | 460 processor_->Join(); |
| 459 delete processor_; | 461 delete processor_; |
| 460 delete generator_; | 462 delete generator_; |
| (...skipping 22 matching lines...) Expand all 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 |