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

Unified Diff: base/trace_event/trace_event.h

Issue 1122153002: Fixit: Fork base::TimeTicks --> TimeTicks + ThreadTicks + TraceTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FIXIT_timeclasses_1of2
Patch Set: REBASE after it passed CQ but did not commit to tree Created 5 years, 7 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/time/time_win_unittest.cc ('k') | base/trace_event/trace_event_android.cc » ('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..875d9055b3d5471ff7f6ea8f8ac1f4d18789ee71 100644
--- a/base/trace_event/trace_event.h
+++ b/base/trace_event/trace_event.h
@@ -954,7 +954,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 +1083,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 +1324,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 +1340,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 +1367,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 +1387,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 +1419,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 +1450,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 +1476,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 +1490,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 +1503,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 +1526,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 +1540,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 +1569,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/time/time_win_unittest.cc ('k') | base/trace_event/trace_event_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698