Commit ab858cb6 authored by Salvador Guerrero's avatar Salvador Guerrero Committed by Chromium LUCI CQ

Removed unneeded metadata fields from trace log

This removes process_name and thread_name from trace log, these fields
are now recorded in perfetto, so it's not necessary to record them
client side.

Change-Id: I6591c25d572cd97b54d024ffcb3dcc00597d63fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2640819Reviewed-by: default avatarssid <ssid@chromium.org>
Commit-Queue: Salvador Guerrero <salg@google.com>
Cr-Commit-Position: refs/heads/master@{#846445}
parent 3b567ed1
...@@ -1686,43 +1686,6 @@ TEST_F(TraceEventTestFixture, ThreadNames) { ...@@ -1686,43 +1686,6 @@ TEST_F(TraceEventTestFixture, ThreadNames) {
} }
} }
TEST_F(TraceEventTestFixture, ThreadNameChanges) {
BeginTrace();
PlatformThread::SetName("");
TRACE_EVENT_INSTANT0("drink", "water", TRACE_EVENT_SCOPE_THREAD);
PlatformThread::SetName("cafe");
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_SCOPE_THREAD);
TRACE_EVENT_INSTANT0("drink", "wine", TRACE_EVENT_SCOPE_THREAD);
PlatformThread::SetName(" bar");
TRACE_EVENT_INSTANT0("drink", "whisky", TRACE_EVENT_SCOPE_THREAD);
EndTraceAndFlush();
std::vector<const DictionaryValue*> items =
FindTraceEntries(trace_parsed_, "thread_name");
EXPECT_EQ(1u, items.size());
ASSERT_GT(items.size(), 0u);
const DictionaryValue* item = items[0];
ASSERT_TRUE(item);
int tid;
EXPECT_TRUE(item->GetInteger("tid", &tid));
EXPECT_EQ(PlatformThread::CurrentId(), static_cast<PlatformThreadId>(tid));
std::string expected_name = "cafe,pub, bar";
std::string tmp;
EXPECT_TRUE(item->GetString("args.name", &tmp));
EXPECT_EQ(expected_name, tmp);
}
// Test that the disabled trace categories are included/excluded from the // Test that the disabled trace categories are included/excluded from the
// trace output correctly. // trace output correctly.
TEST_F(TraceEventTestFixture, DisabledCategories) { TEST_F(TraceEventTestFixture, DisabledCategories) {
......
...@@ -1579,11 +1579,6 @@ void TraceLog::AddMetadataEventsWhileLocked() { ...@@ -1579,11 +1579,6 @@ void TraceLog::AddMetadataEventsWhileLocked() {
"sort_index", process_sort_index_); "sort_index", process_sort_index_);
} }
if (!process_name_.empty()) {
AddMetadataEventWhileLocked(current_thread_id, "process_name", "name",
process_name_);
}
TimeDelta process_uptime = TRACE_TIME_NOW() - process_creation_time_; TimeDelta process_uptime = TRACE_TIME_NOW() - process_creation_time_;
AddMetadataEventWhileLocked(current_thread_id, "process_uptime_seconds", AddMetadataEventWhileLocked(current_thread_id, "process_uptime_seconds",
"uptime", process_uptime.InSeconds()); "uptime", process_uptime.InSeconds());
...@@ -1617,16 +1612,6 @@ void TraceLog::AddMetadataEventsWhileLocked() { ...@@ -1617,16 +1612,6 @@ void TraceLog::AddMetadataEventsWhileLocked() {
it.second); it.second);
} }
// TODO(ssid): Stop emitting and tracking thread names when perfetto is
// enabled and after crbug/978093 if fixed. The JSON exporter will emit thread
// names from thread descriptors.
AutoLock thread_info_lock(thread_info_lock_);
for (const auto& it : thread_names_) {
if (it.second.empty())
continue;
AddMetadataEventWhileLocked(it.first, "thread_name", "name", it.second);
}
// If buffer is full, add a metadata record to report this. // If buffer is full, add a metadata record to report this.
if (!buffer_limit_reached_timestamp_.is_null()) { if (!buffer_limit_reached_timestamp_.is_null()) {
AddMetadataEventWhileLocked(current_thread_id, "trace_buffer_overflowed", AddMetadataEventWhileLocked(current_thread_id, "trace_buffer_overflowed",
......
...@@ -50,6 +50,7 @@ const char* const kMemoryPressureEventsAllowedArgs[] = { ...@@ -50,6 +50,7 @@ const char* const kMemoryPressureEventsAllowedArgs[] = {
"level", "listener_creation_info", nullptr}; "level", "listener_creation_info", nullptr};
const AllowlistEntry kEventArgsAllowlist[] = { const AllowlistEntry kEventArgsAllowlist[] = {
// Thread and process names are now recorded in perfetto.
{"__metadata", "thread_name", nullptr}, {"__metadata", "thread_name", nullptr},
{"__metadata", "process_name", nullptr}, {"__metadata", "process_name", nullptr},
{"__metadata", "process_uptime_seconds", nullptr}, {"__metadata", "process_uptime_seconds", nullptr},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment