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

Unified Diff: base/debug/trace_event.h

Issue 203063002: Adding support for Time and TimeTicks inside trace_event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/debug/trace_event_unittest.cc » ('j') | 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 2fd03c9046d219d9d0f005aaaf3acf4c62d818c8..6d6d3e303cfc23739aa9c83e06514bec58cf945b 100644
--- a/base/debug/trace_event.h
+++ b/base/debug/trace_event.h
@@ -195,6 +195,7 @@
#include "base/debug/trace_event_impl.h"
#include "base/debug/trace_event_memory.h"
#include "base/debug/trace_event_system_stats_monitor.h"
+#include "base/time/time.h"
#include "build/build_config.h"
// By default, const char* argument values are assumed to have long-lived scope
@@ -1159,6 +1160,22 @@ 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.
+static inline void SetTraceValue(const base::Time arg,
+ unsigned char* type,
+ unsigned long long* value) {
+ *type = TRACE_VALUE_TYPE_INT;
+ *value = arg.ToInternalValue();
+}
+
+static inline void SetTraceValue(const base::TimeTicks 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
« no previous file with comments | « no previous file | base/debug/trace_event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698