summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/debug/trace_event_impl.cc20
-rw-r--r--base/debug/trace_event_internal.h82
-rw-r--r--base/debug/trace_event_unittest.cc135
-rw-r--r--base/test/trace_event_analyzer_unittest.cc51
-rw-r--r--cc/animation/animation.cc1
-rw-r--r--cc/base/worker_pool.cc6
-rw-r--r--cc/layers/scrollbar_layer.cc3
-rw-r--r--cc/resources/tile_manager.cc4
-rw-r--r--cc/trees/layer_tree_host.cc3
-rw-r--r--cc/trees/layer_tree_host_common.cc9
-rw-r--r--cc/trees/layer_tree_host_impl.cc20
-rw-r--r--cc/trees/thread_proxy.cc5
-rw-r--r--chrome/test/base/tracing_browsertest.cc2
-rw-r--r--chrome/test/perf/rendering/latency_tests.cc3
-rw-r--r--content/browser/browser_main_loop.cc3
-rw-r--r--content/browser/gpu/gpu_process_host.cc2
-rw-r--r--content/browser/renderer_host/compositing_iosurface_mac.mm3
-rw-r--r--content/browser/renderer_host/compositor_impl_android.cc3
-rw-r--r--content/browser/renderer_host/media/web_contents_video_capture_device.cc6
-rw-r--r--content/browser/renderer_host/render_widget_host_impl.cc10
-rw-r--r--content/common/android/trace_event_binding.cc4
-rw-r--r--content/common/gpu/image_transport_surface.cc1
-rw-r--r--content/renderer/render_view_impl.cc3
-rw-r--r--content/renderer/render_widget.cc6
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc5
-rw-r--r--ui/gl/gl_surface_glx.cc5
-rw-r--r--ui/surface/accelerated_surface_win.cc6
27 files changed, 260 insertions, 141 deletions
diff --git a/base/debug/trace_event_impl.cc b/base/debug/trace_event_impl.cc
index d543d87..dc8256a 100644
--- a/base/debug/trace_event_impl.cc
+++ b/base/debug/trace_event_impl.cc
@@ -408,6 +408,26 @@ void TraceEvent::AppendAsJSON(std::string* out) const {
// bits (it might be a 64-bit pointer).
if (flags_ & TRACE_EVENT_FLAG_HAS_ID)
StringAppendF(out, ",\"id\":\"%" PRIx64 "\"", static_cast<uint64>(id_));
+
+ // Instant events also output their scope.
+ if (phase_ == TRACE_EVENT_PHASE_INSTANT) {
+ char scope = '?';
+ switch (flags_ & TRACE_EVENT_FLAG_SCOPE_MASK) {
+ case TRACE_EVENT_SCOPE_GLOBAL:
+ scope = TRACE_EVENT_SCOPE_NAME_GLOBAL;
+ break;
+
+ case TRACE_EVENT_SCOPE_PROCESS:
+ scope = TRACE_EVENT_SCOPE_NAME_PROCESS;
+ break;
+
+ case TRACE_EVENT_SCOPE_THREAD:
+ scope = TRACE_EVENT_SCOPE_NAME_THREAD;
+ break;
+ }
+ StringAppendF(out, ",\"s\":\"%c\"", scope);
+ }
+
*out += "}";
}
diff --git a/base/debug/trace_event_internal.h b/base/debug/trace_event_internal.h
index 864315e..46495f4 100644
--- a/base/debug/trace_event_internal.h
+++ b/base/debug/trace_event_internal.h
@@ -182,10 +182,11 @@
#define UNSHIPPED_TRACE_EVENT1(category, name, arg1_name, arg1_val) (void)0
#define UNSHIPPED_TRACE_EVENT2(category, name, arg1_name, arg1_val, \
arg2_name, arg2_val) (void)0
-#define UNSHIPPED_TRACE_EVENT_INSTANT0(category, name) (void)0
-#define UNSHIPPED_TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
- (void)0
-#define UNSHIPPED_TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \
+#define UNSHIPPED_TRACE_EVENT_INSTANT0(category, name, scope) (void)0
+#define UNSHIPPED_TRACE_EVENT_INSTANT1(category, name, scope, \
+ arg1_name, arg1_val) (void)0
+#define UNSHIPPED_TRACE_EVENT_INSTANT2(category, name, scope, \
+ arg1_name, arg1_val, \
arg2_name, arg2_val) (void)0
#else
#define UNSHIPPED_TRACE_EVENT0(category, name) \
@@ -195,13 +196,15 @@
#define UNSHIPPED_TRACE_EVENT2(category, name, arg1_name, arg1_val, \
arg2_name, arg2_val) \
TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val)
-#define UNSHIPPED_TRACE_EVENT_INSTANT0(category, name) \
- TRACE_EVENT_INSTANT0(category, name)
-#define UNSHIPPED_TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
- TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val)
-#define UNSHIPPED_TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \
+#define UNSHIPPED_TRACE_EVENT_INSTANT0(category, name, scope) \
+ TRACE_EVENT_INSTANT0(category, name, scope)
+#define UNSHIPPED_TRACE_EVENT_INSTANT1(category, name, scope, \
+ arg1_name, arg1_val) \
+ TRACE_EVENT_INSTANT1(category, name, scope, arg1_name, arg1_val)
+#define UNSHIPPED_TRACE_EVENT_INSTANT2(category, name, scope, \
+ arg1_name, arg1_val, \
arg2_name, arg2_val) \
- TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \
+ TRACE_EVENT_INSTANT2(category, name, scope, arg1_name, arg1_val, \
arg2_name, arg2_val)
#endif
@@ -210,28 +213,31 @@
// does nothing.
// - category and name strings must have application lifetime (statics or
// literals). They may not include " chars.
-#define TRACE_EVENT_INSTANT0(category, name) \
+#define TRACE_EVENT_INSTANT0(category, name, scope) \
INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
- category, name, TRACE_EVENT_FLAG_NONE)
-#define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \
+ category, name, TRACE_EVENT_FLAG_NONE | scope)
+#define TRACE_EVENT_INSTANT1(category, name, scope, arg1_name, arg1_val) \
INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
- category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val)
-#define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, \
- arg2_name, arg2_val) \
+ category, name, TRACE_EVENT_FLAG_NONE | scope, \
+ arg1_name, arg1_val)
+#define TRACE_EVENT_INSTANT2(category, name, scope, arg1_name, arg1_val, \
+ arg2_name, arg2_val) \
INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
- category, name, TRACE_EVENT_FLAG_NONE, arg1_name, arg1_val, \
- arg2_name, arg2_val)
-#define TRACE_EVENT_COPY_INSTANT0(category, name) \
+ category, name, TRACE_EVENT_FLAG_NONE | scope, \
+ arg1_name, arg1_val, arg2_name, arg2_val)
+#define TRACE_EVENT_COPY_INSTANT0(category, name, scope) \
INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
- category, name, TRACE_EVENT_FLAG_COPY)
-#define TRACE_EVENT_COPY_INSTANT1(category, name, arg1_name, arg1_val) \
+ category, name, TRACE_EVENT_FLAG_COPY | scope)
+#define TRACE_EVENT_COPY_INSTANT1(category, name, scope, \
+ arg1_name, arg1_val) \
INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
- category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val)
-#define TRACE_EVENT_COPY_INSTANT2(category, name, arg1_name, arg1_val, \
- arg2_name, arg2_val) \
+ category, name, TRACE_EVENT_FLAG_COPY | scope, arg1_name, arg1_val)
+#define TRACE_EVENT_COPY_INSTANT2(category, name, scope, \
+ arg1_name, arg1_val, \
+ arg2_name, arg2_val) \
INTERNAL_TRACE_EVENT_ADD(TRACE_EVENT_PHASE_INSTANT, \
- category, name, TRACE_EVENT_FLAG_COPY, arg1_name, arg1_val, \
- arg2_name, arg2_val)
+ category, name, TRACE_EVENT_FLAG_COPY | scope, \
+ arg1_name, arg1_val, arg2_name, arg2_val)
// Sets the current sample state to the given category and name (both must be
// constant strings). These states are intended for a sampling profiler.
@@ -694,7 +700,7 @@
// Phase indicates the nature of an event entry. E.g. part of a begin/end pair.
#define TRACE_EVENT_PHASE_BEGIN ('B')
#define TRACE_EVENT_PHASE_END ('E')
-#define TRACE_EVENT_PHASE_INSTANT ('I')
+#define TRACE_EVENT_PHASE_INSTANT ('i')
#define TRACE_EVENT_PHASE_ASYNC_BEGIN ('S')
#define TRACE_EVENT_PHASE_ASYNC_STEP ('T')
#define TRACE_EVENT_PHASE_ASYNC_END ('F')
@@ -708,10 +714,14 @@
#define TRACE_EVENT_PHASE_DELETE_OBJECT ('D')
// Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT.
-#define TRACE_EVENT_FLAG_NONE (static_cast<unsigned char>(0))
-#define TRACE_EVENT_FLAG_COPY (static_cast<unsigned char>(1 << 0))
-#define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned char>(1 << 1))
-#define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned char>(1 << 2))
+#define TRACE_EVENT_FLAG_NONE (static_cast<unsigned char>(0))
+#define TRACE_EVENT_FLAG_COPY (static_cast<unsigned char>(1 << 0))
+#define TRACE_EVENT_FLAG_HAS_ID (static_cast<unsigned char>(1 << 1))
+#define TRACE_EVENT_FLAG_MANGLE_ID (static_cast<unsigned char>(1 << 2))
+#define TRACE_EVENT_FLAG_SCOPE_OFFSET (static_cast<unsigned char>(1 << 3))
+
+#define TRACE_EVENT_FLAG_SCOPE_MASK (static_cast<unsigned char>( \
+ TRACE_EVENT_FLAG_SCOPE_OFFSET | (TRACE_EVENT_FLAG_SCOPE_OFFSET << 1)))
// Type values for identifying types in the TraceValue union.
#define TRACE_VALUE_TYPE_BOOL (static_cast<unsigned char>(1))
@@ -722,6 +732,16 @@
#define TRACE_VALUE_TYPE_STRING (static_cast<unsigned char>(6))
#define TRACE_VALUE_TYPE_COPY_STRING (static_cast<unsigned char>(7))
+// Enum reflecting the scope of an INSTANT event. Must fit within
+// TRACE_EVENT_FLAG_SCOPE_MASK.
+#define TRACE_EVENT_SCOPE_GLOBAL (static_cast<unsigned char>(0 << 3))
+#define TRACE_EVENT_SCOPE_PROCESS (static_cast<unsigned char>(1 << 3))
+#define TRACE_EVENT_SCOPE_THREAD (static_cast<unsigned char>(2 << 3))
+
+#define TRACE_EVENT_SCOPE_NAME_GLOBAL ('g')
+#define TRACE_EVENT_SCOPE_NAME_PROCESS ('p')
+#define TRACE_EVENT_SCOPE_NAME_THREAD ('t')
+
namespace trace_event_internal {
// Specify these values when the corresponding argument of AddTraceEvent is not
diff --git a/base/debug/trace_event_unittest.cc b/base/debug/trace_event_unittest.cc
index 5fb9040..4e76203 100644
--- a/base/debug/trace_event_unittest.cc
+++ b/base/debug/trace_event_unittest.cc
@@ -326,9 +326,12 @@ void TraceWithAllMacroVariants(WaitableEvent* task_complete_event) {
"name1", "\"value1\"",
"name2", "value\\2");
- TRACE_EVENT_INSTANT0("all", "TRACE_EVENT_INSTANT0 call");
- TRACE_EVENT_INSTANT1("all", "TRACE_EVENT_INSTANT1 call", "name1", "value1");
+ TRACE_EVENT_INSTANT0("all", "TRACE_EVENT_INSTANT0 call",
+ TRACE_EVENT_SCOPE_GLOBAL);
+ TRACE_EVENT_INSTANT1("all", "TRACE_EVENT_INSTANT1 call",
+ TRACE_EVENT_SCOPE_PROCESS, "name1", "value1");
TRACE_EVENT_INSTANT2("all", "TRACE_EVENT_INSTANT2 call",
+ TRACE_EVENT_SCOPE_THREAD,
"name1", "value1",
"name2", "value2");
@@ -447,10 +450,25 @@ void ValidateAllTraceMacrosCreatedData(const ListValue& trace_parsed) {
EXPECT_SUB_FIND_("value\\2");
EXPECT_FIND_("TRACE_EVENT_INSTANT0 call");
+ {
+ std::string scope;
+ EXPECT_TRUE((item && item->GetString("s", &scope)));
+ EXPECT_EQ("g", scope);
+ }
EXPECT_FIND_("TRACE_EVENT_INSTANT1 call");
+ {
+ std::string scope;
+ EXPECT_TRUE((item && item->GetString("s", &scope)));
+ EXPECT_EQ("p", scope);
+ }
EXPECT_SUB_FIND_("name1");
EXPECT_SUB_FIND_("value1");
EXPECT_FIND_("TRACE_EVENT_INSTANT2 call");
+ {
+ std::string scope;
+ EXPECT_TRUE((item && item->GetString("s", &scope)));
+ EXPECT_EQ("t", scope);
+ }
EXPECT_SUB_FIND_("name1");
EXPECT_SUB_FIND_("value1");
EXPECT_SUB_FIND_("name2");
@@ -695,6 +713,7 @@ void TraceManyInstantEvents(int thread_id, int num_events,
WaitableEvent* task_complete_event) {
for (int i = 0; i < num_events; i++) {
TRACE_EVENT_INSTANT2("all", "multi thread event",
+ TRACE_EVENT_SCOPE_THREAD,
"thread", thread_id,
"event", i);
}
@@ -737,7 +756,7 @@ void ValidateInstantEventPresentOnEveryThread(const ListValue& trace_parsed,
void TraceCallsWithCachedCategoryPointersPointers(const char* name_str) {
TRACE_EVENT0("category name1", name_str);
- TRACE_EVENT_INSTANT0("category name2", name_str);
+ TRACE_EVENT_INSTANT0("category name2", name_str, TRACE_EVENT_SCOPE_THREAD);
TRACE_EVENT_BEGIN0("category name3", name_str);
TRACE_EVENT_END0("category name4", name_str);
}
@@ -851,11 +870,11 @@ TEST_F(TraceEventTestFixture, Categories) {
// Test that categories that are used can be retrieved whether trace was
// enabled or disabled when the trace event was encountered.
- TRACE_EVENT_INSTANT0("c1", "name");
- TRACE_EVENT_INSTANT0("c2", "name");
+ TRACE_EVENT_INSTANT0("c1", "name", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("c2", "name", TRACE_EVENT_SCOPE_THREAD);
BeginTrace();
- TRACE_EVENT_INSTANT0("c3", "name");
- TRACE_EVENT_INSTANT0("c4", "name");
+ TRACE_EVENT_INSTANT0("c3", "name", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("c4", "name", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
std::vector<std::string> cats;
TraceLog::GetInstance()->GetKnownCategories(&cats);
@@ -876,8 +895,8 @@ TEST_F(TraceEventTestFixture, Categories) {
included_categories.push_back("not_found823564786");
TraceLog::GetInstance()->SetEnabled(included_categories, empty_categories,
TraceLog::RECORD_UNTIL_FULL);
- TRACE_EVENT_INSTANT0("cat1", "name");
- TRACE_EVENT_INSTANT0("cat2", "name");
+ TRACE_EVENT_INSTANT0("cat1", "name", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cat2", "name", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
EXPECT_TRUE(trace_parsed_.empty());
@@ -887,8 +906,8 @@ TEST_F(TraceEventTestFixture, Categories) {
included_categories.push_back("inc");
TraceLog::GetInstance()->SetEnabled(included_categories, empty_categories,
TraceLog::RECORD_UNTIL_FULL);
- TRACE_EVENT_INSTANT0("inc", "name");
- TRACE_EVENT_INSTANT0("inc2", "name");
+ TRACE_EVENT_INSTANT0("inc", "name", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("inc2", "name", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
EXPECT_TRUE(FindMatchingValue("cat", "inc"));
EXPECT_FALSE(FindNonMatchingValue("cat", "inc"));
@@ -900,12 +919,15 @@ TEST_F(TraceEventTestFixture, Categories) {
included_categories.push_back("inc_wildchar_?_end");
TraceLog::GetInstance()->SetEnabled(included_categories, empty_categories,
TraceLog::RECORD_UNTIL_FULL);
- TRACE_EVENT_INSTANT0("inc_wildcard_abc", "included");
- TRACE_EVENT_INSTANT0("inc_wildcard_", "included");
- TRACE_EVENT_INSTANT0("inc_wildchar_x_end", "included");
- TRACE_EVENT_INSTANT0("inc_wildchar_bla_end", "not_inc");
- TRACE_EVENT_INSTANT0("cat1", "not_inc");
- TRACE_EVENT_INSTANT0("cat2", "not_inc");
+ TRACE_EVENT_INSTANT0("inc_wildcard_abc", "included",
+ TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("inc_wildcard_", "included", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("inc_wildchar_x_end", "included",
+ TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("inc_wildchar_bla_end", "not_inc",
+ TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cat1", "not_inc", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cat2", "not_inc", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
EXPECT_TRUE(FindMatchingValue("cat", "inc_wildcard_abc"));
EXPECT_TRUE(FindMatchingValue("cat", "inc_wildcard_"));
@@ -920,8 +942,8 @@ TEST_F(TraceEventTestFixture, Categories) {
excluded_categories.push_back("not_found823564786");
TraceLog::GetInstance()->SetEnabled(empty_categories, excluded_categories,
TraceLog::RECORD_UNTIL_FULL);
- TRACE_EVENT_INSTANT0("cat1", "name");
- TRACE_EVENT_INSTANT0("cat2", "name");
+ TRACE_EVENT_INSTANT0("cat1", "name", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cat2", "name", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
EXPECT_TRUE(FindMatchingValue("cat", "cat1"));
EXPECT_TRUE(FindMatchingValue("cat", "cat2"));
@@ -932,8 +954,8 @@ TEST_F(TraceEventTestFixture, Categories) {
excluded_categories.push_back("inc");
TraceLog::GetInstance()->SetEnabled(empty_categories, excluded_categories,
TraceLog::RECORD_UNTIL_FULL);
- TRACE_EVENT_INSTANT0("inc", "name");
- TRACE_EVENT_INSTANT0("inc2", "name");
+ TRACE_EVENT_INSTANT0("inc", "name", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("inc2", "name", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
EXPECT_TRUE(FindMatchingValue("cat", "inc2"));
EXPECT_FALSE(FindMatchingValue("cat", "inc"));
@@ -945,12 +967,14 @@ TEST_F(TraceEventTestFixture, Categories) {
excluded_categories.push_back("inc_wildchar_?_end");
TraceLog::GetInstance()->SetEnabled(empty_categories, excluded_categories,
TraceLog::RECORD_UNTIL_FULL);
- TRACE_EVENT_INSTANT0("inc_wildcard_abc", "not_inc");
- TRACE_EVENT_INSTANT0("inc_wildcard_", "not_inc");
- TRACE_EVENT_INSTANT0("inc_wildchar_x_end", "not_inc");
- TRACE_EVENT_INSTANT0("inc_wildchar_bla_end", "included");
- TRACE_EVENT_INSTANT0("cat1", "included");
- TRACE_EVENT_INSTANT0("cat2", "included");
+ TRACE_EVENT_INSTANT0("inc_wildcard_abc", "not_inc", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("inc_wildcard_", "not_inc", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("inc_wildchar_x_end", "not_inc",
+ TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("inc_wildchar_bla_end", "included",
+ TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cat1", "included", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cat2", "included", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
EXPECT_TRUE(FindMatchingValue("cat", "inc_wildchar_bla_end"));
EXPECT_TRUE(FindMatchingValue("cat", "cat1"));
@@ -966,13 +990,13 @@ TEST_F(TraceEventTestFixture, EventWatchNotification) {
// Basic one occurrence.
BeginTrace();
TraceLog::GetInstance()->SetWatchEvent("cat", "event");
- TRACE_EVENT_INSTANT0("cat", "event");
+ TRACE_EVENT_INSTANT0("cat", "event", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
EXPECT_EQ(event_watch_notification_, 1);
// Basic one occurrence before Set.
BeginTrace();
- TRACE_EVENT_INSTANT0("cat", "event");
+ TRACE_EVENT_INSTANT0("cat", "event", TRACE_EVENT_SCOPE_THREAD);
TraceLog::GetInstance()->SetWatchEvent("cat", "event");
EndTraceAndFlush();
EXPECT_EQ(event_watch_notification_, 1);
@@ -982,7 +1006,7 @@ TEST_F(TraceEventTestFixture, EventWatchNotification) {
TraceLog::GetInstance()->SetWatchEvent("cat", "event");
EndTraceAndFlush();
BeginTrace();
- TRACE_EVENT_INSTANT0("cat", "event");
+ TRACE_EVENT_INSTANT0("cat", "event", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
EXPECT_EQ(event_watch_notification_, 0);
@@ -991,21 +1015,21 @@ TEST_F(TraceEventTestFixture, EventWatchNotification) {
int num_occurrences = 5;
TraceLog::GetInstance()->SetWatchEvent("cat", "event");
for (int i = 0; i < num_occurrences; ++i)
- TRACE_EVENT_INSTANT0("cat", "event");
+ TRACE_EVENT_INSTANT0("cat", "event", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
EXPECT_EQ(event_watch_notification_, num_occurrences);
// Wrong category.
BeginTrace();
TraceLog::GetInstance()->SetWatchEvent("cat", "event");
- TRACE_EVENT_INSTANT0("wrong_cat", "event");
+ TRACE_EVENT_INSTANT0("wrong_cat", "event", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
EXPECT_EQ(event_watch_notification_, 0);
// Wrong name.
BeginTrace();
TraceLog::GetInstance()->SetWatchEvent("cat", "event");
- TRACE_EVENT_INSTANT0("cat", "wrong_event");
+ TRACE_EVENT_INSTANT0("cat", "wrong_event", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
EXPECT_EQ(event_watch_notification_, 0);
@@ -1013,7 +1037,7 @@ TEST_F(TraceEventTestFixture, EventWatchNotification) {
BeginTrace();
TraceLog::GetInstance()->SetWatchEvent("cat", "event");
TraceLog::GetInstance()->CancelWatchEvent();
- TRACE_EVENT_INSTANT0("cat", "event");
+ TRACE_EVENT_INSTANT0("cat", "event", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
EXPECT_EQ(event_watch_notification_, 0);
}
@@ -1268,20 +1292,20 @@ TEST_F(TraceEventTestFixture, ThreadNameChanges) {
BeginTrace();
PlatformThread::SetName("");
- TRACE_EVENT_INSTANT0("drink", "water");
+ TRACE_EVENT_INSTANT0("drink", "water", TRACE_EVENT_SCOPE_THREAD);
PlatformThread::SetName("cafe");
- TRACE_EVENT_INSTANT0("drink", "coffee");
+ TRACE_EVENT_INSTANT0("drink", "coffee", TRACE_EVENT_SCOPE_THREAD);
PlatformThread::SetName("shop");
// No event here, so won't appear in combined name.
PlatformThread::SetName("pub");
- TRACE_EVENT_INSTANT0("drink", "beer");
- TRACE_EVENT_INSTANT0("drink", "wine");
+ TRACE_EVENT_INSTANT0("drink", "beer", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("drink", "wine", TRACE_EVENT_SCOPE_THREAD);
PlatformThread::SetName(" bar");
- TRACE_EVENT_INSTANT0("drink", "whisky");
+ TRACE_EVENT_INSTANT0("drink", "whisky", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
@@ -1320,11 +1344,13 @@ TEST_F(TraceEventTestFixture, AtExit) {
// so that it will be destroyed when this scope closes.
ManualTestSetUp();
- TRACE_EVENT_INSTANT0("all", "not recorded; system not enabled");
+ TRACE_EVENT_INSTANT0("all", "not recorded; system not enabled",
+ TRACE_EVENT_SCOPE_THREAD);
BeginTrace();
- TRACE_EVENT_INSTANT0("all", "is recorded 1; system has been enabled");
+ TRACE_EVENT_INSTANT0("all", "is recorded 1; system has been enabled",
+ TRACE_EVENT_SCOPE_THREAD);
// Trace calls that will cache pointers to categories; they're valid here
TraceCallsWithCachedCategoryPointersPointers(
"is recorded 2; system has been enabled");
@@ -1347,12 +1373,14 @@ TEST_F(TraceEventTestFixture, AtExit) {
TRACE_EVENT_END_ETW("not recorded; system shutdown", 0, NULL);
TRACE_EVENT_INSTANT_ETW("not recorded; system shutdown", 0, NULL);
TRACE_EVENT0("all", "not recorded; system shutdown");
- TRACE_EVENT_INSTANT0("all", "not recorded; system shutdown");
+ TRACE_EVENT_INSTANT0("all", "not recorded; system shutdown",
+ TRACE_EVENT_SCOPE_THREAD);
TRACE_EVENT_BEGIN0("all", "not recorded; system shutdown");
TRACE_EVENT_END0("all", "not recorded; system shutdown");
TRACE_EVENT0("new category 0!", "not recorded; system shutdown");
- TRACE_EVENT_INSTANT0("new category 1!", "not recorded; system shutdown");
+ TRACE_EVENT_INSTANT0("new category 1!", "not recorded; system shutdown",
+ TRACE_EVENT_SCOPE_THREAD);
TRACE_EVENT_BEGIN0("new category 2!", "not recorded; system shutdown");
TRACE_EVENT_END0("new category 3!", "not recorded; system shutdown");
@@ -1371,7 +1399,8 @@ TEST_F(TraceEventTestFixture, NormallyNoDeepCopy) {
std::string name_string("event name");
BeginTrace();
- TRACE_EVENT_INSTANT0("category", name_string.c_str());
+ TRACE_EVENT_INSTANT0("category", name_string.c_str(),
+ TRACE_EVENT_SCOPE_THREAD);
// Modify the string in place (a wholesale reassignment may leave the old
// string intact on the heap).
@@ -1398,7 +1427,8 @@ TEST_F(TraceEventTestFixture, DeepCopy) {
std::string val2("val2");
BeginTrace();
- TRACE_EVENT_COPY_INSTANT0("category", name1.c_str());
+ TRACE_EVENT_COPY_INSTANT0("category", name1.c_str(),
+ TRACE_EVENT_SCOPE_THREAD);
TRACE_EVENT_COPY_BEGIN1("category", name2.c_str(),
arg1.c_str(), 5);
TRACE_EVENT_COPY_END2("category", name3.c_str(),
@@ -1462,12 +1492,12 @@ TEST_F(TraceEventTestFixture, TracingIsLazy) {
BeginTrace();
int a = 0;
- TRACE_EVENT_INSTANT1("category", "test", "a", a++);
+ TRACE_EVENT_INSTANT1("category", "test", TRACE_EVENT_SCOPE_THREAD, "a", a++);
EXPECT_EQ(1, a);
TraceLog::GetInstance()->SetDisabled();
- TRACE_EVENT_INSTANT1("category", "test", "a", a++);
+ TRACE_EVENT_INSTANT1("category", "test", TRACE_EVENT_SCOPE_THREAD, "a", a++);
EXPECT_EQ(1, a);
EndTraceAndFlush();
@@ -1595,14 +1625,15 @@ class TraceEventCallbackTest : public TraceEventTestFixture {
TraceEventCallbackTest* TraceEventCallbackTest::s_instance;
TEST_F(TraceEventCallbackTest, TraceEventCallback) {
- TRACE_EVENT_INSTANT0("all", "before enable");
+ TRACE_EVENT_INSTANT0("all", "before enable", TRACE_EVENT_SCOPE_GLOBAL);
TraceLog::GetInstance()->SetEnabled(true, TraceLog::RECORD_UNTIL_FULL);
- TRACE_EVENT_INSTANT0("all", "before callback set");
+ TRACE_EVENT_INSTANT0("all", "before callback set", TRACE_EVENT_SCOPE_GLOBAL);
TraceLog::GetInstance()->SetEventCallback(Callback);
- TRACE_EVENT_INSTANT0("all", "event1");
- TRACE_EVENT_INSTANT0("all", "event2");
+ TRACE_EVENT_INSTANT0("all", "event1", TRACE_EVENT_SCOPE_GLOBAL);
+ TRACE_EVENT_INSTANT0("all", "event2", TRACE_EVENT_SCOPE_GLOBAL);
TraceLog::GetInstance()->SetEventCallback(NULL);
- TRACE_EVENT_INSTANT0("all", "after callback removed");
+ TRACE_EVENT_INSTANT0("all", "after callback removed",
+ TRACE_EVENT_SCOPE_GLOBAL);
EXPECT_EQ(2u, collected_events_.size());
EXPECT_EQ("event1", collected_events_[0]);
EXPECT_EQ("event2", collected_events_[1]);
diff --git a/base/test/trace_event_analyzer_unittest.cc b/base/test/trace_event_analyzer_unittest.cc
index 6004341..33cacbf 100644
--- a/base/test/trace_event_analyzer_unittest.cc
+++ b/base/test/trace_event_analyzer_unittest.cc
@@ -208,10 +208,10 @@ TEST_F(TraceEventAnalyzerTest, BooleanOperators) {
BeginTracing();
{
- TRACE_EVENT_INSTANT1("cat1", "name1", "num", 1);
- TRACE_EVENT_INSTANT1("cat1", "name2", "num", 2);
- TRACE_EVENT_INSTANT1("cat2", "name3", "num", 3);
- TRACE_EVENT_INSTANT1("cat2", "name4", "num", 4);
+ TRACE_EVENT_INSTANT1("cat1", "name1", TRACE_EVENT_SCOPE_THREAD, "num", 1);
+ TRACE_EVENT_INSTANT1("cat1", "name2", TRACE_EVENT_SCOPE_THREAD, "num", 2);
+ TRACE_EVENT_INSTANT1("cat2", "name3", TRACE_EVENT_SCOPE_THREAD, "num", 3);
+ TRACE_EVENT_INSTANT1("cat2", "name4", TRACE_EVENT_SCOPE_THREAD, "num", 4);
}
EndTracing();
@@ -293,11 +293,15 @@ TEST_F(TraceEventAnalyzerTest, ArithmeticOperators) {
BeginTracing();
{
// These events are searched for:
- TRACE_EVENT_INSTANT2("cat1", "math1", "a", 10, "b", 5);
- TRACE_EVENT_INSTANT2("cat1", "math2", "a", 10, "b", 10);
+ TRACE_EVENT_INSTANT2("cat1", "math1", TRACE_EVENT_SCOPE_THREAD,
+ "a", 10, "b", 5);
+ TRACE_EVENT_INSTANT2("cat1", "math2", TRACE_EVENT_SCOPE_THREAD,
+ "a", 10, "b", 10);
// Extra events that never match, for noise:
- TRACE_EVENT_INSTANT2("noise", "math3", "a", 1, "b", 3);
- TRACE_EVENT_INSTANT2("noise", "math4", "c", 10, "d", 5);
+ TRACE_EVENT_INSTANT2("noise", "math3", TRACE_EVENT_SCOPE_THREAD,
+ "a", 1, "b", 3);
+ TRACE_EVENT_INSTANT2("noise", "math4", TRACE_EVENT_SCOPE_THREAD,
+ "c", 10, "d", 5);
}
EndTracing();
@@ -349,10 +353,10 @@ TEST_F(TraceEventAnalyzerTest, StringPattern) {
BeginTracing();
{
- TRACE_EVENT_INSTANT0("cat1", "name1");
- TRACE_EVENT_INSTANT0("cat1", "name2");
- TRACE_EVENT_INSTANT0("cat1", "no match");
- TRACE_EVENT_INSTANT0("cat1", "name3x");
+ TRACE_EVENT_INSTANT0("cat1", "name1", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cat1", "name2", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cat1", "no match", TRACE_EVENT_SCOPE_THREAD);
+ TRACE_EVENT_INSTANT0("cat1", "name3x", TRACE_EVENT_SCOPE_THREAD);
}
EndTracing();
@@ -393,7 +397,8 @@ TEST_F(TraceEventAnalyzerTest, Duration) {
TRACE_EVENT0("noise", "name2"); // not searched for, just noise
{
TRACE_EVENT0("cat2", "name3"); // found by duration query
- TRACE_EVENT_INSTANT0("noise", "name4"); // not searched for, just noise
+ // next event not searched for, just noise
+ TRACE_EVENT_INSTANT0("noise", "name4", TRACE_EVENT_SCOPE_THREAD);
base::debug::HighResSleepForTraceTest(kSleepTime);
TRACE_EVENT0("cat2", "name5"); // not found (duration too short)
}
@@ -426,7 +431,7 @@ TEST_F(TraceEventAnalyzerTest, BeginEndAssocations) {
{
TRACE_EVENT_END0("cat1", "name1"); // does not match out of order begin
TRACE_EVENT0("cat1", "name2");
- TRACE_EVENT_INSTANT0("cat1", "name3");
+ TRACE_EVENT_INSTANT0("cat1", "name3", TRACE_EVENT_SCOPE_THREAD);
TRACE_EVENT_BEGIN0("cat1", "name1");
}
EndTracing();
@@ -479,7 +484,7 @@ TEST_F(TraceEventAnalyzerTest, AsyncBeginEndAssocations) {
TRACE_EVENT_ASYNC_END0("cat1", "name1", 0xA); // no match / out of order
TRACE_EVENT_ASYNC_BEGIN0("cat1", "name1", 0xB);
TRACE_EVENT_ASYNC_BEGIN0("cat1", "name1", 0xC);
- TRACE_EVENT_INSTANT0("cat1", "name1"); // noise
+ TRACE_EVENT_INSTANT0("cat1", "name1", TRACE_EVENT_SCOPE_THREAD); // noise
TRACE_EVENT0("cat1", "name1"); // noise
TRACE_EVENT_ASYNC_END0("cat1", "name1", 0xB);
TRACE_EVENT_ASYNC_END0("cat1", "name1", 0xC);
@@ -559,12 +564,16 @@ TEST_F(TraceEventAnalyzerTest, CustomAssociations) {
// to match up the begin/end pairs.
BeginTracing();
{
- TRACE_EVENT_INSTANT1("cat1", "end", "id", 1); // no begin match
- TRACE_EVENT_INSTANT1("cat2", "begin", "id", 2); // end is cat4
- TRACE_EVENT_INSTANT1("cat3", "begin", "id", 3); // end is cat5
- TRACE_EVENT_INSTANT1("cat4", "end", "id", 2);
- TRACE_EVENT_INSTANT1("cat5", "end", "id", 3);
- TRACE_EVENT_INSTANT1("cat6", "begin", "id", 1); // no end match
+ // no begin match
+ TRACE_EVENT_INSTANT1("cat1", "end", TRACE_EVENT_SCOPE_THREAD, "id", 1);
+ // end is cat4
+ TRACE_EVENT_INSTANT1("cat2", "begin", TRACE_EVENT_SCOPE_THREAD, "id", 2);
+ // end is cat5
+ TRACE_EVENT_INSTANT1("cat3", "begin", TRACE_EVENT_SCOPE_THREAD, "id", 3);
+ TRACE_EVENT_INSTANT1("cat4", "end", TRACE_EVENT_SCOPE_THREAD, "id", 2);
+ TRACE_EVENT_INSTANT1("cat5", "end", TRACE_EVENT_SCOPE_THREAD, "id", 3);
+ // no end match
+ TRACE_EVENT_INSTANT1("cat6", "begin", TRACE_EVENT_SCOPE_THREAD, "id", 1);
}
EndTracing();
diff --git a/cc/animation/animation.cc b/cc/animation/animation.cc
index e0e7e7c..6708620 100644
--- a/cc/animation/animation.cc
+++ b/cc/animation/animation.cc
@@ -124,6 +124,7 @@ void Animation::SetRunState(RunState run_state, double monotonic_time) {
TRACE_EVENT_INSTANT2("cc",
"LayerAnimationController::SetRunState",
+ TRACE_EVENT_SCOPE_THREAD,
"Name",
TRACE_STR_COPY(name_buffer),
"State",
diff --git a/cc/base/worker_pool.cc b/cc/base/worker_pool.cc
index 25596d4..469f67c6 100644
--- a/cc/base/worker_pool.cc
+++ b/cc/base/worker_pool.cc
@@ -549,7 +549,8 @@ void WorkerPool::RunCheapTasks() {
base::TimeTicks now = base::TimeTicks::Now();
if (now >= run_cheap_tasks_time_limit_) {
- TRACE_EVENT_INSTANT0("cc", "WorkerPool::RunCheapTasks out of time");
+ TRACE_EVENT_INSTANT0("cc", "WorkerPool::RunCheapTasks out of time",
+ TRACE_EVENT_SCOPE_THREAD);
break;
}
@@ -558,7 +559,8 @@ void WorkerPool::RunCheapTasks() {
now < check_for_completed_tasks_time_)
break;
- TRACE_EVENT_INSTANT0("cc", "WorkerPool::RunCheapTasks check time");
+ TRACE_EVENT_INSTANT0("cc", "WorkerPool::RunCheapTasks check time",
+ TRACE_EVENT_SCOPE_THREAD);
CancelCheckForCompletedTasks();
DispatchCompletionCallbacks();
// Schedule another check for completed tasks if not idle.
diff --git a/cc/layers/scrollbar_layer.cc b/cc/layers/scrollbar_layer.cc
index be1ecfe..d251d62 100644
--- a/cc/layers/scrollbar_layer.cc
+++ b/cc/layers/scrollbar_layer.cc
@@ -336,7 +336,8 @@ void ScrollbarLayer::UpdatePart(CachingBitmapContentLayerUpdater* painter,
if (!painter->pixels_did_change() &&
resource->texture()->have_backing_texture()) {
TRACE_EVENT_INSTANT0("cc",
- "ScrollbarLayer::UpdatePart no texture upload needed");
+ "ScrollbarLayer::UpdatePart no texture upload needed",
+ TRACE_EVENT_SCOPE_THREAD);
return;
}
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index 65c2e9e..2854b4d 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -370,8 +370,8 @@ void TileManager::ManageTiles() {
// Assign gpu memory and determine what tiles need to be rasterized.
AssignGpuMemoryToTiles();
- TRACE_EVENT_INSTANT1("cc", "DidManage", "state",
- ValueToString(BasicStateAsValue()));
+ TRACE_EVENT_INSTANT1("cc", "DidManage", TRACE_EVENT_SCOPE_THREAD,
+ "state", ValueToString(BasicStateAsValue()));
// Finally, kick the rasterizer.
DispatchMoreTasks();
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 20ba6e4..216b9bc 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -510,7 +510,8 @@ void LayerTreeHost::SetNeedsAnimate() {
void LayerTreeHost::SetNeedsCommit() {
if (!prepaint_callback_.IsCancelled()) {
TRACE_EVENT_INSTANT0("cc",
- "LayerTreeHost::SetNeedsCommit::cancel prepaint");
+ "LayerTreeHost::SetNeedsCommit::cancel prepaint",
+ TRACE_EVENT_SCOPE_THREAD);
prepaint_callback_.Cancel();
}
proxy_->SetNeedsCommit();
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 772c268..1501b0e 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -298,7 +298,8 @@ static bool SubtreeShouldRenderToSeparateSurface(
num_descendants_that_draw_content > 0) {
TRACE_EVENT_INSTANT0(
"cc",
- "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface flattening");
+ "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface flattening",
+ TRACE_EVENT_SCOPE_THREAD);
return true;
}
@@ -310,7 +311,8 @@ static bool SubtreeShouldRenderToSeparateSurface(
!layer->draw_properties().descendants_can_clip_selves) {
TRACE_EVENT_INSTANT0(
"cc",
- "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface clipping");
+ "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface clipping",
+ TRACE_EVENT_SCOPE_THREAD);
return true;
}
@@ -327,7 +329,8 @@ static bool SubtreeShouldRenderToSeparateSurface(
at_least_two_layers_in_subtree_draw_content) {
TRACE_EVENT_INSTANT0(
"cc",
- "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface opacity");
+ "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface opacity",
+ TRACE_EVENT_SCOPE_THREAD);
return true;
}
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 36659f5..080821d3 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -238,25 +238,30 @@ bool LayerTreeHostImpl::CanDraw() {
// NotifyIfCanDrawChanged test.
if (!active_tree_->root_layer()) {
- TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer");
+ TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer",
+ TRACE_EVENT_SCOPE_THREAD);
return false;
}
if (device_viewport_size_.IsEmpty()) {
- TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw empty viewport");
+ TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw empty viewport",
+ TRACE_EVENT_SCOPE_THREAD);
return false;
}
if (active_tree_->ViewportSizeInvalid()) {
TRACE_EVENT_INSTANT0(
- "cc", "LayerTreeHostImpl::CanDraw viewport size recently changed");
+ "cc", "LayerTreeHostImpl::CanDraw viewport size recently changed",
+ TRACE_EVENT_SCOPE_THREAD);
return false;
}
if (!renderer_) {
- TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no renderer");
+ TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no renderer",
+ TRACE_EVENT_SCOPE_THREAD);
return false;
}
if (active_tree_->ContentsTexturesPurged()) {
TRACE_EVENT_INSTANT0(
- "cc", "LayerTreeHostImpl::CanDraw contents textures purged");
+ "cc", "LayerTreeHostImpl::CanDraw contents textures purged",
+ TRACE_EVENT_SCOPE_THREAD);
return false;
}
return true;
@@ -974,7 +979,7 @@ void LayerTreeHostImpl::DrawLayers(FrameData* frame,
}
if (debug_state_.trace_all_rendered_frames) {
- TRACE_EVENT_INSTANT1("cc.debug", "Frame",
+ TRACE_EVENT_INSTANT1("cc.debug", "Frame", TRACE_EVENT_SCOPE_THREAD,
"frame", ValueToString(FrameStateAsValue()));
}
@@ -1908,7 +1913,8 @@ void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer,
layer->scrollbar_animation_controller();
if (scrollbar_controller && scrollbar_controller->Animate(time)) {
TRACE_EVENT_INSTANT0(
- "cc", "LayerTreeHostImpl::SetNeedsRedraw due to AnimateScrollbars");
+ "cc", "LayerTreeHostImpl::SetNeedsRedraw due to AnimateScrollbars",
+ TRACE_EVENT_SCOPE_THREAD);
client_->SetNeedsRedrawOnImplThread();
}
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 264c11f..f217d01 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -824,7 +824,7 @@ void ThreadProxy::ScheduledActionCommit() {
layer_tree_host_->BlocksPendingCommit()) {
// For some layer types in impl-side painting, the commit is held until
// the pending tree is activated.
- TRACE_EVENT_INSTANT0("cc", "HoldCommit");
+ TRACE_EVENT_INSTANT0("cc", "HoldCommit", TRACE_EVENT_SCOPE_THREAD);
completion_event_for_commit_held_on_tree_activation_ =
commit_completion_event_on_impl_thread_;
commit_completion_event_on_impl_thread_ = NULL;
@@ -910,7 +910,8 @@ ThreadProxy::ScheduledActionDrawAndSwapInternal(bool forced_draw) {
// Check for tree activation.
if (completion_event_for_commit_held_on_tree_activation_ &&
!layer_tree_host_impl_->pending_tree()) {
- TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation");
+ TRACE_EVENT_INSTANT0("cc", "ReleaseCommitbyActivation",
+ TRACE_EVENT_SCOPE_THREAD);
DCHECK(layer_tree_host_impl_->settings().impl_side_painting);
completion_event_for_commit_held_on_tree_activation_->Signal();
completion_event_for_commit_held_on_tree_activation_ = NULL;
diff --git a/chrome/test/base/tracing_browsertest.cc b/chrome/test/base/tracing_browsertest.cc
index 0d05f95..6ed8201 100644
--- a/chrome/test/base/tracing_browsertest.cc
+++ b/chrome/test/base/tracing_browsertest.cc
@@ -39,7 +39,7 @@ class TracingBrowserTest : public InProcessBrowserTest {
void AddEvents(int num) {
for (int i = 0; i < num; ++i)
- TRACE_EVENT_INSTANT0(g_category, g_event);
+ TRACE_EVENT_INSTANT0(g_category, g_event, TRACE_EVENT_SCOPE_THREAD);
}
IN_PROC_BROWSER_TEST_F(TracingBrowserTest, BeginTracingWithWatch) {
diff --git a/chrome/test/perf/rendering/latency_tests.cc b/chrome/test/perf/rendering/latency_tests.cc
index b1962c5..70939fd 100644
--- a/chrome/test/perf/rendering/latency_tests.cc
+++ b/chrome/test/perf/rendering/latency_tests.cc
@@ -659,7 +659,8 @@ void LatencyTest::SendInput() {
// so that it is between the top and bottom of the canvas.
mouse_event.y = mouse_event.windowY = 5;
mouse_event.type = WebKit::WebInputEvent::MouseMove;
- TRACE_EVENT_INSTANT1("test_latency", "MouseEventBegin", "x", mouse_x_);
+ TRACE_EVENT_INSTANT1("test_latency", "MouseEventBegin",
+ TRACE_EVENT_SCOPE_THREAD, "x", mouse_x_);
rvh->ForwardMouseEvent(mouse_event);
}
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 4b7feb6..e85329f 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -749,7 +749,8 @@ void BrowserMainLoop::BrowserThreadsStarted() {
!parsed_command_line_.HasSwitch(switches::kDisableGpuProcessPrelaunch) &&
!parsed_command_line_.HasSwitch(switches::kSingleProcess) &&
!parsed_command_line_.HasSwitch(switches::kInProcessGPU)) {
- TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process");
+ TRACE_EVENT_INSTANT0("gpu", "Post task to launch GPU process",
+ TRACE_EVENT_SCOPE_THREAD);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE, base::Bind(
base::IgnoreResult(&GpuProcessHost::Get),
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 699ce42..f43ee62 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -632,7 +632,7 @@ GpuProcessHost::~GpuProcessHost() {
bool GpuProcessHost::Init() {
init_start_time_ = base::TimeTicks::Now();
- TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess");
+ TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD);
std::string channel_id = process_->GetHost()->CreateChannel();
if (channel_id.empty())
diff --git a/content/browser/renderer_host/compositing_iosurface_mac.mm b/content/browser/renderer_host/compositing_iosurface_mac.mm
index c433286..22f2de2 100644
--- a/content/browser/renderer_host/compositing_iosurface_mac.mm
+++ b/content/browser/renderer_host/compositing_iosurface_mac.mm
@@ -476,7 +476,8 @@ void CompositingIOSurfaceMac::DrawIOSurface(
CGLFlushDrawable(cglContext_);
// For latency_tests.cc:
- UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete");
+ UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete",
+ TRACE_EVENT_SCOPE_THREAD);
// Try to finish previous copy requests after flush to get better pipelining.
std::vector<base::Closure> copy_done_callbacks;
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index f81a876..4808cc1 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -82,7 +82,8 @@ void Compositor::Initialize() {
void Compositor::InitializeWithFlags(uint32 flags) {
g_use_direct_gl = flags & DIRECT_CONTEXT_ON_DRAW_THREAD;
if (flags & ENABLE_COMPOSITOR_THREAD) {
- TRACE_EVENT_INSTANT0("test_gpu", "ThreadedCompositingInitialization");
+ TRACE_EVENT_INSTANT0("test_gpu", "ThreadedCompositingInitialization",
+ TRACE_EVENT_SCOPE_THREAD);
g_impl_thread = new webkit_glue::WebThreadImpl("Browser Compositor");
}
Compositor::Initialize();
diff --git a/content/browser/renderer_host/media/web_contents_video_capture_device.cc b/content/browser/renderer_host/media/web_contents_video_capture_device.cc
index 97eeda3..9e67ee0 100644
--- a/content/browser/renderer_host/media/web_contents_video_capture_device.cc
+++ b/content/browser/renderer_host/media/web_contents_video_capture_device.cc
@@ -456,6 +456,7 @@ bool CaptureOracle::ObserveEventAndDecideCapture(
// Step 3: Consider the various reasons not to initiate a capture.
if (should_sample && !output_buffer) {
TRACE_EVENT_INSTANT1("mirroring", "EncodeLimited",
+ TRACE_EVENT_SCOPE_THREAD,
"trigger", event_name);
return false;
} else if (!should_sample && output_buffer) {
@@ -464,6 +465,7 @@ bool CaptureOracle::ObserveEventAndDecideCapture(
// capture rate limit: for example, the content is animating at 60fps but
// we're capturing at 30fps.
TRACE_EVENT_INSTANT1("mirroring", "FpsRateLimited",
+ TRACE_EVENT_SCOPE_THREAD,
"trigger", event_name);
}
return false;
@@ -471,6 +473,7 @@ bool CaptureOracle::ObserveEventAndDecideCapture(
// We decided not to capture, but we wouldn't have been able to if we wanted
// to because no output buffer was available.
TRACE_EVENT_INSTANT1("mirroring", "NearlyEncodeLimited",
+ TRACE_EVENT_SCOPE_THREAD,
"trigger", event_name);
return false;
}
@@ -505,7 +508,8 @@ void CaptureOracle::ReportError() {
void CaptureOracle::InvalidateConsumer() {
base::AutoLock guard(lock_);
- TRACE_EVENT_INSTANT0("mirroring", "InvalidateConsumer");
+ TRACE_EVENT_INSTANT0("mirroring", "InvalidateConsumer",
+ TRACE_EVENT_SCOPE_THREAD);
is_started_ = false;
consumer_ = NULL;
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 4b02fda..32a6312 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1673,9 +1673,11 @@ void RenderWidgetHostImpl::OnUpdateRect(
GetProcess()->ReceivedBadMessage();
} else {
UNSHIPPED_TRACE_EVENT_INSTANT2("test_latency", "UpdateRect",
+ TRACE_EVENT_SCOPE_THREAD,
"x+y", params.bitmap_rect.x() + params.bitmap_rect.y(),
"color", 0xffffff & *static_cast<uint32*>(dib->memory()));
UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectWidth",
+ TRACE_EVENT_SCOPE_THREAD,
"width", params.bitmap_rect.width());
// Scroll the backing store.
@@ -1788,6 +1790,7 @@ void RenderWidgetHostImpl::DidUpdateBackingStore(
delta = now - paint_start;
UMA_HISTOGRAM_TIMES("MPArch.RWH_TotalPaintTime", delta);
UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectComplete",
+ TRACE_EVENT_SCOPE_THREAD,
"x+y", params.bitmap_rect.x() + params.bitmap_rect.y());
}
@@ -1874,7 +1877,8 @@ void RenderWidgetHostImpl::TickActiveSmoothScrollGesture() {
TRACE_EVENT0("input", "RenderWidgetHostImpl::TickActiveSmoothScrollGesture");
tick_active_smooth_scroll_gestures_task_posted_ = false;
if (active_smooth_scroll_gestures_.empty()) {
- TRACE_EVENT_INSTANT0("input", "EarlyOut_NoActiveScrollGesture");
+ TRACE_EVENT_INSTANT0("input", "EarlyOut_NoActiveScrollGesture",
+ TRACE_EVENT_SCOPE_THREAD);
return;
}
@@ -1886,7 +1890,7 @@ void RenderWidgetHostImpl::TickActiveSmoothScrollGesture() {
now;
if (time_until_next_ideal_interval.InMilliseconds() > 0) {
TRACE_EVENT_INSTANT1(
- "input", "EarlyOut_TickedTooRecently",
+ "input", "EarlyOut_TickedTooRecently", TRACE_EVENT_SCOPE_THREAD,
"delay", time_until_next_ideal_interval.InMilliseconds());
// Post a task.
tick_active_smooth_scroll_gestures_task_posted_ = true;
@@ -1927,7 +1931,7 @@ void RenderWidgetHostImpl::TickActiveSmoothScrollGesture() {
if (!in_process_event_types_.empty())
return;
- TRACE_EVENT_INSTANT1("input", "PostTickTask",
+ TRACE_EVENT_INSTANT1("input", "PostTickTask", TRACE_EVENT_SCOPE_THREAD,
"delay", preferred_interval.InMilliseconds());
tick_active_smooth_scroll_gestures_task_posted_ = true;
MessageLoop::current()->PostDelayedTask(
diff --git a/content/common/android/trace_event_binding.cc b/content/common/android/trace_event_binding.cc
index 04607ed..ec70335c 100644
--- a/content/common/android/trace_event_binding.cc
+++ b/content/common/android/trace_event_binding.cc
@@ -89,9 +89,11 @@ static void Instant(JNIEnv* env, jclass clazz,
TraceEventDataConverter converter(env, jname, jarg);
if (converter.arg()) {
TRACE_EVENT_COPY_INSTANT1(kJavaCategory, converter.name(),
+ TRACE_EVENT_SCOPE_THREAD,
converter.arg_name(), converter.arg());
} else {
- TRACE_EVENT_COPY_INSTANT0(kJavaCategory, converter.name());
+ TRACE_EVENT_COPY_INSTANT0(kJavaCategory, converter.name(),
+ TRACE_EVENT_SCOPE_THREAD);
}
}
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc
index 445f184..0ca70f6 100644
--- a/content/common/gpu/image_transport_surface.cc
+++ b/content/common/gpu/image_transport_surface.cc
@@ -68,6 +68,7 @@ void ImageTransportHelper::SendAcceleratedSurfaceBuffersSwapped(
GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params) {
// TRACE_EVENT for gpu tests:
TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffers",
+ TRACE_EVENT_SCOPE_THREAD,
"GLImpl", static_cast<int>(gfx::GetGLImplementation()),
"width", params.size.width());
params.surface_id = stub_->surface_id();
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index b1a51cf..1031606 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -5075,7 +5075,8 @@ void RenderViewImpl::OnScriptEvalRequest(const string16& frame_xpath,
const string16& jscript,
int id,
bool notify_result) {
- TRACE_EVENT_INSTANT0("test_tracing", "OnScriptEvalRequest");
+ TRACE_EVENT_INSTANT0("test_tracing", "OnScriptEvalRequest",
+ TRACE_EVENT_SCOPE_THREAD);
EvaluateScript(frame_xpath, jscript, id, notify_result);
}
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 23511ac..b12d3cf 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -1235,7 +1235,8 @@ void RenderWidget::DoDeferredUpdate() {
// Software FPS tick for performance tests. The accelerated path traces the
// frame events in didCommitAndDrawCompositorFrame. See throughput_tests.cc.
// NOTE: Tests may break if this event is renamed or moved.
- UNSHIPPED_TRACE_EVENT_INSTANT0("test_fps", "TestFrameTickSW");
+ UNSHIPPED_TRACE_EVENT_INSTANT0("test_fps", "TestFrameTickSW",
+ TRACE_EVENT_SCOPE_THREAD);
} else { // Accelerated compositing path
// Begin painting.
// If painting is done via the gpu process then we don't set any damage
@@ -1476,7 +1477,8 @@ void RenderWidget::didCommitAndDrawCompositorFrame() {
TRACE_EVENT0("gpu", "RenderWidget::didCommitAndDrawCompositorFrame");
// Accelerated FPS tick for performance tests. See throughput_tests.cc.
// NOTE: Tests may break if this event is renamed or moved.
- UNSHIPPED_TRACE_EVENT_INSTANT0("test_fps", "TestFrameTickGPU");
+ UNSHIPPED_TRACE_EVENT_INSTANT0("test_fps", "TestFrameTickGPU",
+ TRACE_EVENT_SCOPE_THREAD);
// Notify subclasses that we initiated the paint operation.
DidInitiatePaint();
}
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 95636b2..ec5b2ab 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -4771,6 +4771,7 @@ error::Error GLES2DecoderImpl::DoClear(GLbitfield mask) {
if (CheckBoundFramebuffersValid("glClear")) {
UNSHIPPED_TRACE_EVENT_INSTANT2(
"test_gpu", "DoClear",
+ TRACE_EVENT_SCOPE_THREAD,
"red", state_.color_clear_red,
"green", state_.color_clear_green);
ApplyDirtyState();
@@ -5054,7 +5055,8 @@ void GLES2DecoderImpl::DoBlitFramebufferEXT(
srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
}
EnableDisable(GL_SCISSOR_TEST, state_.enable_flags.scissor_test);
- UNSHIPPED_TRACE_EVENT_INSTANT1("test_gpu", "DoBlit", "width", srcX1 - srcX0);
+ UNSHIPPED_TRACE_EVENT_INSTANT1("test_gpu", "DoBlit", TRACE_EVENT_SCOPE_THREAD,
+ "width", srcX1 - srcX0);
}
void GLES2DecoderImpl::DoRenderbufferStorageMultisample(
@@ -8880,6 +8882,7 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers(
int this_frame_number = frame_number_++;
// TRACE_EVENT for gpu tests:
TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency",
+ TRACE_EVENT_SCOPE_THREAD,
"GLImpl", static_cast<int>(gfx::GetGLImplementation()),
"width", (is_offscreen ? offscreen_size_.width() :
surface_->GetSize().width()));
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
index 0a49791..87dffe9 100644
--- a/ui/gl/gl_surface_glx.cc
+++ b/ui/gl/gl_surface_glx.cc
@@ -197,7 +197,7 @@ class SGIVideoSyncProviderThreadShim
if (glXWaitVideoSyncSGI(1, 0, &retrace_count) != 0)
return;
- TRACE_EVENT_INSTANT0("gpu", "vblank");
+ TRACE_EVENT_INSTANT0("gpu", "vblank", TRACE_EVENT_SCOPE_THREAD);
now = base::TimeTicks::HighResNow();
glXMakeCurrent(display_, 0, 0);
@@ -429,7 +429,8 @@ bool NativeViewGLSurfaceGLX::IsOffscreen() {
bool NativeViewGLSurfaceGLX::SwapBuffers() {
glXSwapBuffers(g_display, window_);
// For latency_tests.cc:
- UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete");
+ UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete",
+ TRACE_EVENT_SCOPE_THREAD);
return true;
}
diff --git a/ui/surface/accelerated_surface_win.cc b/ui/surface/accelerated_surface_win.cc
index 3d88f70..92d81d2 100644
--- a/ui/surface/accelerated_surface_win.cc
+++ b/ui/surface/accelerated_surface_win.cc
@@ -775,7 +775,8 @@ void AcceleratedPresenter::DoPresentAndAcknowledge(
hr = swap_chain_->Present(&rect, &rect, window_, NULL, 0);
// For latency_tests.cc:
- UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete");
+ UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete",
+ TRACE_EVENT_SCOPE_THREAD);
if (FAILED(hr)) {
if (present_thread_->IsDeviceLost())
@@ -954,7 +955,8 @@ void AcceleratedPresenter::PresentWithGDI(HDC dc) {
system_surface->UnlockRect();
// For latency_tests.cc:
- UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete");
+ UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "CompositorSwapBuffersComplete",
+ TRACE_EVENT_SCOPE_THREAD);
}
gfx::Size AcceleratedPresenter::GetWindowSize() {