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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 if (!sampler->IsActive()) { | 445 if (!sampler->IsActive()) { |
446 sampler->Start(); | 446 sampler->Start(); |
447 need_to_stop_sampler_ = true; | 447 need_to_stop_sampler_ = true; |
448 } | 448 } |
449 } | 449 } |
450 } | 450 } |
451 | 451 |
452 | 452 |
453 CpuProfile* CpuProfiler::StopProfiling(const char* title) { | 453 CpuProfile* CpuProfiler::StopProfiling(const char* title) { |
454 if (!is_profiling_) return NULL; | 454 if (!is_profiling_) return NULL; |
| 455 const double actual_sampling_rate = generator_->actual_sampling_rate(); |
455 StopProcessorIfLastProfile(title); | 456 StopProcessorIfLastProfile(title); |
456 CpuProfile* result = profiles_->StopProfiling(title); | 457 CpuProfile* result = profiles_->StopProfiling(title, actual_sampling_rate); |
457 if (result != NULL) { | 458 if (result != NULL) { |
458 result->Print(); | 459 result->Print(); |
459 } | 460 } |
460 return result; | 461 return result; |
461 } | 462 } |
462 | 463 |
463 | 464 |
464 CpuProfile* CpuProfiler::StopProfiling(String* title) { | 465 CpuProfile* CpuProfiler::StopProfiling(String* title) { |
465 if (!is_profiling_) return NULL; | 466 if (!is_profiling_) return NULL; |
| 467 const double actual_sampling_rate = generator_->actual_sampling_rate(); |
466 const char* profile_title = profiles_->GetName(title); | 468 const char* profile_title = profiles_->GetName(title); |
467 StopProcessorIfLastProfile(profile_title); | 469 StopProcessorIfLastProfile(profile_title); |
468 return profiles_->StopProfiling(profile_title); | 470 return profiles_->StopProfiling(profile_title, actual_sampling_rate); |
469 } | 471 } |
470 | 472 |
471 | 473 |
472 void CpuProfiler::StopProcessorIfLastProfile(const char* title) { | 474 void CpuProfiler::StopProcessorIfLastProfile(const char* title) { |
473 if (profiles_->IsLastProfile(title)) StopProcessor(); | 475 if (profiles_->IsLastProfile(title)) StopProcessor(); |
474 } | 476 } |
475 | 477 |
476 | 478 |
477 void CpuProfiler::StopProcessor() { | 479 void CpuProfiler::StopProcessor() { |
478 Logger* logger = isolate_->logger(); | 480 Logger* logger = isolate_->logger(); |
(...skipping 21 matching lines...) Expand all Loading... |
500 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; | 502 ReportBuiltinEventRecord* rec = &evt_rec.ReportBuiltinEventRecord_; |
501 Builtins::Name id = static_cast<Builtins::Name>(i); | 503 Builtins::Name id = static_cast<Builtins::Name>(i); |
502 rec->start = builtins->builtin(id)->address(); | 504 rec->start = builtins->builtin(id)->address(); |
503 rec->builtin_id = id; | 505 rec->builtin_id = id; |
504 processor_->Enqueue(evt_rec); | 506 processor_->Enqueue(evt_rec); |
505 } | 507 } |
506 } | 508 } |
507 | 509 |
508 | 510 |
509 } } // namespace v8::internal | 511 } } // namespace v8::internal |
OLD | NEW |