Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: src/log.cc

Issue 827993003: Integrate Chrome tracing with V8 (WIP) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cleanup Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/log.h ('k') | src/log-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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" 22 #include "src/perf-jit.h"
23 #include "src/runtime-profiler.h" 23 #include "src/runtime-profiler.h"
24 #include "src/serialize.h" 24 #include "src/serialize.h"
25 #include "src/string-stream.h" 25 #include "src/string-stream.h"
26 #include "src/tracing/trace-event.h"
26 #include "src/vm-state-inl.h" 27 #include "src/vm-state-inl.h"
27 28
28 namespace v8 { 29 namespace v8 {
29 namespace internal { 30 namespace internal {
30 31
31 32
32 #define DECLARE_EVENT(ignore1, name) name, 33 #define DECLARE_EVENT(ignore1, name) name,
33 static const char* const kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = { 34 static const char* const kLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = {
34 LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT) 35 LOG_EVENTS_AND_TAGS_LIST(DECLARE_EVENT)
35 }; 36 };
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 Log::MessageBuilder msg(log_); 936 Log::MessageBuilder msg(log_);
936 int since_epoch = static_cast<int>(timer_.Elapsed().InMicroseconds()); 937 int since_epoch = static_cast<int>(timer_.Elapsed().InMicroseconds());
937 const char* format = (se == START) ? "timer-event-start,\"%s\",%ld" 938 const char* format = (se == START) ? "timer-event-start,\"%s\",%ld"
938 : "timer-event-end,\"%s\",%ld"; 939 : "timer-event-end,\"%s\",%ld";
939 msg.Append(format, name, since_epoch); 940 msg.Append(format, name, since_epoch);
940 msg.WriteToLogFile(); 941 msg.WriteToLogFile();
941 } 942 }
942 943
943 944
944 void Logger::EnterExternal(Isolate* isolate) { 945 void Logger::EnterExternal(Isolate* isolate) {
946 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("V8::External"),
947 TimerEventExternal::name());
945 LOG(isolate, TimerEvent(START, TimerEventExternal::name())); 948 LOG(isolate, TimerEvent(START, TimerEventExternal::name()));
946 DCHECK(isolate->current_vm_state() == JS); 949 DCHECK(isolate->current_vm_state() == JS);
947 isolate->set_current_vm_state(EXTERNAL); 950 isolate->set_current_vm_state(EXTERNAL);
948 } 951 }
949 952
950 953
951 void Logger::LeaveExternal(Isolate* isolate) { 954 void Logger::LeaveExternal(Isolate* isolate) {
955 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("V8::External"),
956 TimerEventExternal::name());
952 LOG(isolate, TimerEvent(END, TimerEventExternal::name())); 957 LOG(isolate, TimerEvent(END, TimerEventExternal::name()));
953 DCHECK(isolate->current_vm_state() == EXTERNAL); 958 DCHECK(isolate->current_vm_state() == EXTERNAL);
954 isolate->set_current_vm_state(JS); 959 isolate->set_current_vm_state(JS);
955 } 960 }
956 961
957 962
958 template <class TimerEvent> 963 template <class TimerEvent>
959 void TimerEventScope<TimerEvent>::LogTimerEvent(Logger::StartEnd se) { 964 void TimerEventScope<TimerEvent>::LogTimerEvent(Logger::StartEnd se) {
960 Logger::CallEventLogger(isolate_, TimerEvent::name(), se, 965 Logger::CallEventLogger(isolate_, TimerEvent::name(), se,
961 TimerEvent::expose_to_api()); 966 TimerEvent::overhead());
962 } 967 }
963 968
964 969
965 // Instantiate template methods. 970 // Instantiate template methods.
966 #define V(TimerName, expose) \ 971 #define V(TimerName, overhead) \
967 template void TimerEventScope<TimerEvent##TimerName>::LogTimerEvent( \ 972 template void TimerEventScope<TimerEvent##TimerName>::LogTimerEvent( \
968 Logger::StartEnd se); 973 Logger::StartEnd se);
969 TIMER_EVENTS_LIST(V) 974 TIMER_EVENTS_LIST(V)
970 #undef V 975 #undef V
971 976
972 977
973 void Logger::LogRegExpSource(Handle<JSRegExp> regexp) { 978 void Logger::LogRegExpSource(Handle<JSRegExp> regexp) {
974 // Prints "/" + re.source + "/" + 979 // Prints "/" + re.source + "/" +
975 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"") 980 // (re.global?"g":"") + (re.ignorecase?"i":"") + (re.multiline?"m":"")
976 Log::MessageBuilder msg(log_); 981 Log::MessageBuilder msg(log_);
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 if (jit_logger_) { 1936 if (jit_logger_) {
1932 removeCodeEventListener(jit_logger_); 1937 removeCodeEventListener(jit_logger_);
1933 delete jit_logger_; 1938 delete jit_logger_;
1934 jit_logger_ = NULL; 1939 jit_logger_ = NULL;
1935 } 1940 }
1936 1941
1937 return log_->Close(); 1942 return log_->Close();
1938 } 1943 }
1939 1944
1940 } } // namespace v8::internal 1945 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.h ('k') | src/log-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698