| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 if (!log_->IsEnabled() || !FLAG_prof) return; | 626 if (!log_->IsEnabled() || !FLAG_prof) return; |
| 627 LogMessageBuilder msg(this); | 627 LogMessageBuilder msg(this); |
| 628 msg.Append("shared-library,\"%ls\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR "\n", | 628 msg.Append("shared-library,\"%ls\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR "\n", |
| 629 library_path, | 629 library_path, |
| 630 start, | 630 start, |
| 631 end); | 631 end); |
| 632 msg.WriteToLogFile(); | 632 msg.WriteToLogFile(); |
| 633 } | 633 } |
| 634 | 634 |
| 635 | 635 |
| 636 void Logger::TimerEvent(const char* name, int64_t start, int64_t end) { | 636 void Logger::TimerEvent(StartEnd se, const char* name) { |
| 637 if (!log_->IsEnabled()) return; | 637 if (!log_->IsEnabled()) return; |
| 638 ASSERT(FLAG_log_internal_timer_events); | 638 ASSERT(FLAG_log_internal_timer_events); |
| 639 LogMessageBuilder msg(this); | 639 LogMessageBuilder msg(this); |
| 640 int since_epoch = static_cast<int>(start - epoch_); | 640 int since_epoch = static_cast<int>(OS::Ticks() - epoch_); |
| 641 int pause_time = static_cast<int>(end - start); | 641 const char* format = (se == START) ? "timer-event-start,\"%s\",%ld\n" |
| 642 msg.Append("timer-event,\"%s\",%ld,%ld\n", name, since_epoch, pause_time); | 642 : "timer-event-end,\"%s\",%ld\n"; |
| 643 msg.Append(format, name, since_epoch); |
| 643 msg.WriteToLogFile(); | 644 msg.WriteToLogFile(); |
| 644 } | 645 } |
| 645 | 646 |
| 646 | 647 |
| 647 void Logger::ExternalSwitch(StateTag old_tag, StateTag new_tag) { | |
| 648 if (old_tag != EXTERNAL && new_tag == EXTERNAL) { | |
| 649 enter_external_ = OS::Ticks(); | |
| 650 } | |
| 651 if (old_tag == EXTERNAL && new_tag != EXTERNAL && enter_external_ != 0) { | |
| 652 TimerEvent("V8.External", enter_external_, OS::Ticks()); | |
| 653 enter_external_ = 0; | |
| 654 } | |
| 655 } | |
| 656 | |
| 657 | |
| 658 void Logger::EnterExternal() { | 648 void Logger::EnterExternal() { |
| 659 LOGGER->enter_external_ = OS::Ticks(); | 649 LOG(ISOLATE, TimerEvent(START, TimerEventScope::v8_external)); |
| 660 } | 650 } |
| 661 | 651 |
| 662 | 652 |
| 663 void Logger::LeaveExternal() { | 653 void Logger::LeaveExternal() { |
| 664 if (enter_external_ == 0) return; | 654 LOG(ISOLATE, TimerEvent(END, TimerEventScope::v8_external)); |
| 665 Logger* logger = LOGGER; | |
| 666 logger->TimerEvent("V8.External", enter_external_, OS::Ticks()); | |
| 667 logger->enter_external_ = 0; | |
| 668 } | 655 } |
| 669 | 656 |
| 670 | 657 |
| 671 int64_t Logger::enter_external_ = 0; | 658 void Logger::TimerEventScope::LogTimerEvent(StartEnd se) { |
| 672 | 659 LOG(isolate_, TimerEvent(se, name_)); |
| 673 | |
| 674 void Logger::TimerEventScope::LogTimerEvent() { | |
| 675 LOG(isolate_, TimerEvent(name_, start_, OS::Ticks())); | |
| 676 } | 660 } |
| 677 | 661 |
| 678 | 662 |
| 679 const char* Logger::TimerEventScope::v8_recompile_synchronous = | 663 const char* Logger::TimerEventScope::v8_recompile_synchronous = |
| 680 "V8.RecompileSynchronous"; | 664 "V8.RecompileSynchronous"; |
| 681 const char* Logger::TimerEventScope::v8_recompile_parallel = | 665 const char* Logger::TimerEventScope::v8_recompile_parallel = |
| 682 "V8.RecompileParallel"; | 666 "V8.RecompileParallel"; |
| 683 const char* Logger::TimerEventScope::v8_compile_full_code = | 667 const char* Logger::TimerEventScope::v8_compile_full_code = |
| 684 "V8.CompileFullCode"; | 668 "V8.CompileFullCode"; |
| 685 const char* Logger::TimerEventScope::v8_execute = "V8.Execute"; | 669 const char* Logger::TimerEventScope::v8_execute = "V8.Execute"; |
| 670 const char* Logger::TimerEventScope::v8_external = "V8.External"; |
| 686 | 671 |
| 687 | 672 |
| 688 void Logger::LogRegExpSource(Handle<JSRegExp> regexp) { | 673 void Logger::LogRegExpSource(Handle<JSRegExp> regexp) { |
| 689 // Prints "/" + re.source + "/" + | 674 // Prints "/" + re.source + "/" + |
| 690 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"") | 675 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"") |
| 691 LogMessageBuilder msg(this); | 676 LogMessageBuilder msg(this); |
| 692 | 677 |
| 693 Handle<Object> source = GetProperty(regexp, "source"); | 678 Handle<Object> source = GetProperty(regexp, "source"); |
| 694 if (!source->IsString()) { | 679 if (!source->IsString()) { |
| 695 msg.Append("no source"); | 680 msg.Append("no source"); |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1832 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 1817 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
| 1833 ASSERT(sampler->IsActive()); | 1818 ASSERT(sampler->IsActive()); |
| 1834 ScopedLock lock(active_samplers_mutex); | 1819 ScopedLock lock(active_samplers_mutex); |
| 1835 ASSERT(active_samplers_ != NULL); | 1820 ASSERT(active_samplers_ != NULL); |
| 1836 bool removed = active_samplers_->RemoveElement(sampler); | 1821 bool removed = active_samplers_->RemoveElement(sampler); |
| 1837 ASSERT(removed); | 1822 ASSERT(removed); |
| 1838 USE(removed); | 1823 USE(removed); |
| 1839 } | 1824 } |
| 1840 | 1825 |
| 1841 } } // namespace v8::internal | 1826 } } // namespace v8::internal |
| OLD | NEW |