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