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

Side by Side Diff: src/core/SkTraceEvent.h

Issue 996763002: Clean up SkDynamicAnnotations. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: review Created 5 years, 9 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/core/SkLazyFnPtr.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 Google Inc. 1 // Copyright (c) 2014 Google Inc.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 // This header file defines the set of trace_event macros without specifying 6 // This header file defines the set of trace_event macros without specifying
7 // how the events actually get collected and stored. If you need to expose trace 7 // how the events actually get collected and stored. If you need to expose trace
8 // events to some other universe, you can copy-and-paste this file as well as 8 // events to some other universe, you can copy-and-paste this file as well as
9 // trace_event.h, modifying the macros contained there as necessary for the 9 // trace_event.h, modifying the macros contained there as necessary for the
10 // target platform. The end result is that multiple libraries can funnel events 10 // target platform. The end result is that multiple libraries can funnel events
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // because AddTraceEvent is threadsafe internally and checks the enabled state 154 // because AddTraceEvent is threadsafe internally and checks the enabled state
155 // again under lock. 155 // again under lock.
156 // 156 //
157 // Without the use of these static category pointers and enabled flags all 157 // Without the use of these static category pointers and enabled flags all
158 // trace points would carry a significant performance cost of acquiring a lock 158 // trace points would carry a significant performance cost of acquiring a lock
159 // and resolving the category. 159 // and resolving the category.
160 160
161 #ifndef SkTraceEvent_DEFINED 161 #ifndef SkTraceEvent_DEFINED
162 #define SkTraceEvent_DEFINED 162 #define SkTraceEvent_DEFINED
163 163
164 #include "SkAtomics.h"
164 #include "SkEventTracer.h" 165 #include "SkEventTracer.h"
165 #include "SkDynamicAnnotations.h"
166 166
167 // By default, const char* argument values are assumed to have long-lived scope 167 // By default, const char* argument values are assumed to have long-lived scope
168 // and will not be copied. Use this macro to force a const char* to be copied. 168 // and will not be copied. Use this macro to force a const char* to be copied.
169 #define TRACE_STR_COPY(str) \ 169 #define TRACE_STR_COPY(str) \
170 skia::tracing_internals::TraceStringWithCopy(str) 170 skia::tracing_internals::TraceStringWithCopy(str)
171 171
172 // By default, uint64 ID argument values are not mangled with the Process ID in 172 // By default, uint64 ID argument values are not mangled with the Process ID in
173 // TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling. 173 // TRACE_EVENT_ASYNC macros. Use this macro to force Process ID mangling.
174 #define TRACE_ID_MANGLE(id) \ 174 #define TRACE_ID_MANGLE(id) \
175 skia::tracing_internals::TraceID::ForceMangle(id) 175 skia::tracing_internals::TraceID::ForceMangle(id)
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 SkEventTracer::GetInstance()->addTraceEvent 753 SkEventTracer::GetInstance()->addTraceEvent
754 754
755 // Set the duration field of a COMPLETE trace event. 755 // Set the duration field of a COMPLETE trace event.
756 // void TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( 756 // void TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
757 // const uint8_t* category_group_enabled, 757 // const uint8_t* category_group_enabled,
758 // const char* name, 758 // const char* name,
759 // SkEventTracer::Handle id) 759 // SkEventTracer::Handle id)
760 #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \ 760 #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \
761 SkEventTracer::GetInstance()->updateTraceEventDuration 761 SkEventTracer::GetInstance()->updateTraceEventDuration
762 762
763 // These operations are atomic in the Chrome tracing implementation
764 // to cater to ARM's weak memory consistency; we're just doing read/
765 // write here because it's not strictly needed for correctness.
766 // So says Nat.
767 // FIXME
768 //
769 // Skia addition: we mark these as unprotected reads and writes to shut up TSAN.
770
771 #define TRACE_EVENT_API_ATOMIC_WORD intptr_t 763 #define TRACE_EVENT_API_ATOMIC_WORD intptr_t
772 #define TRACE_EVENT_API_ATOMIC_LOAD(var) SK_ANNOTATE_UNPROTECTED_READ(var) 764 #define TRACE_EVENT_API_ATOMIC_LOAD(var) sk_atomic_load(&var, sk_memory_order_re laxed)
773 #define TRACE_EVENT_API_ATOMIC_STORE(var, value) SK_ANNOTATE_UNPROTECTED_WRITE(& var, value) 765 #define TRACE_EVENT_API_ATOMIC_STORE(var, value) \
766 sk_atomic_store(&var, value, sk_memory_order_relaxed)
774 767
775 // Defines visibility for classes in trace_event.h 768 // Defines visibility for classes in trace_event.h
776 #define TRACE_EVENT_API_CLASS_EXPORT SK_API 769 #define TRACE_EVENT_API_CLASS_EXPORT SK_API
777 770
778 // The thread buckets for the sampling profiler. 771 // The thread buckets for the sampling profiler.
779 TRACE_EVENT_API_CLASS_EXPORT extern \ 772 TRACE_EVENT_API_CLASS_EXPORT extern \
780 TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3]; 773 TRACE_EVENT_API_ATOMIC_WORD g_trace_state[3];
781 774
782 #define TRACE_EVENT_API_THREAD_BUCKET(thread_bucket) \ 775 #define TRACE_EVENT_API_THREAD_BUCKET(thread_bucket) \
783 g_trace_state[thread_bucket] 776 g_trace_state[thread_bucket]
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 } 1232 }
1240 1233
1241 private: 1234 private:
1242 const char* previous_state_; 1235 const char* previous_state_;
1243 }; 1236 };
1244 1237
1245 } // namespace tracing_internals 1238 } // namespace tracing_internals
1246 } // namespace skia 1239 } // namespace skia
1247 1240
1248 #endif 1241 #endif
OLDNEW
« no previous file with comments | « src/core/SkLazyFnPtr.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698