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" |
11 | 11 |
12 #include "src/bailout-reason.h" | 12 #include "src/bailout-reason.h" |
13 #include "src/base/platform/platform.h" | 13 #include "src/base/platform/platform.h" |
14 #include "src/bootstrapper.h" | 14 #include "src/bootstrapper.h" |
15 #include "src/code-stubs.h" | 15 #include "src/code-stubs.h" |
16 #include "src/cpu-profiler.h" | 16 #include "src/cpu-profiler.h" |
17 #include "src/deoptimizer.h" | 17 #include "src/deoptimizer.h" |
18 #include "src/global-handles.h" | 18 #include "src/global-handles.h" |
19 #include "src/log-inl.h" | 19 #include "src/log-inl.h" |
20 #include "src/log-utils.h" | 20 #include "src/log-utils.h" |
21 #include "src/macro-assembler.h" | 21 #include "src/macro-assembler.h" |
22 #include "src/perf-jit.h" | |
23 #include "src/runtime-profiler.h" | 22 #include "src/runtime-profiler.h" |
24 #include "src/string-stream.h" | 23 #include "src/string-stream.h" |
25 #include "src/vm-state-inl.h" | 24 #include "src/vm-state-inl.h" |
26 | 25 |
27 namespace v8 { | 26 namespace v8 { |
28 namespace internal { | 27 namespace internal { |
29 | 28 |
30 | 29 |
31 #define DECLARE_EVENT(ignore1, name) name, | 30 #define DECLARE_EVENT(ignore1, name) name, |
32 static const char* const kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { | 31 static const char* const kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 // | 770 // |
772 | 771 |
773 Logger::Logger(Isolate* isolate) | 772 Logger::Logger(Isolate* isolate) |
774 : isolate_(isolate), | 773 : isolate_(isolate), |
775 ticker_(NULL), | 774 ticker_(NULL), |
776 profiler_(NULL), | 775 profiler_(NULL), |
777 log_events_(NULL), | 776 log_events_(NULL), |
778 is_logging_(false), | 777 is_logging_(false), |
779 log_(new Log(this)), | 778 log_(new Log(this)), |
780 perf_basic_logger_(NULL), | 779 perf_basic_logger_(NULL), |
781 perf_jit_logger_(NULL), | |
782 ll_logger_(NULL), | 780 ll_logger_(NULL), |
783 jit_logger_(NULL), | 781 jit_logger_(NULL), |
784 listeners_(5), | 782 listeners_(5), |
785 is_initialized_(false) { | 783 is_initialized_(false) { |
786 } | 784 } |
787 | 785 |
788 | 786 |
789 Logger::~Logger() { | 787 Logger::~Logger() { |
790 delete log_; | 788 delete log_; |
791 } | 789 } |
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 std::ostringstream log_file_name; | 1810 std::ostringstream log_file_name; |
1813 PrepareLogFileName(log_file_name, isolate, FLAG_logfile); | 1811 PrepareLogFileName(log_file_name, isolate, FLAG_logfile); |
1814 log_->Initialize(log_file_name.str().c_str()); | 1812 log_->Initialize(log_file_name.str().c_str()); |
1815 | 1813 |
1816 | 1814 |
1817 if (FLAG_perf_basic_prof) { | 1815 if (FLAG_perf_basic_prof) { |
1818 perf_basic_logger_ = new PerfBasicLogger(); | 1816 perf_basic_logger_ = new PerfBasicLogger(); |
1819 addCodeEventListener(perf_basic_logger_); | 1817 addCodeEventListener(perf_basic_logger_); |
1820 } | 1818 } |
1821 | 1819 |
1822 if (FLAG_perf_jit_prof) { | |
1823 perf_jit_logger_ = new PerfJitLogger(); | |
1824 addCodeEventListener(perf_jit_logger_); | |
1825 } | |
1826 | |
1827 if (FLAG_ll_prof) { | 1820 if (FLAG_ll_prof) { |
1828 ll_logger_ = new LowLevelLogger(log_file_name.str().c_str()); | 1821 ll_logger_ = new LowLevelLogger(log_file_name.str().c_str()); |
1829 addCodeEventListener(ll_logger_); | 1822 addCodeEventListener(ll_logger_); |
1830 } | 1823 } |
1831 | 1824 |
1832 ticker_ = new Ticker(isolate, kSamplingIntervalMs); | 1825 ticker_ = new Ticker(isolate, kSamplingIntervalMs); |
1833 | 1826 |
1834 if (Log::InitLogAtStart()) { | 1827 if (Log::InitLogAtStart()) { |
1835 is_logging_ = true; | 1828 is_logging_ = true; |
1836 } | 1829 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1885 | 1878 |
1886 delete ticker_; | 1879 delete ticker_; |
1887 ticker_ = NULL; | 1880 ticker_ = NULL; |
1888 | 1881 |
1889 if (perf_basic_logger_) { | 1882 if (perf_basic_logger_) { |
1890 removeCodeEventListener(perf_basic_logger_); | 1883 removeCodeEventListener(perf_basic_logger_); |
1891 delete perf_basic_logger_; | 1884 delete perf_basic_logger_; |
1892 perf_basic_logger_ = NULL; | 1885 perf_basic_logger_ = NULL; |
1893 } | 1886 } |
1894 | 1887 |
1895 if (perf_jit_logger_) { | |
1896 removeCodeEventListener(perf_jit_logger_); | |
1897 delete perf_jit_logger_; | |
1898 perf_jit_logger_ = NULL; | |
1899 } | |
1900 | |
1901 if (ll_logger_) { | 1888 if (ll_logger_) { |
1902 removeCodeEventListener(ll_logger_); | 1889 removeCodeEventListener(ll_logger_); |
1903 delete ll_logger_; | 1890 delete ll_logger_; |
1904 ll_logger_ = NULL; | 1891 ll_logger_ = NULL; |
1905 } | 1892 } |
1906 | 1893 |
1907 if (jit_logger_) { | 1894 if (jit_logger_) { |
1908 removeCodeEventListener(jit_logger_); | 1895 removeCodeEventListener(jit_logger_); |
1909 delete jit_logger_; | 1896 delete jit_logger_; |
1910 jit_logger_ = NULL; | 1897 jit_logger_ = NULL; |
1911 } | 1898 } |
1912 | 1899 |
1913 return log_->Close(); | 1900 return log_->Close(); |
1914 } | 1901 } |
1915 | 1902 |
1916 } } // namespace v8::internal | 1903 } } // namespace v8::internal |
OLD | NEW |