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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 ApiEvent("api,check-security,undefined"); | 896 ApiEvent("api,check-security,undefined"); |
897 } else { | 897 } else { |
898 ApiEvent("api,check-security,['no-name']"); | 898 ApiEvent("api,check-security,['no-name']"); |
899 } | 899 } |
900 } | 900 } |
901 | 901 |
902 | 902 |
903 void Logger::SharedLibraryEvent(const std::string& library_path, | 903 void Logger::SharedLibraryEvent(const std::string& library_path, |
904 uintptr_t start, | 904 uintptr_t start, |
905 uintptr_t end) { | 905 uintptr_t end) { |
906 if (!log_->IsEnabled() || !FLAG_prof) return; | 906 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; |
907 Log::MessageBuilder msg(log_); | 907 Log::MessageBuilder msg(log_); |
908 msg.Append("shared-library,\"%s\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR, | 908 msg.Append("shared-library,\"%s\",0x%08" V8PRIxPTR ",0x%08" V8PRIxPTR, |
909 library_path.c_str(), start, end); | 909 library_path.c_str(), start, end); |
910 msg.WriteToLogFile(); | 910 msg.WriteToLogFile(); |
911 } | 911 } |
912 | 912 |
913 | 913 |
914 void Logger::CodeDeoptEvent(Code* code) { | 914 void Logger::CodeDeoptEvent(Code* code) { |
915 if (!log_->IsEnabled()) return; | 915 if (!log_->IsEnabled()) return; |
916 DCHECK(FLAG_log_internal_timer_events); | 916 DCHECK(FLAG_log_internal_timer_events); |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 char* parameter_string = s.Finalize(); | 1509 char* parameter_string = s.Finalize(); |
1510 Log::MessageBuilder msg(log_); | 1510 Log::MessageBuilder msg(log_); |
1511 msg.Append("debug-queue-event,%s,%15.3f,%s", event_type, | 1511 msg.Append("debug-queue-event,%s,%15.3f,%s", event_type, |
1512 base::OS::TimeCurrentMillis(), parameter_string); | 1512 base::OS::TimeCurrentMillis(), parameter_string); |
1513 DeleteArray(parameter_string); | 1513 DeleteArray(parameter_string); |
1514 msg.WriteToLogFile(); | 1514 msg.WriteToLogFile(); |
1515 } | 1515 } |
1516 | 1516 |
1517 | 1517 |
1518 void Logger::TickEvent(TickSample* sample, bool overflow) { | 1518 void Logger::TickEvent(TickSample* sample, bool overflow) { |
1519 if (!log_->IsEnabled() || !FLAG_prof) return; | 1519 if (!log_->IsEnabled() || !FLAG_prof_cpp) return; |
1520 Log::MessageBuilder msg(log_); | 1520 Log::MessageBuilder msg(log_); |
1521 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); | 1521 msg.Append("%s,", kLogEventsNames[TICK_EVENT]); |
1522 msg.AppendAddress(sample->pc); | 1522 msg.AppendAddress(sample->pc); |
1523 msg.Append(",%ld", static_cast<int>(timer_.Elapsed().InMicroseconds())); | 1523 msg.Append(",%ld", static_cast<int>(timer_.Elapsed().InMicroseconds())); |
1524 if (sample->has_external_callback) { | 1524 if (sample->has_external_callback) { |
1525 msg.Append(",1,"); | 1525 msg.Append(",1,"); |
1526 msg.AppendAddress(sample->external_callback); | 1526 msg.AppendAddress(sample->external_callback); |
1527 } else { | 1527 } else { |
1528 msg.Append(",0,"); | 1528 msg.Append(",0,"); |
1529 msg.AppendAddress(sample->tos); | 1529 msg.AppendAddress(sample->tos); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 ll_logger_ = new LowLevelLogger(log_file_name.str().c_str()); | 1854 ll_logger_ = new LowLevelLogger(log_file_name.str().c_str()); |
1855 addCodeEventListener(ll_logger_); | 1855 addCodeEventListener(ll_logger_); |
1856 } | 1856 } |
1857 | 1857 |
1858 ticker_ = new Ticker(isolate, kSamplingIntervalMs); | 1858 ticker_ = new Ticker(isolate, kSamplingIntervalMs); |
1859 | 1859 |
1860 if (Log::InitLogAtStart()) { | 1860 if (Log::InitLogAtStart()) { |
1861 is_logging_ = true; | 1861 is_logging_ = true; |
1862 } | 1862 } |
1863 | 1863 |
1864 if (FLAG_log_internal_timer_events || FLAG_prof) timer_.Start(); | 1864 if (FLAG_log_internal_timer_events || FLAG_prof_cpp) timer_.Start(); |
1865 | 1865 |
1866 if (FLAG_prof) { | 1866 if (FLAG_prof_cpp) { |
1867 profiler_ = new Profiler(isolate); | 1867 profiler_ = new Profiler(isolate); |
1868 is_logging_ = true; | 1868 is_logging_ = true; |
1869 profiler_->Engage(); | 1869 profiler_->Engage(); |
1870 } | 1870 } |
1871 | 1871 |
1872 return true; | 1872 return true; |
1873 } | 1873 } |
1874 | 1874 |
1875 | 1875 |
1876 void Logger::SetCodeEventHandler(uint32_t options, | 1876 void Logger::SetCodeEventHandler(uint32_t options, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 if (jit_logger_) { | 1933 if (jit_logger_) { |
1934 removeCodeEventListener(jit_logger_); | 1934 removeCodeEventListener(jit_logger_); |
1935 delete jit_logger_; | 1935 delete jit_logger_; |
1936 jit_logger_ = NULL; | 1936 jit_logger_ = NULL; |
1937 } | 1937 } |
1938 | 1938 |
1939 return log_->Close(); | 1939 return log_->Close(); |
1940 } | 1940 } |
1941 | 1941 |
1942 } } // namespace v8::internal | 1942 } } // namespace v8::internal |
OLD | NEW |