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

Unified Diff: ui/events/latency_info.cc

Issue 1462923003: LatencyInfo: enable async event reporting for both latencyInfo and benchmark categories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: extracted a constant Created 5 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/latency_info.cc
diff --git a/ui/events/latency_info.cc b/ui/events/latency_info.cc
index e8bdbd373d48374f37b9e077eb79c39fd84f7bf2..33f51721478b5b13e657bb3e94449df3732e0154 100644
--- a/ui/events/latency_info.cc
+++ b/ui/events/latency_info.cc
@@ -113,17 +113,19 @@ LatencyInfoTracedValue::LatencyInfoTracedValue(base::Value* value)
: value_(value) {
}
-struct BenchmarkEnabledInitializer {
- BenchmarkEnabledInitializer() :
- benchmark_enabled(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
- "benchmark")) {
+const char kTraceCategoriesForAsyncEvents[] = "benchmark,latencyInfo";
+
+struct LatencyInfoEnabledInitializer {
+ LatencyInfoEnabledInitializer() :
+ latency_info_enabled(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
+ kTraceCategoriesForAsyncEvents)) {
}
- const unsigned char* benchmark_enabled;
+ const unsigned char* latency_info_enabled;
};
-static base::LazyInstance<BenchmarkEnabledInitializer>::Leaky
- g_benchmark_enabled = LAZY_INSTANCE_INITIALIZER;
+static base::LazyInstance<LatencyInfoEnabledInitializer>::Leaky
+ g_latency_info_enabled = LAZY_INSTANCE_INITIALIZER;
} // namespace
@@ -222,15 +224,15 @@ void LatencyInfo::AddLatencyNumberWithTimestampImpl(
uint32 event_count,
const char* trace_name_str) {
- const unsigned char* benchmark_enabled =
- g_benchmark_enabled.Get().benchmark_enabled;
+ const unsigned char* latency_info_enabled =
+ g_latency_info_enabled.Get().latency_info_enabled;
if (IsBeginComponent(component)) {
// Should only ever add begin component once.
CHECK_EQ(-1, trace_id_);
trace_id_ = component_sequence_number;
- if (*benchmark_enabled) {
+ if (*latency_info_enabled) {
// The timestamp for ASYNC_BEGIN trace event is used for drawing the
// beginning of the trace event in trace viewer. For better visualization,
// for an input event, we want to draw the beginning as when the event is
@@ -257,7 +259,7 @@ void LatencyInfo::AddLatencyNumberWithTimestampImpl(
}
TRACE_EVENT_COPY_ASYNC_BEGIN_WITH_TIMESTAMP0(
- "benchmark,latencyInfo",
+ kTraceCategoriesForAsyncEvents,
trace_name_.c_str(),
TRACE_ID_DONT_MANGLE(trace_id_),
ts);
@@ -294,11 +296,12 @@ void LatencyInfo::AddLatencyNumberWithTimestampImpl(
CHECK(!terminated_);
terminated_ = true;
- if (*benchmark_enabled) {
- TRACE_EVENT_COPY_ASYNC_END2("benchmark,latencyInfo", trace_name_.c_str(),
- TRACE_ID_DONT_MANGLE(trace_id_), "data",
- AsTraceableData(), "coordinates",
- CoordinatesAsTraceableData());
+ if (*latency_info_enabled) {
+ TRACE_EVENT_COPY_ASYNC_END2(kTraceCategoriesForAsyncEvents,
+ trace_name_.c_str(),
+ TRACE_ID_DONT_MANGLE(trace_id_),
+ "data", AsTraceableData(),
+ "coordinates", CoordinatesAsTraceableData());
}
TRACE_EVENT_WITH_FLOW0("input,benchmark",
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698