| 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 msg.Append("shared-library,\"%ls\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR "\n", | 700 msg.Append("shared-library,\"%ls\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR "\n", |
| 701 library_path, | 701 library_path, |
| 702 start, | 702 start, |
| 703 end); | 703 end); |
| 704 msg.WriteToLogFile(); | 704 msg.WriteToLogFile(); |
| 705 } | 705 } |
| 706 | 706 |
| 707 | 707 |
| 708 void Logger::TimerEvent(const char* name, int64_t start, int64_t end) { | 708 void Logger::TimerEvent(const char* name, int64_t start, int64_t end) { |
| 709 if (!log_->IsEnabled()) return; | 709 if (!log_->IsEnabled()) return; |
| 710 ASSERT(FLAG_log_timer_events); | 710 ASSERT(FLAG_log_internal_timer_events); |
| 711 LogMessageBuilder msg(this); | 711 LogMessageBuilder msg(this); |
| 712 int since_epoch = static_cast<int>(start - epoch_); | 712 int since_epoch = static_cast<int>(start - epoch_); |
| 713 int pause_time = static_cast<int>(end - start); | 713 int pause_time = static_cast<int>(end - start); |
| 714 msg.Append("timer-event,\"%s\",%ld,%ld\n", name, since_epoch, pause_time); | 714 msg.Append("timer-event,\"%s\",%ld,%ld\n", name, since_epoch, pause_time); |
| 715 msg.WriteToLogFile(); | 715 msg.WriteToLogFile(); |
| 716 } | 716 } |
| 717 | 717 |
| 718 | 718 |
| 719 void Logger::ExternalSwitch(StateTag old_tag, StateTag new_tag) { | 719 void Logger::ExternalSwitch(StateTag old_tag, StateTag new_tag) { |
| 720 if (old_tag != EXTERNAL && new_tag == EXTERNAL) { | 720 if (old_tag != EXTERNAL && new_tag == EXTERNAL) { |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1372 } | 1372 } |
| 1373 | 1373 |
| 1374 | 1374 |
| 1375 void Logger::TickEvent(TickSample* sample, bool overflow) { | 1375 void Logger::TickEvent(TickSample* sample, bool overflow) { |
| 1376 if (!log_->IsEnabled() || !FLAG_prof) return; | 1376 if (!log_->IsEnabled() || !FLAG_prof) return; |
| 1377 LogMessageBuilder msg(this); | 1377 LogMessageBuilder msg(this); |
| 1378 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); | 1378 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); |
| 1379 msg.AppendAddress(sample->pc); | 1379 msg.AppendAddress(sample->pc); |
| 1380 msg.Append(','); | 1380 msg.Append(','); |
| 1381 msg.AppendAddress(sample->sp); | 1381 msg.AppendAddress(sample->sp); |
| 1382 msg.Append(",%ld", | 1382 msg.Append(",%ld", static_cast<int>(OS::Ticks() - epoch_)); |
| 1383 FLAG_log_timer_events ? static_cast<int>(OS::Ticks() - epoch_) : 0); | |
| 1384 if (sample->has_external_callback) { | 1383 if (sample->has_external_callback) { |
| 1385 msg.Append(",1,"); | 1384 msg.Append(",1,"); |
| 1386 msg.AppendAddress(sample->external_callback); | 1385 msg.AppendAddress(sample->external_callback); |
| 1387 } else { | 1386 } else { |
| 1388 msg.Append(",0,"); | 1387 msg.Append(",0,"); |
| 1389 msg.AppendAddress(sample->tos); | 1388 msg.AppendAddress(sample->tos); |
| 1390 } | 1389 } |
| 1391 msg.Append(",%d", static_cast<int>(sample->state)); | 1390 msg.Append(",%d", static_cast<int>(sample->state)); |
| 1392 if (overflow) { | 1391 if (overflow) { |
| 1393 msg.Append(",overflow"); | 1392 msg.Append(",overflow"); |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1782 Isolate* isolate = Isolate::Current(); | 1781 Isolate* isolate = Isolate::Current(); |
| 1783 ticker_ = new Ticker(isolate, kSamplingIntervalMs); | 1782 ticker_ = new Ticker(isolate, kSamplingIntervalMs); |
| 1784 | 1783 |
| 1785 if (FLAG_sliding_state_window && sliding_state_window_ == NULL) { | 1784 if (FLAG_sliding_state_window && sliding_state_window_ == NULL) { |
| 1786 sliding_state_window_ = new SlidingStateWindow(isolate); | 1785 sliding_state_window_ = new SlidingStateWindow(isolate); |
| 1787 } | 1786 } |
| 1788 | 1787 |
| 1789 bool start_logging = FLAG_log || FLAG_log_runtime || FLAG_log_api | 1788 bool start_logging = FLAG_log || FLAG_log_runtime || FLAG_log_api |
| 1790 || FLAG_log_code || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect | 1789 || FLAG_log_code || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect |
| 1791 || FLAG_log_regexp || FLAG_log_state_changes || FLAG_ll_prof | 1790 || FLAG_log_regexp || FLAG_log_state_changes || FLAG_ll_prof |
| 1792 || FLAG_log_timer_events; | 1791 || FLAG_log_internal_timer_events; |
| 1793 | 1792 |
| 1794 if (start_logging) { | 1793 if (start_logging) { |
| 1795 logging_nesting_ = 1; | 1794 logging_nesting_ = 1; |
| 1796 } | 1795 } |
| 1797 | 1796 |
| 1798 if (FLAG_prof) { | 1797 if (FLAG_prof) { |
| 1799 profiler_ = new Profiler(isolate); | 1798 profiler_ = new Profiler(isolate); |
| 1800 if (!FLAG_prof_auto) { | 1799 if (!FLAG_prof_auto) { |
| 1801 profiler_->pause(); | 1800 profiler_->pause(); |
| 1802 } else { | 1801 } else { |
| 1803 logging_nesting_ = 1; | 1802 logging_nesting_ = 1; |
| 1804 } | 1803 } |
| 1805 if (!FLAG_prof_lazy) { | 1804 if (!FLAG_prof_lazy) { |
| 1806 profiler_->Engage(); | 1805 profiler_->Engage(); |
| 1807 } | 1806 } |
| 1808 } | 1807 } |
| 1809 | 1808 |
| 1810 if (FLAG_log_timer_events) epoch_ = OS::Ticks(); | 1809 if (FLAG_log_internal_timer_events || FLAG_prof) epoch_ = OS::Ticks(); |
| 1811 | 1810 |
| 1812 return true; | 1811 return true; |
| 1813 } | 1812 } |
| 1814 | 1813 |
| 1815 | 1814 |
| 1816 void Logger::SetCodeEventHandler(uint32_t options, | 1815 void Logger::SetCodeEventHandler(uint32_t options, |
| 1817 JitCodeEventHandler event_handler) { | 1816 JitCodeEventHandler event_handler) { |
| 1818 code_event_handler_ = event_handler; | 1817 code_event_handler_ = event_handler; |
| 1819 | 1818 |
| 1820 if (code_event_handler_ != NULL && (options & kJitCodeEventEnumExisting)) { | 1819 if (code_event_handler_ != NULL && (options & kJitCodeEventEnumExisting)) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 1931 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
| 1933 ASSERT(sampler->IsActive()); | 1932 ASSERT(sampler->IsActive()); |
| 1934 ScopedLock lock(active_samplers_mutex); | 1933 ScopedLock lock(active_samplers_mutex); |
| 1935 ASSERT(active_samplers_ != NULL); | 1934 ASSERT(active_samplers_ != NULL); |
| 1936 bool removed = active_samplers_->RemoveElement(sampler); | 1935 bool removed = active_samplers_->RemoveElement(sampler); |
| 1937 ASSERT(removed); | 1936 ASSERT(removed); |
| 1938 USE(removed); | 1937 USE(removed); |
| 1939 } | 1938 } |
| 1940 | 1939 |
| 1941 } } // namespace v8::internal | 1940 } } // namespace v8::internal |
| OLD | NEW |