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

Unified Diff: base/trace_event/trace_event.h

Issue 1180693002: Update from https://crrev.com/333737 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/trace_config_unittest.cc ('k') | base/trace_event/trace_event.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event.h
diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h
index 2c30b3340a2dd06edf8fcd8290ef96eee0412b16..397bafc3550faf11c3bae4a1b5b4576bb81c9efb 100644
--- a/base/trace_event/trace_event.h
+++ b/base/trace_event/trace_event.h
@@ -731,16 +731,12 @@
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, \
category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
arg2_name, arg2_val)
-// Records a single NESTABLE_ASYNC_END event called "name" immediately, with 0,
-// 1, or 2 associated arguments. If the category is not enabled, then this does
+// Records a single NESTABLE_ASYNC_END event called "name" immediately, with 0
+// or 2 associated arguments. If the category is not enabled, then this does
// nothing.
#define TRACE_EVENT_NESTABLE_ASYNC_END0(category_group, name, id) \
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \
category_group, name, id, TRACE_EVENT_FLAG_NONE)
-#define TRACE_EVENT_NESTABLE_ASYNC_END1(category_group, name, id, arg1_name, \
- arg1_val) \
- INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \
- category_group, name, id, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
#define TRACE_EVENT_NESTABLE_ASYNC_END2(category_group, name, id, arg1_name, \
arg1_val, arg2_name, arg2_val) \
INTERNAL_TRACE_EVENT_ADD_WITH_ID(TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, \
@@ -760,6 +756,22 @@
TRACE_EVENT_FLAG_ASYNC_TTS | TRACE_EVENT_FLAG_COPY, \
arg1_name, arg1_val, arg2_name, arg2_val)
+// Similar to TRACE_EVENT_NESTABLE_ASYNC_{BEGIN,END}x but with a custom
+// |timestamp| provided.
+#define TRACE_EVENT_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0(category_group, name, \
+ id, timestamp) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN, category_group, name, id, \
+ static_cast<int>(base::PlatformThread::CurrentId()), timestamp, \
+ TRACE_EVENT_FLAG_NONE)
+
+#define TRACE_EVENT_NESTABLE_ASYNC_END_WITH_TIMESTAMP0(category_group, name, \
+ id, timestamp) \
+ INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_END, category_group, name, id, \
+ static_cast<int>(base::PlatformThread::CurrentId()), timestamp, \
+ TRACE_EVENT_FLAG_NONE)
+
// Records a single NESTABLE_ASYNC_INSTANT event called "name" immediately,
// with 2 associated arguments. If the category is not enabled, then this
// does nothing.
@@ -954,7 +966,7 @@
// const char* name,
// unsigned long long id,
// int thread_id,
-// const TimeTicks& timestamp,
+// const TraceTicks& timestamp,
// int num_args,
// const char** arg_names,
// const unsigned char* arg_types,
@@ -1083,7 +1095,7 @@ TRACE_EVENT_API_CLASS_EXPORT extern \
trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \
phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \
name, trace_event_trace_id.data(), \
- thread_id, base::TimeTicks::FromInternalValue(timestamp), \
+ thread_id, base::TraceTicks::FromInternalValue(timestamp), \
trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \
##__VA_ARGS__); \
} \
@@ -1324,8 +1336,8 @@ static inline void SetTraceValue(const std::string& arg,
*value = type_value.as_uint;
}
-// base::Time and base::TimeTicks version of SetTraceValue to make it easier to
-// trace these types.
+// base::Time, base::TimeTicks, etc. versions of SetTraceValue to make it easier
+// to trace these types.
static inline void SetTraceValue(const base::Time arg,
unsigned char* type,
unsigned long long* value) {
@@ -1340,6 +1352,20 @@ static inline void SetTraceValue(const base::TimeTicks arg,
*value = arg.ToInternalValue();
}
+static inline void SetTraceValue(const base::ThreadTicks arg,
+ unsigned char* type,
+ unsigned long long* value) {
+ *type = TRACE_VALUE_TYPE_INT;
+ *value = arg.ToInternalValue();
+}
+
+static inline void SetTraceValue(const base::TraceTicks arg,
+ unsigned char* type,
+ unsigned long long* value) {
+ *type = TRACE_VALUE_TYPE_INT;
+ *value = arg.ToInternalValue();
+}
+
// These AddTraceEvent and AddTraceEventWithThreadIdAndTimestamp template
// functions are defined here instead of in the macro, because the arg_values
// could be temporary objects, such as std::string. In order to store
@@ -1353,7 +1379,7 @@ AddTraceEventWithThreadIdAndTimestamp(
const char* name,
unsigned long long id,
int thread_id,
- const base::TimeTicks& timestamp,
+ const base::TraceTicks& timestamp,
unsigned char flags,
const char* arg1_name,
const scoped_refptr<base::trace_event::ConvertableToTraceFormat>&
@@ -1373,7 +1399,7 @@ AddTraceEventWithThreadIdAndTimestamp(
const char* name,
unsigned long long id,
int thread_id,
- const base::TimeTicks& timestamp,
+ const base::TraceTicks& timestamp,
unsigned char flags,
const char* arg1_name,
const ARG1_TYPE& arg1_val,
@@ -1405,7 +1431,7 @@ AddTraceEventWithThreadIdAndTimestamp(
const char* name,
unsigned long long id,
int thread_id,
- const base::TimeTicks& timestamp,
+ const base::TraceTicks& timestamp,
unsigned char flags,
const char* arg1_name,
const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val,
@@ -1436,7 +1462,7 @@ AddTraceEventWithThreadIdAndTimestamp(
const char* name,
unsigned long long id,
int thread_id,
- const base::TimeTicks& timestamp,
+ const base::TraceTicks& timestamp,
unsigned char flags,
const char* arg1_name,
const scoped_refptr<base::trace_event::ConvertableToTraceFormat>& arg1_val,
@@ -1462,7 +1488,7 @@ AddTraceEventWithThreadIdAndTimestamp(
const char* name,
unsigned long long id,
int thread_id,
- const base::TimeTicks& timestamp,
+ const base::TraceTicks& timestamp,
unsigned char flags) {
return TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(
phase, category_group_enabled, name, id, thread_id, timestamp,
@@ -1476,7 +1502,7 @@ static inline base::trace_event::TraceEventHandle AddTraceEvent(
unsigned long long id,
unsigned char flags) {
const int thread_id = static_cast<int>(base::PlatformThread::CurrentId());
- const base::TimeTicks now = base::TimeTicks::NowFromSystemTraceTime();
+ const base::TraceTicks now = base::TraceTicks::Now();
return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled,
name, id, thread_id, now, flags);
}
@@ -1489,7 +1515,7 @@ AddTraceEventWithThreadIdAndTimestamp(
const char* name,
unsigned long long id,
int thread_id,
- const base::TimeTicks& timestamp,
+ const base::TraceTicks& timestamp,
unsigned char flags,
const char* arg1_name,
const ARG1_TYPE& arg1_val) {
@@ -1512,7 +1538,7 @@ static inline base::trace_event::TraceEventHandle AddTraceEvent(
const char* arg1_name,
const ARG1_TYPE& arg1_val) {
int thread_id = static_cast<int>(base::PlatformThread::CurrentId());
- base::TimeTicks now = base::TimeTicks::NowFromSystemTraceTime();
+ base::TraceTicks now = base::TraceTicks::Now();
return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled,
name, id, thread_id, now, flags,
arg1_name, arg1_val);
@@ -1526,7 +1552,7 @@ AddTraceEventWithThreadIdAndTimestamp(
const char* name,
unsigned long long id,
int thread_id,
- const base::TimeTicks& timestamp,
+ const base::TraceTicks& timestamp,
unsigned char flags,
const char* arg1_name,
const ARG1_TYPE& arg1_val,
@@ -1555,7 +1581,7 @@ static inline base::trace_event::TraceEventHandle AddTraceEvent(
const char* arg2_name,
const ARG2_TYPE& arg2_val) {
int thread_id = static_cast<int>(base::PlatformThread::CurrentId());
- base::TimeTicks now = base::TimeTicks::NowFromSystemTraceTime();
+ base::TraceTicks now = base::TraceTicks::Now();
return AddTraceEventWithThreadIdAndTimestamp(phase, category_group_enabled,
name, id, thread_id, now, flags,
arg1_name, arg1_val,
« no previous file with comments | « base/trace_event/trace_config_unittest.cc ('k') | base/trace_event/trace_event.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698