#include "src/trace_processor/importers/proto/proto_trace_reader.h"
#include <algorithm>
#include <cinttypes>
#include <cstddef>
#include <cstdint>
#include <map>
#include <numeric>
#include <optional>
#include <tuple>
#include <utility>
#include <vector>
#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/flat_hash_map.h"
#include "perfetto/ext/base/status_or.h"
#include "perfetto/ext/base/string_view.h"
#include "perfetto/protozero/field.h"
#include "perfetto/protozero/proto_decoder.h"
#include "perfetto/public/compiler.h"
#include "src/trace_processor/importers/common/clock_tracker.h"
#include "src/trace_processor/importers/common/event_tracker.h"
#include "src/trace_processor/importers/common/metadata_tracker.h"
#include "src/trace_processor/importers/proto/packet_analyzer.h"
#include "src/trace_processor/importers/proto/proto_importer_module.h"
#include "src/trace_processor/sorter/trace_sorter.h"
#include "src/trace_processor/storage/metadata.h"
#include "src/trace_processor/storage/stats.h"
#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/tables/metadata_tables_py.h"
#include "src/trace_processor/types/variadic.h"
#include "src/trace_processor/util/descriptors.h"
#include "protos/perfetto/common/builtin_clock.pbzero.h"
#include "protos/perfetto/common/trace_stats.pbzero.h"
#include "protos/perfetto/config/trace_config.pbzero.h"
#include "protos/perfetto/trace/clock_snapshot.pbzero.h"
#include "protos/perfetto/trace/extension_descriptor.pbzero.h"
#include "protos/perfetto/trace/perfetto/tracing_service_event.pbzero.h"
#include "protos/perfetto/trace/remote_clock_sync.pbzero.h"
#include "protos/perfetto/trace/trace.pbzero.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
namespace perfetto::trace_processor {
ProtoTraceReader::ProtoTraceReader(TraceProcessorContext* ctx)
: … { … }
ProtoTraceReader::~ProtoTraceReader() = default;
base::Status ProtoTraceReader::Parse(TraceBlobView blob) { … }
base::Status ProtoTraceReader::ParseExtensionDescriptor(ConstBytes descriptor) { … }
base::Status ProtoTraceReader::ParsePacket(TraceBlobView packet) { … }
void ProtoTraceReader::ParseTraceConfig(protozero::ConstBytes blob) { … }
void ProtoTraceReader::HandleIncrementalStateCleared(
const protos::pbzero::TracePacket::Decoder& packet_decoder) { … }
void ProtoTraceReader::HandleFirstPacketOnSequence(
uint32_t packet_sequence_id) { … }
void ProtoTraceReader::HandlePreviousPacketDropped(
const protos::pbzero::TracePacket::Decoder& packet_decoder) { … }
void ProtoTraceReader::ParseTracePacketDefaults(
const protos::pbzero::TracePacket_Decoder& packet_decoder,
TraceBlobView trace_packet_defaults) { … }
void ProtoTraceReader::ParseInternedData(
const protos::pbzero::TracePacket::Decoder& packet_decoder,
TraceBlobView interned_data) { … }
base::Status ProtoTraceReader::ParseClockSnapshot(ConstBytes blob,
uint32_t seq_id) { … }
base::Status ProtoTraceReader::ParseRemoteClockSync(ConstBytes blob) { … }
base::FlatHashMap<int64_t , int64_t >
ProtoTraceReader::CalculateClockOffsets(
std::vector<SyncClockSnapshots>& sync_clock_snapshots) { … }
std::optional<StringId> ProtoTraceReader::GetBuiltinClockNameOrNull(
int64_t clock_id) { … }
base::Status ProtoTraceReader::ParseServiceEvent(int64_t ts, ConstBytes blob) { … }
void ProtoTraceReader::ParseTraceStats(ConstBytes blob) { … }
base::Status ProtoTraceReader::NotifyEndOfFile() { … }
}