mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1907314: Update perfetto to v46.0. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D216948
This commit is contained in:
parent
e4040cb69e
commit
7565fead21
4
third_party/perfetto/moz.yaml
vendored
4
third_party/perfetto/moz.yaml
vendored
@ -13,8 +13,8 @@ origin:
|
||||
url: "https://perfetto.dev"
|
||||
license: Apache-2.0
|
||||
|
||||
release: v44.0 (2024-04-10T09:26:48+00:00).
|
||||
revision: v44.0
|
||||
release: v46.0 (2024-06-13T17:08:13+00:00).
|
||||
revision: v46.0
|
||||
|
||||
updatebot:
|
||||
maintainer-phab: denispal
|
||||
|
13
third_party/perfetto/moz_attributes.patch
vendored
13
third_party/perfetto/moz_attributes.patch
vendored
@ -1,8 +1,7 @@
|
||||
diff --git a/sdk/perfetto.h b/sdk/perfetto.h
|
||||
index 411806567..b64f864a9 100644
|
||||
--- a/sdk/perfetto.h
|
||||
+++ b/sdk/perfetto.h
|
||||
@@ -365,8 +365,7 @@
|
||||
@@ -371,8 +371,7 @@
|
||||
|
||||
#if defined(__clang__)
|
||||
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
|
||||
@ -12,7 +11,7 @@ index 411806567..b64f864a9 100644
|
||||
#define PERFETTO_ASAN_POISON(a, s) __asan_poison_memory_region((a), (s))
|
||||
#define PERFETTO_ASAN_UNPOISON(a, s) __asan_unpoison_memory_region((a), (s))
|
||||
#else
|
||||
@@ -19479,6 +19478,7 @@ class TrackEventDataSource
|
||||
@@ -19790,6 +19789,7 @@ class TrackEventDataSource
|
||||
#define PERFETTO_INTERNAL_EVENT_FINALIZER_KEYWORD default
|
||||
#endif
|
||||
|
||||
@ -20,12 +19,12 @@ index 411806567..b64f864a9 100644
|
||||
#define PERFETTO_INTERNAL_SCOPED_EVENT_FINALIZER(category) \
|
||||
struct PERFETTO_UID(ScopedEvent) { \
|
||||
struct EventFinalizer { \
|
||||
@@ -19489,7 +19489,7 @@ class TrackEventDataSource
|
||||
@@ -19800,7 +19800,7 @@ class TrackEventDataSource
|
||||
/* TrackEventArgumentFunction in |__VA_ARGS__|. This is required so */ \
|
||||
/* that the scoped event is exactly ONE line and can't escape the */ \
|
||||
/* scope if used in a single line if statement. */ \
|
||||
- EventFinalizer(...) {} \
|
||||
+ MOZ_IMPLICIT EventFinalizer(...) {} \
|
||||
~EventFinalizer() { TRACE_EVENT_END(category); } \
|
||||
\
|
||||
EventFinalizer(const EventFinalizer&) = delete; \
|
||||
~EventFinalizer() { \
|
||||
TRACE_EVENT_END(category); \
|
||||
} \
|
||||
|
533
third_party/perfetto/sdk/perfetto.cc
vendored
533
third_party/perfetto/sdk/perfetto.cc
vendored
@ -265,7 +265,7 @@ class Hasher {
|
||||
|
||||
// Allow hashing anything that has a |data| field, a |size| field,
|
||||
// and has the kHashable trait (e.g., base::StringView).
|
||||
template <typename T, typename = std::enable_if<T::kHashable>>
|
||||
template <typename T, typename = std::enable_if_t<T::kHashable>>
|
||||
void Update(const T& t) {
|
||||
Update(t.data(), t.size());
|
||||
}
|
||||
@ -563,7 +563,7 @@ struct std::hash<::perfetto::base::StringView> {
|
||||
// This headers deals with sys types commonly used in the codebase that are
|
||||
// missing on Windows.
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/types.h> // IWYU pragma: export
|
||||
#include <cstdint>
|
||||
|
||||
// gen_amalgamated expanded: #include "perfetto/base/build_config.h"
|
||||
@ -13185,7 +13185,8 @@ ObservableEvents_CloneTriggerHit& ObservableEvents_CloneTriggerHit::operator=(Ob
|
||||
|
||||
bool ObservableEvents_CloneTriggerHit::operator==(const ObservableEvents_CloneTriggerHit& other) const {
|
||||
return ::protozero::internal::gen_helpers::EqualsField(unknown_fields_, other.unknown_fields_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(tracing_session_id_, other.tracing_session_id_);
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(tracing_session_id_, other.tracing_session_id_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(trigger_name_, other.trigger_name_);
|
||||
}
|
||||
|
||||
bool ObservableEvents_CloneTriggerHit::ParseFromArray(const void* raw, size_t size) {
|
||||
@ -13201,6 +13202,9 @@ bool ObservableEvents_CloneTriggerHit::ParseFromArray(const void* raw, size_t si
|
||||
case 1 /* tracing_session_id */:
|
||||
field.get(&tracing_session_id_);
|
||||
break;
|
||||
case 2 /* trigger_name */:
|
||||
::protozero::internal::gen_helpers::DeserializeString(field, &trigger_name_);
|
||||
break;
|
||||
default:
|
||||
field.SerializeAndAppendTo(&unknown_fields_);
|
||||
break;
|
||||
@ -13227,6 +13231,11 @@ void ObservableEvents_CloneTriggerHit::Serialize(::protozero::Message* msg) cons
|
||||
::protozero::internal::gen_helpers::SerializeVarInt(1, tracing_session_id_, msg);
|
||||
}
|
||||
|
||||
// Field 2: trigger_name
|
||||
if (_has_field_[2]) {
|
||||
::protozero::internal::gen_helpers::SerializeString(2, trigger_name_, msg);
|
||||
}
|
||||
|
||||
protozero::internal::gen_helpers::SerializeUnknownFields(unknown_fields_, msg);
|
||||
}
|
||||
|
||||
@ -15876,6 +15885,105 @@ void PackagesListConfig::Serialize(::protozero::Message* msg) const {
|
||||
protozero::internal::gen_helpers::SerializeUnknownFields(unknown_fields_, msg);
|
||||
}
|
||||
|
||||
} // namespace perfetto
|
||||
} // namespace protos
|
||||
} // namespace gen
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/config/android/pixel_modem_config.gen.cc
|
||||
// gen_amalgamated expanded: #include "perfetto/protozero/gen_field_helpers.h"
|
||||
// gen_amalgamated expanded: #include "perfetto/protozero/message.h"
|
||||
// gen_amalgamated expanded: #include "perfetto/protozero/packed_repeated_fields.h"
|
||||
// gen_amalgamated expanded: #include "perfetto/protozero/proto_decoder.h"
|
||||
// gen_amalgamated expanded: #include "perfetto/protozero/scattered_heap_buffer.h"
|
||||
// DO NOT EDIT. Autogenerated by Perfetto cppgen_plugin
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
#endif
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/pixel_modem_config.gen.h"
|
||||
|
||||
namespace perfetto {
|
||||
namespace protos {
|
||||
namespace gen {
|
||||
|
||||
PixelModemConfig::PixelModemConfig() = default;
|
||||
PixelModemConfig::~PixelModemConfig() = default;
|
||||
PixelModemConfig::PixelModemConfig(const PixelModemConfig&) = default;
|
||||
PixelModemConfig& PixelModemConfig::operator=(const PixelModemConfig&) = default;
|
||||
PixelModemConfig::PixelModemConfig(PixelModemConfig&&) noexcept = default;
|
||||
PixelModemConfig& PixelModemConfig::operator=(PixelModemConfig&&) = default;
|
||||
|
||||
bool PixelModemConfig::operator==(const PixelModemConfig& other) const {
|
||||
return ::protozero::internal::gen_helpers::EqualsField(unknown_fields_, other.unknown_fields_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(event_group_, other.event_group_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(pigweed_hash_allow_list_, other.pigweed_hash_allow_list_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(pigweed_hash_deny_list_, other.pigweed_hash_deny_list_);
|
||||
}
|
||||
|
||||
bool PixelModemConfig::ParseFromArray(const void* raw, size_t size) {
|
||||
pigweed_hash_allow_list_.clear();
|
||||
pigweed_hash_deny_list_.clear();
|
||||
unknown_fields_.clear();
|
||||
bool packed_error = false;
|
||||
|
||||
::protozero::ProtoDecoder dec(raw, size);
|
||||
for (auto field = dec.ReadField(); field.valid(); field = dec.ReadField()) {
|
||||
if (field.id() < _has_field_.size()) {
|
||||
_has_field_.set(field.id());
|
||||
}
|
||||
switch (field.id()) {
|
||||
case 1 /* event_group */:
|
||||
field.get(&event_group_);
|
||||
break;
|
||||
case 2 /* pigweed_hash_allow_list */:
|
||||
pigweed_hash_allow_list_.emplace_back();
|
||||
field.get(&pigweed_hash_allow_list_.back());
|
||||
break;
|
||||
case 3 /* pigweed_hash_deny_list */:
|
||||
pigweed_hash_deny_list_.emplace_back();
|
||||
field.get(&pigweed_hash_deny_list_.back());
|
||||
break;
|
||||
default:
|
||||
field.SerializeAndAppendTo(&unknown_fields_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return !packed_error && !dec.bytes_left();
|
||||
}
|
||||
|
||||
std::string PixelModemConfig::SerializeAsString() const {
|
||||
::protozero::internal::gen_helpers::MessageSerializer msg;
|
||||
Serialize(msg.get());
|
||||
return msg.SerializeAsString();
|
||||
}
|
||||
|
||||
std::vector<uint8_t> PixelModemConfig::SerializeAsArray() const {
|
||||
::protozero::internal::gen_helpers::MessageSerializer msg;
|
||||
Serialize(msg.get());
|
||||
return msg.SerializeAsArray();
|
||||
}
|
||||
|
||||
void PixelModemConfig::Serialize(::protozero::Message* msg) const {
|
||||
// Field 1: event_group
|
||||
if (_has_field_[1]) {
|
||||
::protozero::internal::gen_helpers::SerializeVarInt(1, event_group_, msg);
|
||||
}
|
||||
|
||||
// Field 2: pigweed_hash_allow_list
|
||||
for (auto& it : pigweed_hash_allow_list_) {
|
||||
::protozero::internal::gen_helpers::SerializeVarInt(2, it, msg);
|
||||
}
|
||||
|
||||
// Field 3: pigweed_hash_deny_list
|
||||
for (auto& it : pigweed_hash_deny_list_) {
|
||||
::protozero::internal::gen_helpers::SerializeVarInt(3, it, msg);
|
||||
}
|
||||
|
||||
protozero::internal::gen_helpers::SerializeUnknownFields(unknown_fields_, msg);
|
||||
}
|
||||
|
||||
} // namespace perfetto
|
||||
} // namespace protos
|
||||
} // namespace gen
|
||||
@ -19235,6 +19343,7 @@ void ChromeConfig::Serialize(::protozero::Message* msg) const {
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/surfaceflinger_layers_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/protolog_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/common/protolog_common.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/pixel_modem_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/packages_list_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/network_trace_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/android_sdk_sysprop_guard_config.gen.h"
|
||||
@ -20005,6 +20114,7 @@ bool DataSourceConfig::operator==(const DataSourceConfig& other) const {
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(etw_config_, other.etw_config_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(protolog_config_, other.protolog_config_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(android_input_event_config_, other.android_input_event_config_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(pixel_modem_config_, other.pixel_modem_config_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(legacy_config_, other.legacy_config_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(for_testing_, other.for_testing_);
|
||||
}
|
||||
@ -20127,6 +20237,9 @@ bool DataSourceConfig::ParseFromArray(const void* raw, size_t size) {
|
||||
case 128 /* android_input_event_config */:
|
||||
::protozero::internal::gen_helpers::DeserializeString(field, &android_input_event_config_);
|
||||
break;
|
||||
case 129 /* pixel_modem_config */:
|
||||
::protozero::internal::gen_helpers::DeserializeString(field, &pixel_modem_config_);
|
||||
break;
|
||||
case 1000 /* legacy_config */:
|
||||
::protozero::internal::gen_helpers::DeserializeString(field, &legacy_config_);
|
||||
break;
|
||||
@ -20334,6 +20447,11 @@ void DataSourceConfig::Serialize(::protozero::Message* msg) const {
|
||||
msg->AppendString(128, android_input_event_config_);
|
||||
}
|
||||
|
||||
// Field 129: pixel_modem_config
|
||||
if (_has_field_[129]) {
|
||||
msg->AppendString(129, pixel_modem_config_);
|
||||
}
|
||||
|
||||
// Field 1000: legacy_config
|
||||
if (_has_field_[1000]) {
|
||||
::protozero::internal::gen_helpers::SerializeString(1000, legacy_config_, msg);
|
||||
@ -20559,6 +20677,7 @@ void InterceptorConfig::Serialize(::protozero::Message* msg) const {
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/surfaceflinger_layers_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/protolog_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/common/protolog_common.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/pixel_modem_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/packages_list_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/network_trace_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/android_sdk_sysprop_guard_config.gen.h"
|
||||
@ -21148,6 +21267,7 @@ void TestConfig_DummyFields::Serialize(::protozero::Message* msg) const {
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/surfaceflinger_layers_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/protolog_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/common/protolog_common.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/pixel_modem_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/packages_list_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/network_trace_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/android_sdk_sysprop_guard_config.gen.h"
|
||||
@ -21205,7 +21325,8 @@ bool TraceConfig::operator==(const TraceConfig& other) const {
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(trace_uuid_lsb_, other.trace_uuid_lsb_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(trace_filter_, other.trace_filter_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(android_report_config_, other.android_report_config_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(cmd_trace_start_delay_, other.cmd_trace_start_delay_);
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(cmd_trace_start_delay_, other.cmd_trace_start_delay_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(session_semaphores_, other.session_semaphores_);
|
||||
}
|
||||
|
||||
int TraceConfig::buffers_size() const { return static_cast<int>(buffers_.size()); }
|
||||
@ -21217,11 +21338,15 @@ TraceConfig_DataSource* TraceConfig::add_data_sources() { data_sources_.emplace_
|
||||
int TraceConfig::producers_size() const { return static_cast<int>(producers_.size()); }
|
||||
void TraceConfig::clear_producers() { producers_.clear(); }
|
||||
TraceConfig_ProducerConfig* TraceConfig::add_producers() { producers_.emplace_back(); return &producers_.back(); }
|
||||
int TraceConfig::session_semaphores_size() const { return static_cast<int>(session_semaphores_.size()); }
|
||||
void TraceConfig::clear_session_semaphores() { session_semaphores_.clear(); }
|
||||
TraceConfig_SessionSemaphore* TraceConfig::add_session_semaphores() { session_semaphores_.emplace_back(); return &session_semaphores_.back(); }
|
||||
bool TraceConfig::ParseFromArray(const void* raw, size_t size) {
|
||||
buffers_.clear();
|
||||
data_sources_.clear();
|
||||
producers_.clear();
|
||||
activate_triggers_.clear();
|
||||
session_semaphores_.clear();
|
||||
unknown_fields_.clear();
|
||||
bool packed_error = false;
|
||||
|
||||
@ -21337,6 +21462,10 @@ bool TraceConfig::ParseFromArray(const void* raw, size_t size) {
|
||||
case 35 /* cmd_trace_start_delay */:
|
||||
(*cmd_trace_start_delay_).ParseFromArray(field.data(), field.size());
|
||||
break;
|
||||
case 39 /* session_semaphores */:
|
||||
session_semaphores_.emplace_back();
|
||||
session_semaphores_.back().ParseFromArray(field.data(), field.size());
|
||||
break;
|
||||
default:
|
||||
field.SerializeAndAppendTo(&unknown_fields_);
|
||||
break;
|
||||
@ -21528,6 +21657,75 @@ void TraceConfig::Serialize(::protozero::Message* msg) const {
|
||||
(*cmd_trace_start_delay_).Serialize(msg->BeginNestedMessage<::protozero::Message>(35));
|
||||
}
|
||||
|
||||
// Field 39: session_semaphores
|
||||
for (auto& it : session_semaphores_) {
|
||||
it.Serialize(msg->BeginNestedMessage<::protozero::Message>(39));
|
||||
}
|
||||
|
||||
protozero::internal::gen_helpers::SerializeUnknownFields(unknown_fields_, msg);
|
||||
}
|
||||
|
||||
|
||||
TraceConfig_SessionSemaphore::TraceConfig_SessionSemaphore() = default;
|
||||
TraceConfig_SessionSemaphore::~TraceConfig_SessionSemaphore() = default;
|
||||
TraceConfig_SessionSemaphore::TraceConfig_SessionSemaphore(const TraceConfig_SessionSemaphore&) = default;
|
||||
TraceConfig_SessionSemaphore& TraceConfig_SessionSemaphore::operator=(const TraceConfig_SessionSemaphore&) = default;
|
||||
TraceConfig_SessionSemaphore::TraceConfig_SessionSemaphore(TraceConfig_SessionSemaphore&&) noexcept = default;
|
||||
TraceConfig_SessionSemaphore& TraceConfig_SessionSemaphore::operator=(TraceConfig_SessionSemaphore&&) = default;
|
||||
|
||||
bool TraceConfig_SessionSemaphore::operator==(const TraceConfig_SessionSemaphore& other) const {
|
||||
return ::protozero::internal::gen_helpers::EqualsField(unknown_fields_, other.unknown_fields_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(name_, other.name_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(max_other_session_count_, other.max_other_session_count_);
|
||||
}
|
||||
|
||||
bool TraceConfig_SessionSemaphore::ParseFromArray(const void* raw, size_t size) {
|
||||
unknown_fields_.clear();
|
||||
bool packed_error = false;
|
||||
|
||||
::protozero::ProtoDecoder dec(raw, size);
|
||||
for (auto field = dec.ReadField(); field.valid(); field = dec.ReadField()) {
|
||||
if (field.id() < _has_field_.size()) {
|
||||
_has_field_.set(field.id());
|
||||
}
|
||||
switch (field.id()) {
|
||||
case 1 /* name */:
|
||||
::protozero::internal::gen_helpers::DeserializeString(field, &name_);
|
||||
break;
|
||||
case 2 /* max_other_session_count */:
|
||||
field.get(&max_other_session_count_);
|
||||
break;
|
||||
default:
|
||||
field.SerializeAndAppendTo(&unknown_fields_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return !packed_error && !dec.bytes_left();
|
||||
}
|
||||
|
||||
std::string TraceConfig_SessionSemaphore::SerializeAsString() const {
|
||||
::protozero::internal::gen_helpers::MessageSerializer msg;
|
||||
Serialize(msg.get());
|
||||
return msg.SerializeAsString();
|
||||
}
|
||||
|
||||
std::vector<uint8_t> TraceConfig_SessionSemaphore::SerializeAsArray() const {
|
||||
::protozero::internal::gen_helpers::MessageSerializer msg;
|
||||
Serialize(msg.get());
|
||||
return msg.SerializeAsArray();
|
||||
}
|
||||
|
||||
void TraceConfig_SessionSemaphore::Serialize(::protozero::Message* msg) const {
|
||||
// Field 1: name
|
||||
if (_has_field_[1]) {
|
||||
::protozero::internal::gen_helpers::SerializeString(1, name_, msg);
|
||||
}
|
||||
|
||||
// Field 2: max_other_session_count
|
||||
if (_has_field_[2]) {
|
||||
::protozero::internal::gen_helpers::SerializeVarInt(2, max_other_session_count_, msg);
|
||||
}
|
||||
|
||||
protozero::internal::gen_helpers::SerializeUnknownFields(unknown_fields_, msg);
|
||||
}
|
||||
|
||||
@ -22743,9 +22941,23 @@ void TraceConfig_BufferConfig::Serialize(::protozero::Message* msg) const {
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/common/track_event_descriptor.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/android_game_intervention_list.pbzero.cc
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/graphics/point.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/android_input_event.pbzero.cc
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/graphics/rect.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/winscope_extensions.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/protolog.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/shell_transition.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/surfaceflinger_common.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/surfaceflinger_layers.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/surfaceflinger_transactions.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/android_game_intervention_list.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/android_log.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
@ -22765,15 +22977,7 @@ void TraceConfig_BufferConfig::Serialize(::protozero::Message* msg) const {
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/packages_list.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/protolog.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/shell_transition.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/surfaceflinger_common.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/surfaceflinger_layers.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/surfaceflinger_transactions.pbzero.cc
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/android/pixel_modem_events.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/chrome/chrome_benchmark_metadata.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
@ -22781,6 +22985,8 @@ void TraceConfig_BufferConfig::Serialize(::protozero::Message* msg) const {
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/chrome/chrome_trace_event.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/chrome/chrome_trigger.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/chrome/v8.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/gpu/gpu_counter_event.pbzero.cc
|
||||
@ -27507,6 +27713,7 @@ bool TrackDescriptor::operator==(const TrackDescriptor& other) const {
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(uuid_, other.uuid_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(parent_uuid_, other.parent_uuid_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(name_, other.name_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(static_name_, other.static_name_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(process_, other.process_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(chrome_process_, other.chrome_process_)
|
||||
&& ::protozero::internal::gen_helpers::EqualsField(thread_, other.thread_)
|
||||
@ -27534,6 +27741,9 @@ bool TrackDescriptor::ParseFromArray(const void* raw, size_t size) {
|
||||
case 2 /* name */:
|
||||
::protozero::internal::gen_helpers::DeserializeString(field, &name_);
|
||||
break;
|
||||
case 10 /* static_name */:
|
||||
::protozero::internal::gen_helpers::DeserializeString(field, &static_name_);
|
||||
break;
|
||||
case 3 /* process */:
|
||||
(*process_).ParseFromArray(field.data(), field.size());
|
||||
break;
|
||||
@ -27588,6 +27798,11 @@ void TrackDescriptor::Serialize(::protozero::Message* msg) const {
|
||||
::protozero::internal::gen_helpers::SerializeString(2, name_, msg);
|
||||
}
|
||||
|
||||
// Field 10: static_name
|
||||
if (_has_field_[10]) {
|
||||
::protozero::internal::gen_helpers::SerializeString(10, static_name_, msg);
|
||||
}
|
||||
|
||||
// Field 3: process
|
||||
if (_has_field_[3]) {
|
||||
(*process_).Serialize(msg->BeginNestedMessage<::protozero::Message>(3));
|
||||
@ -28547,6 +28762,8 @@ void TrackEvent_LegacyEvent::Serialize(::protozero::Message* msg) const {
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/config/android/packages_list_config.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/config/android/pixel_modem_config.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/config/android/protolog_config.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/config/android/surfaceflinger_layers_config.pbzero.cc
|
||||
@ -28645,6 +28862,8 @@ void TrackEvent_LegacyEvent::Serialize(::protozero::Message* msg) const {
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/cros_ec.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/dcvsh.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/dma_fence.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/dmabuf_heap.pbzero.cc
|
||||
@ -28667,6 +28886,10 @@ void TrackEvent_LegacyEvent::Serialize(::protozero::Message* msg) const {
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/g2d.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/google_icc_trace.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/google_irm_trace.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/gpu_mem.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/gpu_scheduler.pbzero.cc
|
||||
@ -28681,6 +28904,8 @@ void TrackEvent_LegacyEvent::Serialize(::protozero::Message* msg) const {
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/irq.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/kgsl.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/kmem.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/kvm.pbzero.cc
|
||||
@ -28739,6 +28964,8 @@ void TrackEvent_LegacyEvent::Serialize(::protozero::Message* msg) const {
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/thermal.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/thermal_exynos.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/trusty.pbzero.cc
|
||||
// Intentionally empty (crbug.com/998165)
|
||||
// gen_amalgamated begin source: gen/protos/perfetto/trace/ftrace/ufs.pbzero.cc
|
||||
@ -28936,6 +29163,12 @@ ClockSnapshotVector CaptureClockSnapshots() {
|
||||
ClockReading(protos::pbzero::BUILTIN_CLOCK_MONOTONIC, wall_time_ns));
|
||||
#endif
|
||||
|
||||
#if PERFETTO_BUILDFLAG(PERFETTO_ARCH_CPU_X86_64)
|
||||
// X86-specific but OS-independent TSC clocksource
|
||||
snapshot_data.push_back(
|
||||
ClockReading(protos::pbzero::BUILTIN_CLOCK_TSC, base::Rdtsc()));
|
||||
#endif // PERFETTO_BUILDFLAG(PERFETTO_ARCH_CPU_X86_64)
|
||||
|
||||
return snapshot_data;
|
||||
}
|
||||
|
||||
@ -28963,6 +29196,7 @@ ClockSnapshotVector CaptureClockSnapshots() {
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
@ -37744,7 +37978,10 @@ void TracingMuxerImpl::UpdateDataSourceOnAllBackends(RegisteredDataSource& rds,
|
||||
rds.descriptor.set_no_flush(rds.no_flush);
|
||||
}
|
||||
rds.descriptor.set_will_notify_on_start(true);
|
||||
rds.descriptor.set_will_notify_on_stop(true);
|
||||
if (!rds.descriptor.has_will_notify_on_stop()) {
|
||||
rds.descriptor.set_will_notify_on_stop(true);
|
||||
}
|
||||
|
||||
rds.descriptor.set_handles_incremental_state_clear(true);
|
||||
rds.descriptor.set_id(rds.static_state->id);
|
||||
if (is_registered) {
|
||||
@ -39812,6 +40049,13 @@ void Track::Serialize(protos::pbzero::TrackDescriptor* desc) const {
|
||||
desc->AppendRawProtoBytes(bytes.data(), bytes.size());
|
||||
}
|
||||
|
||||
// static
|
||||
Track Track::ThreadScoped(const void* ptr, Track parent) {
|
||||
if (parent.uuid == 0)
|
||||
return Track::FromPointer(ptr, ThreadTrack::Current());
|
||||
return Track::FromPointer(ptr, parent);
|
||||
}
|
||||
|
||||
protos::gen::TrackDescriptor ProcessTrack::Serialize() const {
|
||||
auto desc = Track::Serialize();
|
||||
auto pd = desc.mutable_process();
|
||||
@ -39874,8 +40118,13 @@ void ThreadTrack::Serialize(protos::pbzero::TrackDescriptor* desc) const {
|
||||
|
||||
protos::gen::TrackDescriptor CounterTrack::Serialize() const {
|
||||
auto desc = Track::Serialize();
|
||||
desc.set_name(name_);
|
||||
auto* counter = desc.mutable_counter();
|
||||
if (static_name_) {
|
||||
desc.set_static_name(static_name_.value);
|
||||
} else {
|
||||
desc.set_name(dynamic_name_.value);
|
||||
}
|
||||
|
||||
if (category_)
|
||||
counter->add_categories(category_);
|
||||
if (unit_ != perfetto::protos::pbzero::CounterDescriptor::UNIT_UNSPECIFIED)
|
||||
@ -39975,18 +40224,6 @@ void TrackRegistry::UpdateTrack(Track track,
|
||||
tracks_[track.uuid] = std::move(serialized_desc);
|
||||
}
|
||||
|
||||
void TrackRegistry::UpdateTrackImpl(
|
||||
Track track,
|
||||
std::function<void(protos::pbzero::TrackDescriptor*)> fill_function) {
|
||||
constexpr size_t kInitialSliceSize = 32;
|
||||
constexpr size_t kMaximumSliceSize = 4096;
|
||||
protozero::HeapBuffered<protos::pbzero::TrackDescriptor> new_descriptor(
|
||||
kInitialSliceSize, kMaximumSliceSize);
|
||||
fill_function(new_descriptor.get());
|
||||
auto serialized_desc = new_descriptor.SerializeAsString();
|
||||
UpdateTrack(track, serialized_desc);
|
||||
}
|
||||
|
||||
void TrackRegistry::EraseTrack(Track track) {
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
tracks_.erase(track.uuid);
|
||||
@ -40394,7 +40631,11 @@ void TrackEventStateTracker::UpdateIncrementalState(
|
||||
track.index = static_cast<uint32_t>(session_state->tracks.size() + 1);
|
||||
track.uuid = track_descriptor.uuid();
|
||||
|
||||
track.name = track_descriptor.name().ToStdString();
|
||||
if (track_descriptor.has_name()) {
|
||||
track.name = track_descriptor.name().ToStdString();
|
||||
} else if (track_descriptor.has_static_name()) {
|
||||
track.name = track_descriptor.static_name().ToStdString();
|
||||
}
|
||||
track.pid = 0;
|
||||
track.tid = 0;
|
||||
if (track_descriptor.has_process()) {
|
||||
@ -40516,6 +40757,8 @@ enum class PerfettoStatsdAtom {
|
||||
// Checkpoints inside perfetto_cmd before tracing is finished.
|
||||
kTraceBegin = 1,
|
||||
kBackgroundTraceBegin = 2,
|
||||
kCloneTraceBegin = 55,
|
||||
kCloneTriggerTraceBegin = 56,
|
||||
kOnConnect = 3,
|
||||
|
||||
// Guardrails inside perfetto_cmd before tracing is finished.
|
||||
@ -40559,6 +40802,7 @@ enum class PerfettoStatsdAtom {
|
||||
kTracedEnableTracingOobTargetBuffer = 48,
|
||||
kTracedEnableTracingInvalidTriggerMode = 52,
|
||||
kTracedEnableTracingInvalidBrFilename = 54,
|
||||
kTracedEnableTracingFailedSessionSemaphoreCheck = 57,
|
||||
|
||||
// Checkpoints inside perfetto_cmd after tracing has finished.
|
||||
kOnTracingDisabled = 4,
|
||||
@ -40594,7 +40838,7 @@ enum class PerfettoStatsdAtom {
|
||||
// longer supports uploading traces using Dropbox.
|
||||
// reserved 5, 6, 7;
|
||||
|
||||
// Contained status of guardrail state initalization and upload limit in
|
||||
// Contained status of guardrail state initialization and upload limit in
|
||||
// perfetto_cmd. Removed as perfetto no longer manages stateful guardrails
|
||||
// reserved 44, 45, 46;
|
||||
};
|
||||
@ -40640,6 +40884,7 @@ enum PerfettoTriggerAtom {
|
||||
#define SRC_ANDROID_STATS_STATSD_LOGGING_HELPER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -40687,10 +40932,12 @@ void MaybeLogTriggerEvents(PerfettoTriggerAtom atom,
|
||||
|
||||
// gen_amalgamated expanded: #include "src/android_stats/statsd_logging_helper.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// gen_amalgamated expanded: #include "perfetto/base/build_config.h"
|
||||
// gen_amalgamated expanded: #include "perfetto/base/compiler.h"
|
||||
// gen_amalgamated expanded: #include "src/android_stats/perfetto_atoms.h"
|
||||
|
||||
#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) && \
|
||||
PERFETTO_BUILDFLAG(PERFETTO_ANDROID_BUILD)
|
||||
@ -40698,8 +40945,7 @@ void MaybeLogTriggerEvents(PerfettoTriggerAtom atom,
|
||||
// gen_amalgamated expanded: #include "src/android_internal/statsd_logging.h" // nogncheck
|
||||
#endif
|
||||
|
||||
namespace perfetto {
|
||||
namespace android_stats {
|
||||
namespace perfetto::android_stats {
|
||||
|
||||
// Make sure we don't accidentally log on non-Android tree build. Note that even
|
||||
// removing this ifdef still doesn't make uploads work on OS_ANDROID.
|
||||
@ -40746,8 +40992,7 @@ void MaybeLogTriggerEvents(PerfettoTriggerAtom,
|
||||
const std::vector<std::string>&) {}
|
||||
#endif
|
||||
|
||||
} // namespace android_stats
|
||||
} // namespace perfetto
|
||||
} // namespace perfetto::android_stats
|
||||
// gen_amalgamated begin source: src/base/version.cc
|
||||
// gen_amalgamated begin header: include/perfetto/ext/base/version.h
|
||||
/*
|
||||
@ -40803,8 +41048,8 @@ const char* GetVersionCode();
|
||||
#ifndef GEN_PERFETTO_VERSION_GEN_H_
|
||||
#define GEN_PERFETTO_VERSION_GEN_H_
|
||||
|
||||
#define PERFETTO_VERSION_STRING() "v44.0-94bdc3da5"
|
||||
#define PERFETTO_VERSION_SCM_REVISION() "94bdc3da58ad5343e7db3c40fba76309103e342a"
|
||||
#define PERFETTO_VERSION_STRING() "v46.0-7114ea53e"
|
||||
#define PERFETTO_VERSION_SCM_REVISION() "7114ea53e3297191d34072cd64cf8a7be7076bb6"
|
||||
|
||||
#endif // GEN_PERFETTO_VERSION_GEN_H_
|
||||
/*
|
||||
@ -42744,7 +42989,6 @@ bool PacketStreamValidator::Validate(const Slices& slices) {
|
||||
// gen_amalgamated expanded: #include "perfetto/ext/base/utils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
|
||||
namespace perfetto {
|
||||
@ -42766,6 +43010,11 @@ namespace base {
|
||||
// tsl::robin_map: 931,403,397 ns 243.622M insertions/s
|
||||
// absl::flat_hash_map: 998,013,459 ns 227.379M insertions/s
|
||||
// FollyF14FastMap: 1,181,480,602 ns 192.074M insertions/s
|
||||
//
|
||||
// TODO(primiano): the table regresses for heavy insert+erase workloads since we
|
||||
// don't clean up tombstones outside of resizes. In the limit, the entire
|
||||
// table's capacity is made up of values/tombstones, so each search has to
|
||||
// exhaustively scan the full capacity.
|
||||
|
||||
// The structs below define the probing algorithm used to probe slots upon a
|
||||
// collision. They are guaranteed to visit all slots as our table size is always
|
||||
@ -45319,6 +45568,7 @@ class CircularQueue {
|
||||
// gen_amalgamated expanded: #include "perfetto/base/time.h"
|
||||
// gen_amalgamated expanded: #include "perfetto/ext/base/circular_queue.h"
|
||||
// gen_amalgamated expanded: #include "perfetto/ext/base/periodic_task.h"
|
||||
// gen_amalgamated expanded: #include "perfetto/ext/base/string_view.h"
|
||||
// gen_amalgamated expanded: #include "perfetto/ext/base/uuid.h"
|
||||
// gen_amalgamated expanded: #include "perfetto/ext/base/weak_ptr.h"
|
||||
// gen_amalgamated expanded: #include "perfetto/ext/tracing/core/basic_types.h"
|
||||
@ -45498,7 +45748,7 @@ class TracingServiceImpl : public TracingService {
|
||||
~ConsumerEndpointImpl() override;
|
||||
|
||||
void NotifyOnTracingDisabled(const std::string& error);
|
||||
void NotifyCloneSnapshotTrigger();
|
||||
void NotifyCloneSnapshotTrigger(const std::string& trigger_name);
|
||||
|
||||
// TracingService::ConsumerEndpoint implementation.
|
||||
void EnableTracing(const TraceConfig&, base::ScopedFile) override;
|
||||
@ -45638,10 +45888,10 @@ class TracingServiceImpl : public TracingService {
|
||||
ConsumerEndpoint::FlushCallback,
|
||||
FlushFlags);
|
||||
void FlushAndDisableTracing(TracingSessionID);
|
||||
void FlushAndCloneSession(ConsumerEndpointImpl*,
|
||||
TracingSessionID,
|
||||
bool skip_filter,
|
||||
bool for_bugreport);
|
||||
base::Status FlushAndCloneSession(ConsumerEndpointImpl*,
|
||||
TracingSessionID,
|
||||
bool skip_filter,
|
||||
bool for_bugreport);
|
||||
|
||||
// Starts reading the internal tracing buffers from the tracing session `tsid`
|
||||
// and sends them to `*consumer` (which must be != nullptr).
|
||||
@ -46031,6 +46281,8 @@ class TracingServiceImpl : public TracingService {
|
||||
TracingServiceImpl(const TracingServiceImpl&) = delete;
|
||||
TracingServiceImpl& operator=(const TracingServiceImpl&) = delete;
|
||||
|
||||
bool IsInitiatorPrivileged(const TracingSession&);
|
||||
|
||||
DataSourceInstance* SetupDataSource(const TraceConfig::DataSource&,
|
||||
const TraceConfig::ProducerConfig&,
|
||||
const RegisteredDataSource&,
|
||||
@ -46263,6 +46515,7 @@ class TracingServiceImpl : public TracingService {
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
// gen_amalgamated expanded: #include "perfetto/base/time.h"
|
||||
// gen_amalgamated expanded: #include "perfetto/ext/tracing/core/client_identity.h"
|
||||
@ -46734,8 +46987,6 @@ void TracingServiceImpl::DisconnectConsumer(ConsumerEndpointImpl* consumer) {
|
||||
PERFETTO_DLOG("Consumer %p disconnected", reinterpret_cast<void*>(consumer));
|
||||
PERFETTO_DCHECK(consumers_.count(consumer));
|
||||
|
||||
// TODO(primiano) : Check that this is safe (what happens if there are
|
||||
// ReadBuffers() calls posted in the meantime? They need to become noop).
|
||||
if (consumer->tracing_session_id_)
|
||||
FreeBuffers(consumer->tracing_session_id_); // Will also DisableTracing().
|
||||
consumers_.erase(consumer);
|
||||
@ -47017,6 +47268,57 @@ base::Status TracingServiceImpl::EnableTracing(ConsumerEndpointImpl* consumer,
|
||||
}
|
||||
}
|
||||
|
||||
if (!cfg.session_semaphores().empty()) {
|
||||
struct SemaphoreSessionsState {
|
||||
uint64_t smallest_max_other_session_count =
|
||||
std::numeric_limits<uint64_t>::max();
|
||||
uint64_t session_count = 0;
|
||||
};
|
||||
// For each semaphore, compute the number of active sessions and the
|
||||
// MIN(limit).
|
||||
std::unordered_map<std::string, SemaphoreSessionsState>
|
||||
sem_to_sessions_state;
|
||||
for (const auto& id_and_session : tracing_sessions_) {
|
||||
const auto& session = id_and_session.second;
|
||||
if (session.state == TracingSession::CLONED_READ_ONLY ||
|
||||
session.state == TracingSession::DISABLED) {
|
||||
// Don't consider cloned or disabled sessions in checks.
|
||||
continue;
|
||||
}
|
||||
for (const auto& sem : session.config.session_semaphores()) {
|
||||
auto& sessions_state = sem_to_sessions_state[sem.name()];
|
||||
sessions_state.smallest_max_other_session_count =
|
||||
std::min(sessions_state.smallest_max_other_session_count,
|
||||
sem.max_other_session_count());
|
||||
sessions_state.session_count++;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if any of the semaphores declared by the config clashes with any of
|
||||
// the currently active semaphores.
|
||||
for (const auto& semaphore : cfg.session_semaphores()) {
|
||||
auto it = sem_to_sessions_state.find(semaphore.name());
|
||||
if (it == sem_to_sessions_state.end()) {
|
||||
continue;
|
||||
}
|
||||
uint64_t max_other_session_count =
|
||||
std::min(semaphore.max_other_session_count(),
|
||||
it->second.smallest_max_other_session_count);
|
||||
if (it->second.session_count > max_other_session_count) {
|
||||
MaybeLogUploadEvent(
|
||||
cfg, uuid,
|
||||
PerfettoStatsdAtom::
|
||||
kTracedEnableTracingFailedSessionSemaphoreCheck);
|
||||
return PERFETTO_SVC_ERR(
|
||||
"Semaphore \"%s\" exceeds maximum allowed other session count "
|
||||
"(%" PRIu64 " > min(%" PRIu64 ", %" PRIu64 "))",
|
||||
semaphore.name().c_str(), it->second.session_count,
|
||||
semaphore.max_other_session_count(),
|
||||
it->second.smallest_max_other_session_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.enable_extra_guardrails()) {
|
||||
// unique_session_name can be empty
|
||||
const std::string& name = cfg.unique_session_name();
|
||||
@ -47928,13 +48230,14 @@ void TracingServiceImpl::ActivateTriggers(
|
||||
tracing_session.config, tracing_session.trace_uuid,
|
||||
PerfettoStatsdAtom::kTracedTriggerCloneSnapshot, iter->name());
|
||||
task_runner_->PostDelayedTask(
|
||||
[weak_this, tsid] {
|
||||
[weak_this, tsid, trigger_name = iter->name()] {
|
||||
if (!weak_this)
|
||||
return;
|
||||
auto* tsess = weak_this->GetTracingSession(tsid);
|
||||
if (!tsess || !tsess->consumer_maybe_null)
|
||||
return;
|
||||
tsess->consumer_maybe_null->NotifyCloneSnapshotTrigger();
|
||||
tsess->consumer_maybe_null->NotifyCloneSnapshotTrigger(
|
||||
trigger_name);
|
||||
},
|
||||
iter->stop_delay_ms());
|
||||
break;
|
||||
@ -48119,7 +48422,7 @@ void TracingServiceImpl::NotifyFlushDoneForProducer(
|
||||
it++;
|
||||
}
|
||||
} // for (pending_flushes)
|
||||
} // for (tracing_session)
|
||||
} // for (tracing_session)
|
||||
}
|
||||
|
||||
void TracingServiceImpl::OnFlushTimeout(TracingSessionID tsid,
|
||||
@ -48666,7 +48969,7 @@ std::vector<TracePacket> TracingServiceImpl::ReadBuffers(
|
||||
did_hit_threshold = packets_bytes >= threshold;
|
||||
packets.emplace_back(std::move(packet));
|
||||
} // for(packets...)
|
||||
} // for(buffers...)
|
||||
} // for(buffers...)
|
||||
|
||||
*has_more = did_hit_threshold;
|
||||
|
||||
@ -48881,10 +49184,23 @@ void TracingServiceImpl::FreeBuffers(TracingSessionID tsid) {
|
||||
bool is_long_trace =
|
||||
(tracing_session->config.write_into_file() &&
|
||||
tracing_session->config.file_write_period_ms() < kMillisPerDay);
|
||||
auto pending_clones = std::move(tracing_session->pending_clones);
|
||||
tracing_sessions_.erase(tsid);
|
||||
tracing_session = nullptr;
|
||||
UpdateMemoryGuardrail();
|
||||
|
||||
for (const auto& id_to_clone_op : pending_clones) {
|
||||
const PendingClone& clone_op = id_to_clone_op.second;
|
||||
if (clone_op.weak_consumer) {
|
||||
task_runner_->PostTask([weak_consumer = clone_op.weak_consumer] {
|
||||
if (weak_consumer) {
|
||||
weak_consumer->consumer_->OnSessionCloned(
|
||||
{false, "Original session ended", {}});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
PERFETTO_LOG("Tracing session %" PRIu64 " ended, total sessions:%zu", tsid,
|
||||
tracing_sessions_.size());
|
||||
#if PERFETTO_BUILDFLAG(PERFETTO_ANDROID_BUILD) && \
|
||||
@ -49063,6 +49379,37 @@ void TracingServiceImpl::UnregisterDataSource(ProducerID producer_id,
|
||||
name.c_str(), producer_id);
|
||||
}
|
||||
|
||||
bool TracingServiceImpl::IsInitiatorPrivileged(
|
||||
const TracingSession& tracing_session) {
|
||||
#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
|
||||
if (tracing_session.consumer_uid == 1066 /* AID_STATSD */ &&
|
||||
tracing_session.config.statsd_metadata().triggering_config_uid() !=
|
||||
2000 /* AID_SHELL */
|
||||
&& tracing_session.config.statsd_metadata().triggering_config_uid() !=
|
||||
0 /* AID_ROOT */) {
|
||||
// StatsD can be triggered either by shell, root or an app that has DUMP and
|
||||
// USAGE_STATS permission. When triggered by shell or root, we do not want
|
||||
// to consider the trace a trusted system trace, as it was initiated by the
|
||||
// user. Otherwise, it has to come from an app with DUMP and
|
||||
// PACKAGE_USAGE_STATS, which has to be preinstalled and trusted by the
|
||||
// system.
|
||||
// Check for shell / root: https://bit.ly/3b7oZNi
|
||||
// Check for DUMP or PACKAGE_USAGE_STATS: https://bit.ly/3ep0NrR
|
||||
return true;
|
||||
}
|
||||
if (tracing_session.consumer_uid == 1000 /* AID_SYSTEM */) {
|
||||
// AID_SYSTEM is considered a privileged initiator so that system_server can
|
||||
// profile apps that are not profileable by shell. Other AID_SYSTEM
|
||||
// processes are not allowed by SELinux to connect to the consumer socket or
|
||||
// to exec perfetto.
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
base::ignore_result(tracing_session);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
TracingServiceImpl::DataSourceInstance* TracingServiceImpl::SetupDataSource(
|
||||
const TraceConfig::DataSource& cfg_data_source,
|
||||
const TraceConfig::ProducerConfig& producer_config,
|
||||
@ -49139,19 +49486,7 @@ TracingServiceImpl::DataSourceInstance* TracingServiceImpl::SetupDataSource(
|
||||
ds_config.set_stop_timeout_ms(tracing_session->data_source_stop_timeout_ms());
|
||||
ds_config.set_enable_extra_guardrails(
|
||||
tracing_session->config.enable_extra_guardrails());
|
||||
if (tracing_session->consumer_uid == 1066 /* AID_STATSD */ &&
|
||||
tracing_session->config.statsd_metadata().triggering_config_uid() !=
|
||||
2000 /* AID_SHELL */
|
||||
&& tracing_session->config.statsd_metadata().triggering_config_uid() !=
|
||||
0 /* AID_ROOT */) {
|
||||
// StatsD can be triggered either by shell, root or an app that has DUMP and
|
||||
// USAGE_STATS permission. When triggered by shell or root, we do not want
|
||||
// to consider the trace a trusted system trace, as it was initiated by the
|
||||
// user. Otherwise, it has to come from an app with DUMP and
|
||||
// PACKAGE_USAGE_STATS, which has to be preinstalled and trusted by the
|
||||
// system.
|
||||
// Check for shell / root: https://bit.ly/3b7oZNi
|
||||
// Check for DUMP or PACKAGE_USAGE_STATS: https://bit.ly/3ep0NrR
|
||||
if (IsInitiatorPrivileged(*tracing_session)) {
|
||||
ds_config.set_session_initiator(
|
||||
DataSourceConfig::SESSION_INITIATOR_TRUSTED_SYSTEM);
|
||||
} else {
|
||||
@ -49435,9 +49770,9 @@ void TracingServiceImpl::UpdateMemoryGuardrail() {
|
||||
// Sum up all the cloned traced buffers.
|
||||
for (const auto& id_to_ts : tracing_sessions_) {
|
||||
const TracingSession& ts = id_to_ts.second;
|
||||
for (const auto& id_to_pending_clone : ts.pending_clones) {
|
||||
const PendingClone& pending_clone = id_to_pending_clone.second;
|
||||
for (const std::unique_ptr<TraceBuffer>& buf : pending_clone.buffers) {
|
||||
for (const auto& id_to_clone_op : ts.pending_clones) {
|
||||
const PendingClone& clone_op = id_to_clone_op.second;
|
||||
for (const std::unique_ptr<TraceBuffer>& buf : clone_op.buffers) {
|
||||
if (buf) {
|
||||
total_buffer_bytes += buf->size();
|
||||
}
|
||||
@ -49710,8 +50045,8 @@ TraceStats TracingServiceImpl::GetTraceStats(TracingSession* tracing_session) {
|
||||
wri_stats->add_chunk_payload_histogram_sum(hist.GetBucketSum(i));
|
||||
}
|
||||
} // for each sequence (writer).
|
||||
} // for each buffer.
|
||||
} // if (!disable_chunk_usage_histograms)
|
||||
} // for each buffer.
|
||||
} // if (!disable_chunk_usage_histograms)
|
||||
|
||||
return trace_stats;
|
||||
}
|
||||
@ -49776,6 +50111,13 @@ void TracingServiceImpl::EmitSystemInfo(std::vector<TracePacket>* packets) {
|
||||
} else {
|
||||
PERFETTO_ELOG("Unable to read ro.build.version.sdk");
|
||||
}
|
||||
|
||||
std::string soc_model_value = base::GetAndroidProp("ro.soc.model");
|
||||
if (!soc_model_value.empty()) {
|
||||
info->set_android_soc_model(soc_model_value);
|
||||
} else {
|
||||
PERFETTO_ELOG("Unable to read ro.soc.model");
|
||||
}
|
||||
#endif // PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
|
||||
packet->set_trusted_uid(static_cast<int32_t>(uid_));
|
||||
packet->set_trusted_packet_sequence_id(kServicePacketSequenceID);
|
||||
@ -49927,10 +50269,11 @@ size_t TracingServiceImpl::PurgeExpiredAndCountTriggerInWindow(
|
||||
return trigger_count;
|
||||
}
|
||||
|
||||
void TracingServiceImpl::FlushAndCloneSession(ConsumerEndpointImpl* consumer,
|
||||
TracingSessionID tsid,
|
||||
bool skip_trace_filter,
|
||||
bool for_bugreport) {
|
||||
base::Status TracingServiceImpl::FlushAndCloneSession(
|
||||
ConsumerEndpointImpl* consumer,
|
||||
TracingSessionID tsid,
|
||||
bool skip_trace_filter,
|
||||
bool for_bugreport) {
|
||||
PERFETTO_DCHECK_THREAD(thread_checker_);
|
||||
auto clone_target = FlushFlags::CloneTarget::kUnknown;
|
||||
|
||||
@ -49943,9 +50286,8 @@ void TracingServiceImpl::FlushAndCloneSession(ConsumerEndpointImpl* consumer,
|
||||
PERFETTO_LOG("Looking for sessions for bugreport");
|
||||
TracingSession* session = FindTracingSessionWithMaxBugreportScore();
|
||||
if (!session) {
|
||||
consumer->consumer_->OnSessionCloned(
|
||||
{false, "No tracing sessions eligible for bugreport found", {}});
|
||||
return;
|
||||
return base::ErrStatus(
|
||||
"No tracing sessions eligible for bugreport found");
|
||||
}
|
||||
tsid = session->id;
|
||||
clone_target = FlushFlags::CloneTarget::kBugreport;
|
||||
@ -49957,9 +50299,14 @@ void TracingServiceImpl::FlushAndCloneSession(ConsumerEndpointImpl* consumer,
|
||||
|
||||
TracingSession* session = GetTracingSession(tsid);
|
||||
if (!session) {
|
||||
consumer->consumer_->OnSessionCloned(
|
||||
{false, "Tracing session not found", {}});
|
||||
return;
|
||||
return base::ErrStatus("Tracing session not found");
|
||||
}
|
||||
|
||||
// Skip the UID check for sessions marked with a bugreport_score > 0.
|
||||
// Those sessions, by design, can be stolen by any other consumer for the
|
||||
// sake of creating snapshots for bugreports.
|
||||
if (!session->IsCloneAllowed(consumer->uid_)) {
|
||||
return PERFETTO_SVC_ERR("Not allowed to clone a session from another UID");
|
||||
}
|
||||
|
||||
// If any of the buffers are marked as clear_before_clone, reset them before
|
||||
@ -49991,9 +50338,8 @@ void TracingServiceImpl::FlushAndCloneSession(ConsumerEndpointImpl* consumer,
|
||||
// We cannot leave the original tracing session buffer-less as it would
|
||||
// cause crashes when data sources commit new data.
|
||||
buf = std::move(old_buf);
|
||||
consumer->consumer_->OnSessionCloned(
|
||||
{false, "Buffer allocation failed while attempting to clone", {}});
|
||||
return;
|
||||
return base::ErrStatus(
|
||||
"Buffer allocation failed while attempting to clone");
|
||||
}
|
||||
}
|
||||
|
||||
@ -50039,6 +50385,8 @@ void TracingServiceImpl::FlushAndCloneSession(ConsumerEndpointImpl* consumer,
|
||||
FlushFlags(FlushFlags::Initiator::kTraced,
|
||||
FlushFlags::Reason::kTraceClone, clone_target));
|
||||
}
|
||||
|
||||
return base::OkStatus();
|
||||
}
|
||||
|
||||
std::map<ProducerID, std::vector<DataSourceInstanceID>>
|
||||
@ -50176,13 +50524,6 @@ base::Status TracingServiceImpl::FinishCloneSession(
|
||||
"The consumer is already attached to another tracing session");
|
||||
}
|
||||
|
||||
// Skip the UID check for sessions marked with a bugreport_score > 0.
|
||||
// Those sessions, by design, can be stolen by any other consumer for the
|
||||
// sake of creating snapshots for bugreports.
|
||||
if (!src->IsCloneAllowed(consumer->uid_)) {
|
||||
return PERFETTO_SVC_ERR("Not allowed to clone a session from another UID");
|
||||
}
|
||||
|
||||
std::vector<BufferID> buf_ids =
|
||||
buffer_ids_.AllocateMultiple(buf_snaps.size());
|
||||
if (buf_ids.size() != buf_snaps.size()) {
|
||||
@ -50485,13 +50826,15 @@ void TracingServiceImpl::ConsumerEndpointImpl::OnAllDataSourcesStarted() {
|
||||
observable_events->set_all_data_sources_started(true);
|
||||
}
|
||||
|
||||
void TracingServiceImpl::ConsumerEndpointImpl::NotifyCloneSnapshotTrigger() {
|
||||
void TracingServiceImpl::ConsumerEndpointImpl::NotifyCloneSnapshotTrigger(
|
||||
const std::string& trigger_name) {
|
||||
if (!(observable_events_mask_ & ObservableEvents::TYPE_CLONE_TRIGGER_HIT)) {
|
||||
return;
|
||||
}
|
||||
auto* observable_events = AddObservableEvents();
|
||||
auto* clone_trig = observable_events->mutable_clone_trigger_hit();
|
||||
clone_trig->set_tracing_session_id(static_cast<int64_t>(tracing_session_id_));
|
||||
clone_trig->set_trigger_name(trigger_name);
|
||||
}
|
||||
|
||||
ObservableEvents*
|
||||
@ -50621,8 +50964,12 @@ void TracingServiceImpl::ConsumerEndpointImpl::CloneSession(
|
||||
CloneSessionArgs args) {
|
||||
PERFETTO_DCHECK_THREAD(thread_checker_);
|
||||
// FlushAndCloneSession will call OnSessionCloned after the async flush.
|
||||
service_->FlushAndCloneSession(this, tsid, args.skip_trace_filter,
|
||||
args.for_bugreport);
|
||||
base::Status result = service_->FlushAndCloneSession(
|
||||
this, tsid, args.skip_trace_filter, args.for_bugreport);
|
||||
|
||||
if (!result.ok()) {
|
||||
consumer_->OnSessionCloned({false, result.message(), {}});
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -51118,6 +51465,7 @@ TracingService* InProcessTracingBackend::GetOrCreateService(
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/surfaceflinger_layers_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/protolog_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/common/protolog_common.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/pixel_modem_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/packages_list_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/network_trace_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/android_sdk_sysprop_guard_config.gen.h"
|
||||
@ -52886,6 +53234,7 @@ void EnableTracingRequest::Serialize(::protozero::Message* msg) const {
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/surfaceflinger_layers_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/protolog_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/common/protolog_common.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/pixel_modem_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/packages_list_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/network_trace_config.gen.h"
|
||||
// gen_amalgamated expanded: #include "protos/perfetto/config/android/android_sdk_sysprop_guard_config.gen.h"
|
||||
@ -55447,7 +55796,7 @@ namespace base {
|
||||
// Define the ScopedSocketHandle type.
|
||||
|
||||
#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
|
||||
int CloseSocket(SocketHandle); // A wrapper around ::closesocket().
|
||||
int CloseSocket(SocketHandle); // A wrapper around ::closesocket().
|
||||
using ScopedSocketHandle =
|
||||
ScopedResource<SocketHandle, CloseSocket, static_cast<SocketHandle>(-1)>;
|
||||
#else
|
||||
|
21831
third_party/perfetto/sdk/perfetto.h
vendored
21831
third_party/perfetto/sdk/perfetto.h
vendored
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user