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

Side by Side Diff: src/tracing/trace-event.h

Issue 2063853002: Reland: Add a trace-event for each runtime-stats timer (CL 2052523002) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: The reland fix: Use an atomic variable Created 4 years, 6 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/objects.cc ('k') | src/tracing/trace-event.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 SRC_TRACING_TRACE_EVENT_H_ 5 #ifndef SRC_TRACING_TRACE_EVENT_H_
6 #define SRC_TRACING_TRACE_EVENT_H_ 6 #define SRC_TRACING_TRACE_EVENT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/trace_event/common/trace_event_common.h" 10 #include "base/trace_event/common/trace_event_common.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Set the duration field of a COMPLETE trace event. 126 // Set the duration field of a COMPLETE trace event.
127 // void TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( 127 // void TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
128 // const uint8_t* category_group_enabled, 128 // const uint8_t* category_group_enabled,
129 // const char* name, 129 // const char* name,
130 // uint64_t id) 130 // uint64_t id)
131 #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \ 131 #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \
132 v8::internal::tracing::TraceEventHelper::GetCurrentPlatform() \ 132 v8::internal::tracing::TraceEventHelper::GetCurrentPlatform() \
133 ->UpdateTraceEventDuration 133 ->UpdateTraceEventDuration
134 134
135 // Defines atomic operations used internally by the tracing system. 135 // Defines atomic operations used internally by the tracing system.
136 #define TRACE_EVENT_API_ATOMIC_BYTE v8::base::Atomic8
136 #define TRACE_EVENT_API_ATOMIC_WORD v8::base::AtomicWord 137 #define TRACE_EVENT_API_ATOMIC_WORD v8::base::AtomicWord
137 #define TRACE_EVENT_API_ATOMIC_LOAD(var) v8::base::NoBarrier_Load(&(var)) 138 #define TRACE_EVENT_API_ATOMIC_LOAD(var) v8::base::NoBarrier_Load(&(var))
138 #define TRACE_EVENT_API_ATOMIC_STORE(var, value) \ 139 #define TRACE_EVENT_API_ATOMIC_STORE(var, value) \
139 v8::base::NoBarrier_Store(&(var), (value)) 140 v8::base::NoBarrier_Store(&(var), (value))
140 141
141 // The thread buckets for the sampling profiler. 142 // The thread buckets for the sampling profiler.
142 extern TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3]; 143 extern TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
143 144
144 #define TRACE_EVENT_API_THREAD_BUCKET(thread_bucket) \ 145 #define TRACE_EVENT_API_THREAD_BUCKET(thread_bucket) \
145 g_trace_state[thread_bucket] 146 g_trace_state[thread_bucket]
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 } 588 }
588 589
589 private: 590 private:
590 const char* previous_state_; 591 const char* previous_state_;
591 }; 592 };
592 593
593 } // namespace tracing 594 } // namespace tracing
594 } // namespace internal 595 } // namespace internal
595 } // namespace v8 596 } // namespace v8
596 597
598 // V8 Specific macros
599
600 // Runtime calls happen at a high frequency, the following set of macros
601 // minimizes the tracing overhead of those calls. A global variable is set
602 // when top level V8 API is called, and checked per runtime call.
603 extern TRACE_EVENT_API_ATOMIC_BYTE g_runtime_calls_trace_enabled;
604
605 #define TRACE_IS_RUNTIME_CALLS_TRACING_ENABLED() \
606 TRACE_EVENT_API_ATOMIC_LOAD(g_runtime_calls_trace_enabled)
607
608 #define TRACE_CHECK_AND_SET_RUNTIME_CALLS_TRACING() \
609 do { \
610 INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO( \
611 TRACE_DISABLED_BY_DEFAULT("v8.runtime")); \
612 TRACE_EVENT_API_ATOMIC_STORE(g_runtime_calls_trace_enabled, \
613 INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE() ? 1 \
614 : 0); \
615 } while (0)
616
617 #define TRACE_RUNTIME_CALL(name) \
618 do { \
619 if (V8_UNLIKELY(TRACE_IS_RUNTIME_CALLS_TRACING_ENABLED())) { \
620 INTERNAL_TRACE_EVENT_ADD_SCOPED(TRACE_DISABLED_BY_DEFAULT("v8.runtime"), \
621 name); \
622 } \
623 } while (0)
624
597 #endif // SRC_TRACING_TRACE_EVENT_H_ 625 #endif // SRC_TRACING_TRACE_EVENT_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/tracing/trace-event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698