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

Unified Diff: ppapi/shared_impl/ppb_trace_event_impl.cc

Issue 17555005: Add events with custom timestamps and thread id to PPAPI dev tracing interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: edits Created 7 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
Index: ppapi/shared_impl/ppb_trace_event_impl.cc
diff --git a/ppapi/shared_impl/ppb_trace_event_impl.cc b/ppapi/shared_impl/ppb_trace_event_impl.cc
index 6803fc6d36d8b30f676d98a12c519193dfda71c4..fe15425d5ab4d0636ba31f8a111b10db4d1058ca 100644
--- a/ppapi/shared_impl/ppb_trace_event_impl.cc
+++ b/ppapi/shared_impl/ppb_trace_event_impl.cc
@@ -48,6 +48,32 @@ void TraceEventImpl::AddTraceEvent(int8_t phase,
}
// static
+void TraceEventImpl::AddTraceEventWithThreadIdAndTimestamp(int8_t phase,
+ const void* category_enabled,
bradn 2013/06/21 21:49:18 indentation
grosse 2013/06/24 23:16:46 Done.
+ const char* name,
+ uint64_t id,
+ int32_t thread_id,
+ int64_t timestamp,
+ uint32_t num_args,
+ const char* arg_names[],
+ const uint8_t arg_types[],
+ const uint64_t arg_values[],
+ uint8_t flags) {
+ base::TimeTicks ticks;
+ ticks += base::TimeDelta::FromMicroseconds(timestamp);
bradn 2013/06/21 21:49:18 I think we're going to need to string through Time
grosse 2013/06/24 23:16:46 Added Now() method.
+ base::debug::TraceLog::GetInstance()->AddTraceEventWithThreadIdAndTimestamp(
+ phase,
+ static_cast<const unsigned char*>(category_enabled), name, id,
+ thread_id, ticks, num_args,
+ arg_names, arg_types,
+ // This cast is necessary for LP64 systems, where uint64_t is defined as
+ // an unsigned long int, but trace_event internals are hermetic and
+ // accepts an |unsigned long long*|. The pointer types are compatible but
+ // the compiler throws an error without an explicit cast.
+ reinterpret_cast<const unsigned long long*>(arg_values), NULL, flags);
+}
+
+// static
void TraceEventImpl::SetThreadName(const char* thread_name) {
base::PlatformThread::SetName(thread_name);
}
@@ -57,6 +83,7 @@ namespace {
const PPB_Trace_Event_Dev g_ppb_trace_event_thunk = {
&TraceEventImpl::GetCategoryEnabled,
&TraceEventImpl::AddTraceEvent,
+ &TraceEventImpl::AddTraceEventWithThreadIdAndTimestamp,
&TraceEventImpl::SetThreadName,
};
@@ -67,7 +94,7 @@ const PPB_Trace_Event_Dev g_ppb_trace_event_thunk = {
namespace ppapi {
namespace thunk {
-const PPB_Trace_Event_Dev_0_1* GetPPB_Trace_Event_Dev_0_1_Thunk() {
+const PPB_Trace_Event_Dev_0_2* GetPPB_Trace_Event_Dev_0_2_Thunk() {
return &g_ppb_trace_event_thunk;
}

Powered by Google App Engine
This is Rietveld 408576698