Commit 5a40f118 authored by Siddhartha S's avatar Siddhartha S Committed by Commit Bot

Reland "tracing: Add thread names and types to perfetto traces and roll perfetto"

This reverts commit bfb7d0c3.

Reason for revert: Roll after perfetto fix

Roll src/third_party/perfetto/ fc15cad36..f80d2d4f0 (27 commits)

https://android.googlesource.com/platform/external/perfetto.git/+log/fc15cad36895..f80d2d4f0a64

$ git log fc15cad36..f80d2d4f0 --date=short --no-merges --format='%ad %ae %s'
2019-06-05 primiano@google.com Disable metatrace_unittest on windows builds
2019-06-05 primiano@google.com Speculative fix of windows build
2019-06-05 eseckler@google.com service: Fix tracing service unittest build for chromium.
2019-06-04 primiano@google.com Fix races in metatrace unittest and gcc build
2019-06-04 fmayer@google.com Make HeapprofdEndToEnd a parametrized test.
2019-06-04 hjd@google.com typo: the the -> the
2019-06-04 hjd@google.com Reland: perfetto_cmd: add ability to compress trace packets
2019-06-04 fmayer@google.com Fix typo.
2019-06-04 hjd@google.com Revert "perfetto_cmd: add ability to compress trace packets"
2019-06-04 eseckler@google.com tools/idle_alloc: Only build in standalone builds.
2019-06-04 hjd@google.com perfetto_cmd: add ability to compress trace packets
2019-06-04 fmayer@google.com Add missing setsid before fork to avoid leaking children.
2019-06-04 hjd@google.com Make tools/tmux work with fish
2019-06-04 primiano@google.com Move README.md from include/perfetto to include/
2019-06-04 primiano@google.com Improve metatrace, allow to be used in production
2019-06-03 ssid@google.com Fix idle_alloc.cc build
2019-06-03 ssid@google.com Rename the thread names in ChromeThreadType to specify chrome
2019-05-31 kodiobika@google.com Added tests for raw syscall recording
2019-06-03 primiano@google.com Add API usage example for the Android tree
2019-06-03 fmayer@google.com Add docs for idle page tracking.
2019-06-03 eseckler@google.com processor: Parse TrackEvent arguments
2019-06-03 primiano@google.com Add consumer API and --query cmdline to list data sources
2019-06-03 fmayer@google.com Update trace_to_text for heap_profile.
2019-06-03 lalitm@google.com perfetto: add java proto targets and fix compile
2019-06-03 fmayer@google.com Allow to specify data_source_stop_timeout in TraceConfig.
2019-06-03 lalitm@google.com docs: add toc entry and fix some links
2019-05-31 fmayer@google.com Use IDLE bit instead of referenced bit.

Original change's description:
> Revert "tracing: Add thread names and types to perfetto traces and roll perfetto"
>
> This reverts commit 906024f5.
>
> Reason for revert: Perfetto roll seems to break compile: https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8911612852241220240/+/steps/compile/0/stdout?format=raw
>
> Original change's description:
> > tracing: Add thread names and types to perfetto traces and roll perfetto
> >
> > Roll src/third_party/perfetto/ fc15cad36..3cd1230c5 (6 commits)
> >
> > https://android.googlesource.com/platform/external/perfetto.git/+log/fc15cad36895..3cd1230c5eb3
> >
> > $ git log fc15cad36..3cd1230c5 --date=short --no-merges --format='%ad %ae %s'
> > 2019-06-03 ssid Fix idle_alloc.cc build
> > 2019-06-03 ssid Rename the thread names in ChromeThreadType to specify chrome
> > 2019-06-03 fmayer Update trace_to_text for heap_profile.
> > 2019-06-03 lalitm perfetto: add java proto targets and fix compile
> > 2019-06-03 lalitm docs: add toc entry and fix some links
> > 2019-05-31 fmayer Use IDLE bit instead of referenced bit.
> >
> > Created with:
> >   roll-dep src/third_party/perfetto
> >
> > Depends on aosp/973864.
> >
> > Change-Id: Ib57d2b9005fea04673c133e8f5aed19fddcf4a29
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1637680
> > Commit-Queue: ssid <ssid@chromium.org>
> > Reviewed-by: Eric Seckler <eseckler@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#665798}
>
> TBR=ssid@chromium.org,eseckler@chromium.org
>
> Change-Id: I26be2dd8e6af0038f623d4b306124d2b54f758dd
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1642748
> Reviewed-by: Darren Shen <shend@chromium.org>
> Commit-Queue: Darren Shen <shend@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#665805}

TBR=ssid@chromium.org,eseckler@chromium.org,shend@chromium.org

Change-Id: I93290110464f8a2d9ea3c38eaecb33ae002e3ca6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1643652
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Reviewed-by: default avatarssid <ssid@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666217}
parent f2fe6737
...@@ -1187,7 +1187,7 @@ deps = { ...@@ -1187,7 +1187,7 @@ deps = {
}, },
'src/third_party/perfetto': 'src/third_party/perfetto':
Var('android_git') + '/platform/external/perfetto.git' + '@' + 'fc15cad3689508822ab2d0bb0200509ff35dbc8c', Var('android_git') + '/platform/external/perfetto.git' + '@' + 'f80d2d4f0a64cfa3a19b772b83adfdfcda1aaa19',
'src/third_party/perl': { 'src/third_party/perl': {
'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + 'ac0d98b5cee6c024b0cffeb4f8f45b6fc5ccdb78', 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + 'ac0d98b5cee6c024b0cffeb4f8f45b6fc5ccdb78',
......
...@@ -1550,7 +1550,8 @@ void TraceLog::AddMetadataEventsWhileLocked() { ...@@ -1550,7 +1550,8 @@ void TraceLog::AddMetadataEventsWhileLocked() {
it.second); it.second);
} }
// Thread names. // TODO(ssid): Stop emitting and tracking thread names when perfetto is
// enabled. The JSON exporter will emit thread names.
AutoLock thread_info_lock(thread_info_lock_); AutoLock thread_info_lock(thread_info_lock_);
for (const auto& it : thread_names_) { for (const auto& it : thread_names_) {
if (it.second.empty()) if (it.second.empty())
......
...@@ -30,7 +30,6 @@ void OnJsonData(base::File* output_file, ...@@ -30,7 +30,6 @@ void OnJsonData(base::File* output_file,
bool has_more) { bool has_more) {
CHECK_EQ(output_file->WriteAtCurrentPos(json->data(), json->size()), CHECK_EQ(output_file->WriteAtCurrentPos(json->data(), json->size()),
static_cast<int>(json->size())); static_cast<int>(json->size()));
LOG(ERROR) << "Finished writing " << json->size() << " bytes to file.";
} }
void WriteJsonTrace(const std::string& data, base::File* output_file) { void WriteJsonTrace(const std::string& data, base::File* output_file) {
......
...@@ -15,6 +15,7 @@ namespace tracing { ...@@ -15,6 +15,7 @@ namespace tracing {
namespace { namespace {
using ::perfetto::protos::ChromeTracePacket; using ::perfetto::protos::ChromeTracePacket;
using ::perfetto::protos::ThreadDescriptor;
using ::perfetto::protos::TrackEvent; using ::perfetto::protos::TrackEvent;
const std::string& GetInternedName( const std::string& GetInternedName(
...@@ -25,6 +26,40 @@ const std::string& GetInternedName( ...@@ -25,6 +26,40 @@ const std::string& GetInternedName(
return iter->second; return iter->second;
} }
const char* ThreadTypeToName(ThreadDescriptor::ChromeThreadType type) {
switch (type) {
case ThreadDescriptor::CHROME_THREAD_MAIN:
return "CrProcessMain";
case ThreadDescriptor::CHROME_THREAD_IO:
return "ChromeIOThread";
case ThreadDescriptor::CHROME_THREAD_POOL_FG_WORKER:
return "ThreadPoolForegroundWorker&";
case ThreadDescriptor::CHROME_THREAD_POOL_BG_WORKER:
return "ThreadPoolBackgroundWorker&";
case ThreadDescriptor::CHROME_THREAD_POOL_FB_BLOCKING:
return "ThreadPoolSingleThreadForegroundBlocking&";
case ThreadDescriptor::CHROME_THREAD_POOL_BG_BLOCKING:
return "ThreadPoolSingleThreadBackgroundBlocking&";
case ThreadDescriptor::CHROME_THREAD_POOL_SERVICE:
return "ThreadPoolService";
case ThreadDescriptor::CHROME_THREAD_COMPOSITOR_WORKER:
return "CompositorTileWorker&";
case ThreadDescriptor::CHROME_THREAD_COMPOSITOR:
return "Compositor";
case ThreadDescriptor::CHROME_THREAD_VIZ_COMPOSITOR:
return "VizCompositorThread";
case ThreadDescriptor::CHROME_THREAD_SERVICE_WORKER:
return "ServiceWorkerThread&";
case ThreadDescriptor::CHROME_THREAD_MEMORY_INFRA:
return "MemoryInfra";
case ThreadDescriptor::CHROME_THREAD_SAMPLING_PROFILER:
return "StackSamplingProfiler";
case ThreadDescriptor::CHROME_THREAD_UNSPECIFIED:
return nullptr;
}
}
} // namespace } // namespace
TrackEventJSONExporter::TrackEventJSONExporter( TrackEventJSONExporter::TrackEventJSONExporter(
...@@ -313,18 +348,13 @@ void TrackEventJSONExporter::HandleThreadDescriptor( ...@@ -313,18 +348,13 @@ void TrackEventJSONExporter::HandleThreadDescriptor(
add_arg->AppendF("\"%s\"", name); add_arg->AppendF("\"%s\"", name);
} }
}; };
switch (thread.chrome_thread_type()) { if (thread.has_thread_name()) {
// TODO(nuskos): As we add more thread types we will add handling here to emit_thread_name(thread.thread_name().c_str());
// switch the enum to a string and call |emit_thread_name()| } else {
case perfetto::protos::ThreadDescriptor::THREAD_TYPE_UNSPECIFIED: const char* name = ThreadTypeToName(thread.chrome_thread_type());
// No thread type enum so check to see if a explicit thread name was if (name) {
// provided.. emit_thread_name(name);
if (thread.has_thread_name()) { }
emit_thread_name(thread.thread_name().c_str());
}
break;
default:
break;
} }
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/scoped_task_environment.h" #include "base/test/scoped_task_environment.h"
#include "base/threading/thread_id_name_manager.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "components/tracing/common/tracing_switches.h" #include "components/tracing/common/tracing_switches.h"
#include "services/tracing/public/mojom/perfetto_service.mojom.h" #include "services/tracing/public/mojom/perfetto_service.mojom.h"
...@@ -26,6 +27,7 @@ ...@@ -26,6 +27,7 @@
#include "third_party/perfetto/include/perfetto/protozero/scattered_stream_writer.h" #include "third_party/perfetto/include/perfetto/protozero/scattered_stream_writer.h"
#include "third_party/perfetto/protos/perfetto/trace/trace_packet.pb.h" #include "third_party/perfetto/protos/perfetto/trace/trace_packet.pb.h"
#include "third_party/perfetto/protos/perfetto/trace/trace_packet.pbzero.h" #include "third_party/perfetto/protos/perfetto/trace/trace_packet.pbzero.h"
#include "third_party/perfetto/protos/perfetto/trace/track_event/thread_descriptor.pb.h"
using TrackEvent = perfetto::protos::TrackEvent; using TrackEvent = perfetto::protos::TrackEvent;
...@@ -33,6 +35,7 @@ namespace tracing { ...@@ -33,6 +35,7 @@ namespace tracing {
namespace { namespace {
constexpr char kTestThread[] = "CrTestMain";
constexpr const char kCategoryGroup[] = "foo"; constexpr const char kCategoryGroup[] = "foo";
class MockProducerClient : public ProducerClient { class MockProducerClient : public ProducerClient {
...@@ -188,6 +191,7 @@ class TraceEventDataSourceTest : public testing::Test { ...@@ -188,6 +191,7 @@ class TraceEventDataSourceTest : public testing::Test {
scoped_task_environment_.GetMainThreadTaskRunner()); scoped_task_environment_.GetMainThreadTaskRunner());
producer_client_ = producer_client_ =
std::make_unique<MockProducerClient>(std::move(perfetto_wrapper)); std::make_unique<MockProducerClient>(std::move(perfetto_wrapper));
base::ThreadIdNameManager::GetInstance()->SetName(kTestThread);
} }
void TearDown() override { void TearDown() override {
...@@ -223,7 +227,8 @@ class TraceEventDataSourceTest : public testing::Test { ...@@ -223,7 +227,8 @@ class TraceEventDataSourceTest : public testing::Test {
void ExpectThreadDescriptor(const perfetto::protos::TracePacket* packet, void ExpectThreadDescriptor(const perfetto::protos::TracePacket* packet,
int64_t min_timestamp = 1u, int64_t min_timestamp = 1u,
int64_t min_thread_time = 1u) { int64_t min_thread_time = 1u,
bool filtering_enabled = false) {
EXPECT_TRUE(packet->has_thread_descriptor()); EXPECT_TRUE(packet->has_thread_descriptor());
EXPECT_NE(packet->thread_descriptor().pid(), 0); EXPECT_NE(packet->thread_descriptor().pid(), 0);
EXPECT_NE(packet->thread_descriptor().tid(), 0); EXPECT_NE(packet->thread_descriptor().tid(), 0);
...@@ -237,6 +242,13 @@ class TraceEventDataSourceTest : public testing::Test { ...@@ -237,6 +242,13 @@ class TraceEventDataSourceTest : public testing::Test {
EXPECT_LE(packet->thread_descriptor().reference_thread_time_us(), EXPECT_LE(packet->thread_descriptor().reference_thread_time_us(),
base::ThreadTicks::Now().since_origin().InMicroseconds()); base::ThreadTicks::Now().since_origin().InMicroseconds());
} }
if (filtering_enabled) {
EXPECT_FALSE(packet->thread_descriptor().has_thread_name());
} else {
EXPECT_EQ(kTestThread, packet->thread_descriptor().thread_name());
}
EXPECT_EQ(perfetto::protos::ThreadDescriptor::CHROME_THREAD_MAIN,
packet->thread_descriptor().chrome_thread_type());
last_timestamp_ = packet->thread_descriptor().reference_timestamp_us(); last_timestamp_ = packet->thread_descriptor().reference_timestamp_us();
last_thread_time_ = packet->thread_descriptor().reference_thread_time_us(); last_thread_time_ = packet->thread_descriptor().reference_thread_time_us();
...@@ -928,7 +940,7 @@ TEST_F(TraceEventDataSourceTest, FilteringSimpleTraceEvent) { ...@@ -928,7 +940,7 @@ TEST_F(TraceEventDataSourceTest, FilteringSimpleTraceEvent) {
EXPECT_EQ(producer_client()->GetFinalizedPacketCount(), 2u); EXPECT_EQ(producer_client()->GetFinalizedPacketCount(), 2u);
auto* td_packet = producer_client()->GetFinalizedPacket(); auto* td_packet = producer_client()->GetFinalizedPacket();
ExpectThreadDescriptor(td_packet); ExpectThreadDescriptor(td_packet, 1u, 1u, /*filtering_enabled=*/true);
auto* e_packet = producer_client()->GetFinalizedPacket(1); auto* e_packet = producer_client()->GetFinalizedPacket(1);
ExpectTraceEvent(e_packet, /*category_iid=*/1u, /*name_iid=*/1u, ExpectTraceEvent(e_packet, /*category_iid=*/1u, /*name_iid=*/1u,
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#include "services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.h" #include "services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/pattern.h"
#include "base/strings/strcat.h"
#include "base/threading/thread_id_name_manager.h"
#include "base/trace_event/common/trace_event_common.h" #include "base/trace_event/common/trace_event_common.h"
#include "base/trace_event/trace_buffer.h" #include "base/trace_event/trace_buffer.h"
#include "base/trace_event/trace_log.h" #include "base/trace_event/trace_log.h"
...@@ -23,6 +26,7 @@ ...@@ -23,6 +26,7 @@
using TraceLog = base::trace_event::TraceLog; using TraceLog = base::trace_event::TraceLog;
using TrackEvent = perfetto::protos::pbzero::TrackEvent; using TrackEvent = perfetto::protos::pbzero::TrackEvent;
using perfetto::protos::pbzero::ThreadDescriptor;
namespace tracing { namespace tracing {
...@@ -108,6 +112,40 @@ void WriteDebugAnnotations( ...@@ -108,6 +112,40 @@ void WriteDebugAnnotations(
} }
} }
ThreadDescriptor::ChromeThreadType GetThreadType(
const char* const thread_name) {
if (base::MatchPattern(thread_name, "Cr*Main")) {
return ThreadDescriptor::CHROME_THREAD_MAIN;
} else if (base::MatchPattern(thread_name, "Chrome*IOThread")) {
return ThreadDescriptor::CHROME_THREAD_IO;
} else if (base::MatchPattern(thread_name, "ThreadPoolForegroundWorker*")) {
return ThreadDescriptor::CHROME_THREAD_POOL_FG_WORKER;
} else if (base::MatchPattern(thread_name, "ThreadPoolBackgroundWorker*")) {
return ThreadDescriptor::CHROME_THREAD_POOL_BG_WORKER;
} else if (base::MatchPattern(thread_name,
"ThreadPool*ForegroundBlocking*")) {
return ThreadDescriptor::CHROME_THREAD_POOL_FB_BLOCKING;
} else if (base::MatchPattern(thread_name,
"ThreadPool*BackgroundBlocking*")) {
return ThreadDescriptor::CHROME_THREAD_POOL_BG_BLOCKING;
} else if (base::MatchPattern(thread_name, "ThreadPoolService*")) {
return ThreadDescriptor::CHROME_THREAD_POOL_SERVICE;
} else if (base::MatchPattern(thread_name, "CompositorTileWorker*")) {
return ThreadDescriptor::CHROME_THREAD_COMPOSITOR_WORKER;
} else if (base::MatchPattern(thread_name, "Compositor")) {
return ThreadDescriptor::CHROME_THREAD_COMPOSITOR;
} else if (base::MatchPattern(thread_name, "VizCompositor*")) {
return ThreadDescriptor::CHROME_THREAD_VIZ_COMPOSITOR;
} else if (base::MatchPattern(thread_name, "ServiceWorker*")) {
return ThreadDescriptor::CHROME_THREAD_SERVICE_WORKER;
} else if (base::MatchPattern(thread_name, "MemoryInfra")) {
return ThreadDescriptor::CHROME_THREAD_MEMORY_INFRA;
} else if (base::MatchPattern(thread_name, "StackSamplingProfiler")) {
return ThreadDescriptor::CHROME_THREAD_SAMPLING_PROFILER;
}
return ThreadDescriptor::CHROME_THREAD_UNSPECIFIED;
}
} // namespace } // namespace
// static // static
...@@ -182,38 +220,7 @@ void TrackEventThreadLocalEventSink::AddTraceEvent( ...@@ -182,38 +220,7 @@ void TrackEventThreadLocalEventSink::AddTraceEvent(
} }
if (reset_incremental_state_) { if (reset_incremental_state_) {
interned_event_categories_.ResetEmittedState(); DoResetIncrementalState(trace_event, explicit_timestamp);
interned_event_names_.ResetEmittedState();
interned_annotation_names_.ResetEmittedState();
interned_source_locations_.ResetEmittedState();
// Emit a new thread descriptor in a separate packet, where we also set
// the |reset_incremental_state| field.
auto trace_packet = trace_writer_->NewTracePacket();
trace_packet->set_incremental_state_cleared(true);
auto* thread_descriptor = trace_packet->set_thread_descriptor();
thread_descriptor->set_pid(process_id_);
thread_descriptor->set_tid(thread_id_);
if (explicit_timestamp) {
// Don't use a user-provided timestamp as a reference timestamp.
last_timestamp_ = TRACE_TIME_TICKS_NOW();
} else {
last_timestamp_ = trace_event->timestamp();
}
if (trace_event->thread_timestamp().is_null()) {
last_thread_time_ = ThreadNow();
} else {
// Thread timestamp is never user-provided.
DCHECK(trace_event->thread_timestamp() <= ThreadNow());
last_thread_time_ = trace_event->thread_timestamp();
}
thread_descriptor->set_reference_timestamp_us(
last_timestamp_.since_origin().InMicroseconds());
thread_descriptor->set_reference_thread_time_us(
last_thread_time_.since_origin().InMicroseconds());
// TODO(eseckler): Fill in remaining fields in ThreadDescriptor.
reset_incremental_state_ = false;
} }
const char* category_name = const char* category_name =
...@@ -496,4 +503,53 @@ void TrackEventThreadLocalEventSink::Flush() { ...@@ -496,4 +503,53 @@ void TrackEventThreadLocalEventSink::Flush() {
trace_writer_->Flush(); trace_writer_->Flush();
} }
void TrackEventThreadLocalEventSink::DoResetIncrementalState(
base::trace_event::TraceEvent* trace_event,
bool explicit_timestamp) {
interned_event_categories_.ResetEmittedState();
interned_event_names_.ResetEmittedState();
interned_annotation_names_.ResetEmittedState();
interned_source_locations_.ResetEmittedState();
// Emit a new thread descriptor in a separate packet, where we also set
// the |reset_incremental_state| field.
auto trace_packet = trace_writer_->NewTracePacket();
trace_packet->set_incremental_state_cleared(true);
auto* thread_descriptor = trace_packet->set_thread_descriptor();
thread_descriptor->set_pid(process_id_);
thread_descriptor->set_tid(thread_id_);
const char* const maybe_new_name =
base::ThreadIdNameManager::GetInstance()->GetName(thread_id_);
if (maybe_new_name && base::StringPiece(thread_name_) != maybe_new_name) {
thread_name_ = maybe_new_name;
thread_type_ = GetThreadType(maybe_new_name);
}
if (!privacy_filtering_enabled_ && !thread_name_.empty()) {
thread_descriptor->set_thread_name(thread_name_.c_str());
}
thread_descriptor->set_chrome_thread_type(thread_type_);
if (explicit_timestamp) {
// Don't use a user-provided timestamp as a reference timestamp.
last_timestamp_ = TRACE_TIME_TICKS_NOW();
} else {
last_timestamp_ = trace_event->timestamp();
}
if (trace_event->thread_timestamp().is_null()) {
last_thread_time_ = ThreadNow();
} else {
// Thread timestamp is never user-provided.
DCHECK(trace_event->thread_timestamp() <= ThreadNow());
last_thread_time_ = trace_event->thread_timestamp();
}
thread_descriptor->set_reference_timestamp_us(
last_timestamp_.since_origin().InMicroseconds());
thread_descriptor->set_reference_thread_time_us(
last_thread_time_.since_origin().InMicroseconds());
// TODO(eseckler): Fill in remaining fields in ThreadDescriptor.
reset_incremental_state_ = false;
}
} // namespace tracing } // namespace tracing
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "services/tracing/public/cpp/perfetto/thread_local_event_sink.h" #include "services/tracing/public/cpp/perfetto/thread_local_event_sink.h"
#include "third_party/perfetto/include/perfetto/ext/tracing/core/trace_writer.h" #include "third_party/perfetto/include/perfetto/ext/tracing/core/trace_writer.h"
#include "third_party/perfetto/include/perfetto/protozero/message_handle.h" #include "third_party/perfetto/include/perfetto/protozero/message_handle.h"
#include "third_party/perfetto/protos/perfetto/trace/track_event/thread_descriptor.pbzero.h"
namespace perfetto { namespace perfetto {
class StartupTraceWriter; class StartupTraceWriter;
...@@ -49,6 +50,9 @@ class COMPONENT_EXPORT(TRACING_CPP) TrackEventThreadLocalEventSink ...@@ -49,6 +50,9 @@ class COMPONENT_EXPORT(TRACING_CPP) TrackEventThreadLocalEventSink
private: private:
static constexpr size_t kMaxCompleteEventDepth = 30; static constexpr size_t kMaxCompleteEventDepth = 30;
void DoResetIncrementalState(base::trace_event::TraceEvent* trace_event,
bool explicit_timestamp);
// TODO(eseckler): Make it possible to register new indexes for use from // TODO(eseckler): Make it possible to register new indexes for use from
// TRACE_EVENT macros. // TRACE_EVENT macros.
InterningIndex<const char*> interned_event_categories_; InterningIndex<const char*> interned_event_categories_;
...@@ -65,6 +69,9 @@ class COMPONENT_EXPORT(TRACING_CPP) TrackEventThreadLocalEventSink ...@@ -65,6 +69,9 @@ class COMPONENT_EXPORT(TRACING_CPP) TrackEventThreadLocalEventSink
base::ThreadTicks last_thread_time_; base::ThreadTicks last_thread_time_;
int process_id_; int process_id_;
int thread_id_; int thread_id_;
std::string thread_name_;
perfetto::protos::pbzero::ThreadDescriptor::ChromeThreadType thread_type_ =
perfetto::protos::pbzero::ThreadDescriptor::CHROME_THREAD_UNSPECIFIED;
base::trace_event::TraceEvent complete_event_stack_[kMaxCompleteEventDepth]; base::trace_event::TraceEvent complete_event_stack_[kMaxCompleteEventDepth];
uint32_t current_stack_depth_ = 0; uint32_t current_stack_depth_ = 0;
......
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