OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/log.h" | 5 #include "src/log.h" |
6 | 6 |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 ApiEvent("api,check-security,undefined"); | 894 ApiEvent("api,check-security,undefined"); |
895 } else { | 895 } else { |
896 ApiEvent("api,check-security,['no-name']"); | 896 ApiEvent("api,check-security,['no-name']"); |
897 } | 897 } |
898 } | 898 } |
899 | 899 |
900 | 900 |
901 void Logger::SharedLibraryEvent(const std::string& library_path, | 901 void Logger::SharedLibraryEvent(const std::string& library_path, |
902 uintptr_t start, | 902 uintptr_t start, |
903 uintptr_t end) { | 903 uintptr_t end) { |
904 if (!log_->IsEnabled() || !FLAG_prof) return; | 904 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; |
905 Log::MessageBuilder msg(log_); | 905 Log::MessageBuilder msg(log_); |
906 msg.Append("shared-library,\"%s\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR, | 906 msg.Append("shared-library,\"%s\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR, |
907 library_path.c_str(), start, end); | 907 library_path.c_str(), start, end); |
908 msg.WriteToLogFile(); | 908 msg.WriteToLogFile(); |
909 } | 909 } |
910 | 910 |
911 | 911 |
912 void Logger::CodeDeoptEvent(Code* code) { | 912 void Logger::CodeDeoptEvent(Code* code) { |
913 if (!log_->IsEnabled()) return; | 913 if (!log_->IsEnabled()) return; |
914 DCHECK(FLAG_log_internal_timer_events); | 914 DCHECK(FLAG_log_internal_timer_events); |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 char* parameter_string = s.Finalize(); | 1507 char* parameter_string = s.Finalize(); |
1508 Log::MessageBuilder msg(log_); | 1508 Log::MessageBuilder msg(log_); |
1509 msg.Append("debug-queue-event,%s,%15.3f,%s", event_type, | 1509 msg.Append("debug-queue-event,%s,%15.3f,%s", event_type, |
1510 base::OS::TimeCurrentMillis(), parameter_string); | 1510 base::OS::TimeCurrentMillis(), parameter_string); |
1511 DeleteArray(parameter_string); | 1511 DeleteArray(parameter_string); |
1512 msg.WriteToLogFile(); | 1512 msg.WriteToLogFile(); |
1513 } | 1513 } |
1514 | 1514 |
1515 | 1515 |
1516 void Logger::TickEvent(TickSample* sample, bool overflow) { | 1516 void Logger::TickEvent(TickSample* sample, bool overflow) { |
1517 if (!log_->IsEnabled() || !FLAG_prof) return; | 1517 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; |
1518 Log::MessageBuilder msg(log_); | 1518 Log::MessageBuilder msg(log_); |
1519 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); | 1519 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); |
1520 msg.AppendAddress(sample->pc); | 1520 msg.AppendAddress(sample->pc); |
1521 msg.Append(",%ld", static_cast<int>(timer_.Elapsed().InMicroseconds())); | 1521 msg.Append(",%ld", static_cast<int>(timer_.Elapsed().InMicroseconds())); |
1522 if (sample->has_external_callback) { | 1522 if (sample->has_external_callback) { |
1523 msg.Append(",1,"); | 1523 msg.Append(",1,"); |
1524 msg.AppendAddress(sample->external_callback); | 1524 msg.AppendAddress(sample->external_callback); |
1525 } else { | 1525 } else { |
1526 msg.Append(",0,"); | 1526 msg.Append(",0,"); |
1527 msg.AppendAddress(sample->tos); | 1527 msg.AppendAddress(sample->tos); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 ll_logger_ = new LowLevelLogger(log_file_name.str().c_str()); | 1852 ll_logger_ = new LowLevelLogger(log_file_name.str().c_str()); |
1853 addCodeEventListener(ll_logger_); | 1853 addCodeEventListener(ll_logger_); |
1854 } | 1854 } |
1855 | 1855 |
1856 ticker_ = new Ticker(isolate, kSamplingIntervalMs); | 1856 ticker_ = new Ticker(isolate, kSamplingIntervalMs); |
1857 | 1857 |
1858 if (Log::InitLogAtStart()) { | 1858 if (Log::InitLogAtStart()) { |
1859 is_logging_ = true; | 1859 is_logging_ = true; |
1860 } | 1860 } |
1861 | 1861 |
1862 if (FLAG_log_internal_timer_events || FLAG_prof) timer_.Start(); | 1862 if (FLAG_log_internal_timer_events || FLAG_prof_cpp) timer_.Start(); |
1863 | 1863 |
1864 if (FLAG_prof) { | 1864 if (FLAG_prof_cpp) { |
1865 profiler_ = new Profiler(isolate); | 1865 profiler_ = new Profiler(isolate); |
1866 is_logging_ = true; | 1866 is_logging_ = true; |
1867 profiler_->Engage(); | 1867 profiler_->Engage(); |
1868 } | 1868 } |
1869 | 1869 |
1870 return true; | 1870 return true; |
1871 } | 1871 } |
1872 | 1872 |
1873 | 1873 |
1874 void Logger::SetCodeEventHandler(uint32_t options, | 1874 void Logger::SetCodeEventHandler(uint32_t options, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1931 if (jit_logger_) { | 1931 if (jit_logger_) { |
1932 removeCodeEventListener(jit_logger_); | 1932 removeCodeEventListener(jit_logger_); |
1933 delete jit_logger_; | 1933 delete jit_logger_; |
1934 jit_logger_ = NULL; | 1934 jit_logger_ = NULL; |
1935 } | 1935 } |
1936 | 1936 |
1937 return log_->Close(); | 1937 return log_->Close(); |
1938 } | 1938 } |
1939 | 1939 |
1940 } } // namespace v8::internal | 1940 } } // namespace v8::internal |
OLD | NEW |