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

Unified Diff: base/debug/trace_event.h

Issue 160673002: Use branch prediction hints to make trace events cheaper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't redefined macros. Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/compiler_specific.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/trace_event.h
diff --git a/base/debug/trace_event.h b/base/debug/trace_event.h
index b753963a9385aa3e7483c4b80c1b78563944948b..2fd03c9046d219d9d0f005aaaf3acf4c62d818c8 100644
--- a/base/debug/trace_event.h
+++ b/base/debug/trace_event.h
@@ -726,9 +726,9 @@
category_group, name, TRACE_ID_DONT_MANGLE(id), TRACE_EVENT_FLAG_NONE)
#define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE() \
- *INTERNAL_TRACE_EVENT_UID(category_group_enabled) & \
+ UNLIKELY(*INTERNAL_TRACE_EVENT_UID(category_group_enabled) & \
(base::debug::TraceLog::ENABLED_FOR_RECORDING | \
- base::debug::TraceLog::ENABLED_FOR_EVENT_CALLBACK)
+ base::debug::TraceLog::ENABLED_FOR_EVENT_CALLBACK))
// Macro to efficiently determine if a given category group is enabled.
#define TRACE_EVENT_CATEGORY_GROUP_ENABLED(category_group, ret) \
@@ -854,7 +854,7 @@ TRACE_EVENT_API_CLASS_EXPORT extern \
category_group_enabled = \
reinterpret_cast<const unsigned char*>(TRACE_EVENT_API_ATOMIC_LOAD( \
atomic)); \
- if (!category_group_enabled) { \
+ if (UNLIKELY(!category_group_enabled)) { \
category_group_enabled = \
TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); \
TRACE_EVENT_API_ATOMIC_STORE(atomic, \
« no previous file with comments | « base/compiler_specific.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698