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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 Isolate* isolate = Isolate::Current(); | 1780 Isolate* isolate = Isolate::Current(); |
1782 ticker_ = new Ticker(isolate, kSamplingIntervalMs); | 1781 ticker_ = new Ticker(isolate, kSamplingIntervalMs); |
1783 | 1782 |
1784 if (FLAG_sliding_state_window && sliding_state_window_ == NULL) { | 1783 if (FLAG_sliding_state_window && sliding_state_window_ == NULL) { |
1785 sliding_state_window_ = new SlidingStateWindow(isolate); | 1784 sliding_state_window_ = new SlidingStateWindow(isolate); |
1786 } | 1785 } |
1787 | 1786 |
1788 bool start_logging = FLAG_log || FLAG_log_runtime || FLAG_log_api | 1787 bool start_logging = FLAG_log || FLAG_log_runtime || FLAG_log_api |
1789 || FLAG_log_code || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect | 1788 || FLAG_log_code || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect |
1790 || FLAG_log_regexp || FLAG_log_state_changes || FLAG_ll_prof | 1789 || FLAG_log_regexp || FLAG_log_state_changes || FLAG_ll_prof |
1791 || FLAG_log_timer_events; | 1790 || FLAG_log_internal_timer_events; |
1792 | 1791 |
1793 if (start_logging) { | 1792 if (start_logging) { |
1794 logging_nesting_ = 1; | 1793 logging_nesting_ = 1; |
1795 } | 1794 } |
1796 | 1795 |
1797 if (FLAG_prof) { | 1796 if (FLAG_prof) { |
1798 profiler_ = new Profiler(isolate); | 1797 profiler_ = new Profiler(isolate); |
1799 if (!FLAG_prof_auto) { | 1798 if (!FLAG_prof_auto) { |
1800 profiler_->pause(); | 1799 profiler_->pause(); |
1801 } else { | 1800 } else { |
1802 logging_nesting_ = 1; | 1801 logging_nesting_ = 1; |
1803 } | 1802 } |
1804 if (!FLAG_prof_lazy) { | 1803 if (!FLAG_prof_lazy) { |
1805 profiler_->Engage(); | 1804 profiler_->Engage(); |
1806 } | 1805 } |
1807 } | 1806 } |
1808 | 1807 |
1809 if (FLAG_log_timer_events) epoch_ = OS::Ticks(); | 1808 if (FLAG_log_internal_timer_events || FLAG_prof) epoch_ = OS::Ticks(); |
1810 | 1809 |
1811 return true; | 1810 return true; |
1812 } | 1811 } |
1813 | 1812 |
1814 | 1813 |
1815 void Logger::SetCodeEventHandler(uint32_t options, | 1814 void Logger::SetCodeEventHandler(uint32_t options, |
1816 JitCodeEventHandler event_handler) { | 1815 JitCodeEventHandler event_handler) { |
1817 code_event_handler_ = event_handler; | 1816 code_event_handler_ = event_handler; |
1818 | 1817 |
1819 if (code_event_handler_ != NULL && (options & kJitCodeEventEnumExisting)) { | 1818 if (code_event_handler_ != NULL && (options & kJitCodeEventEnumExisting)) { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1931 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { | 1930 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { |
1932 ASSERT(sampler->IsActive()); | 1931 ASSERT(sampler->IsActive()); |
1933 ScopedLock lock(active_samplers_mutex); | 1932 ScopedLock lock(active_samplers_mutex); |
1934 ASSERT(active_samplers_ != NULL); | 1933 ASSERT(active_samplers_ != NULL); |
1935 bool removed = active_samplers_->RemoveElement(sampler); | 1934 bool removed = active_samplers_->RemoveElement(sampler); |
1936 ASSERT(removed); | 1935 ASSERT(removed); |
1937 USE(removed); | 1936 USE(removed); |
1938 } | 1937 } |
1939 | 1938 |
1940 } } // namespace v8::internal | 1939 } } // namespace v8::internal |
OLD | NEW |