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

Side by Side Diff: src/log-inl.h

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.cc ('k') | src/tracing/event-tracer.cc » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 #ifndef V8_LOG_INL_H_ 5 #ifndef V8_LOG_INL_H_
6 #define V8_LOG_INL_H_ 6 #define V8_LOG_INL_H_
7 7
8 #include "src/log.h" 8 #include "src/log.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/tracing/trace-event.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 14
14 Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag, 15 Logger::LogEventsAndTags Logger::ToNativeByScript(Logger::LogEventsAndTags tag,
15 Script* script) { 16 Script* script) {
16 if ((tag == FUNCTION_TAG || tag == LAZY_COMPILE_TAG || tag == SCRIPT_TAG) 17 if ((tag == FUNCTION_TAG || tag == LAZY_COMPILE_TAG || tag == SCRIPT_TAG)
17 && script->type()->value() == Script::TYPE_NATIVE) { 18 && script->type()->value() == Script::TYPE_NATIVE) {
18 switch (tag) { 19 switch (tag) {
19 case FUNCTION_TAG: return NATIVE_FUNCTION_TAG; 20 case FUNCTION_TAG: return NATIVE_FUNCTION_TAG;
20 case LAZY_COMPILE_TAG: return NATIVE_LAZY_COMPILE_TAG; 21 case LAZY_COMPILE_TAG: return NATIVE_LAZY_COMPILE_TAG;
21 case SCRIPT_TAG: return NATIVE_SCRIPT_TAG; 22 case SCRIPT_TAG: return NATIVE_SCRIPT_TAG;
22 default: return tag; 23 default: return tag;
23 } 24 }
24 } else { 25 } else {
25 return tag; 26 return tag;
26 } 27 }
27 } 28 }
28 29
29 30
30 void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se, 31 void Logger::CallEventLogger(Isolate* isolate, const char* name, StartEnd se,
31 bool expose_to_api) { 32 Overhead overhead) {
32 if (isolate->event_logger() != NULL) { 33 if (overhead == Overhead::NORMAL) {
33 if (isolate->event_logger() == DefaultEventLoggerSentinel) { 34 if (se == START) {
34 LOG(isolate, TimerEvent(se, name)); 35 TRACE_EVENT_BEGIN0("V8", name);
35 } else if (expose_to_api) { 36 } else {
36 isolate->event_logger()(name, se); 37 TRACE_EVENT_END0("V8", name);
38 }
39 } else if (overhead == Overhead::LOW) {
40 if (se == START) {
41 TRACE_EVENT_BEGIN0("benchmark", name);
42 } else {
43 TRACE_EVENT_END0("benchmark", name);
44 }
45 } else {
46 if (se == START) {
47 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("V8Disabled"), name);
48 } else {
49 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("V8Disabled"), name);
37 } 50 }
38 } 51 }
39 } 52 }
40 } } // namespace v8::internal 53 } } // namespace v8::internal
41 54
42 #endif // V8_LOG_INL_H_ 55 #endif // V8_LOG_INL_H_
OLDNEW
« no previous file with comments | « src/log.cc ('k') | src/tracing/event-tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698