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

Unified Diff: base/trace_event/trace_log.cc

Issue 2967023002: android: Add thread time to early TraceEvent, make timings more precise. (Closed)
Patch Set: . Created 3 years, 5 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
« base/trace_event/trace_event.h ('K') | « base/trace_event/trace_log.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_log.cc
diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc
index 87e48fcafd219d8f825c7cb699e256ae783fb5cd..c2f8b08e469b5f919454c777642875e95da33a6c 100644
--- a/base/trace_event/trace_log.cc
+++ b/base/trace_event/trace_log.cc
@@ -1381,17 +1381,29 @@ void TraceLog::UpdateTraceEventDuration(
if (!category_group_enabled_local)
return;
+ TimeTicks now = OffsetNow();
+ ThreadTicks thread_now = ThreadNow();
+ UpdateTraceEventDurationExplicit(category_group_enabled, name, handle, now,
Primiano Tucci (use gerrit) 2017/07/10 13:09:15 small nit: given that this wraps already, you coul
Benoit L 2017/07/10 13:39:54 Done.
+ thread_now);
+}
+
+void TraceLog::UpdateTraceEventDurationExplicit(
+ const unsigned char* category_group_enabled,
+ const char* name,
+ TraceEventHandle handle,
+ const TimeTicks& now,
+ const ThreadTicks& thread_now) {
+ char category_group_enabled_local = *category_group_enabled;
+ if (!category_group_enabled_local)
+ return;
+
// Avoid re-entrance of AddTraceEvent. This may happen in GPU process when
// ECHO_TO_CONSOLE is enabled: AddTraceEvent -> LOG(ERROR) ->
// GpuProcessLogMessageHandler -> PostPendingTask -> TRACE_EVENT ...
if (thread_is_in_trace_event_.Get())
return;
-
AutoThreadLocalBoolean thread_is_in_trace_event(&thread_is_in_trace_event_);
- ThreadTicks thread_now = ThreadNow();
- TimeTicks now = OffsetNow();
-
#if defined(OS_WIN)
// Generate an ETW event that marks the end of a complete event.
if (category_group_enabled_local & TraceCategory::ENABLED_FOR_ETW_EXPORT)
« base/trace_event/trace_event.h ('K') | « base/trace_event/trace_log.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698