#include "src/trace_processor/importers/proto/track_event_tokenizer.h"
#include <cinttypes>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <utility>
#include "perfetto/base/compiler.h"
#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/status_or.h"
#include "perfetto/ext/base/string_view.h"
#include "perfetto/protozero/proto_decoder.h"
#include "perfetto/public/compiler.h"
#include "perfetto/trace_processor/ref_counted.h"
#include "perfetto/trace_processor/trace_blob_view.h"
#include "protos/perfetto/trace/interned_data/interned_data.pbzero.h"
#include "protos/perfetto/trace/track_event/debug_annotation.pbzero.h"
#include "src/trace_processor/importers/common/clock_tracker.h"
#include "src/trace_processor/importers/common/legacy_v8_cpu_profile_tracker.h"
#include "src/trace_processor/importers/common/metadata_tracker.h"
#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/common/process_tracker.h"
#include "src/trace_processor/importers/json/json_utils.h"
#include "src/trace_processor/importers/proto/packet_sequence_state_generation.h"
#include "src/trace_processor/importers/proto/proto_importer_module.h"
#include "src/trace_processor/importers/proto/proto_trace_reader.h"
#include "src/trace_processor/importers/proto/track_event_tracker.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 "protos/perfetto/common/builtin_clock.pbzero.h"
#include "protos/perfetto/trace/trace_packet.pbzero.h"
#include "protos/perfetto/trace/track_event/counter_descriptor.pbzero.h"
#include "protos/perfetto/trace/track_event/process_descriptor.pbzero.h"
#include "protos/perfetto/trace/track_event/range_of_interest.pbzero.h"
#include "protos/perfetto/trace/track_event/thread_descriptor.pbzero.h"
#include "protos/perfetto/trace/track_event/track_descriptor.pbzero.h"
#include "protos/perfetto/trace/track_event/track_event.pbzero.h"
#include "src/trace_processor/types/variadic.h"
#include "src/trace_processor/util/status_macros.h"
namespace perfetto::trace_processor {
namespace {
CounterDescriptor;
}
TrackEventTokenizer::TrackEventTokenizer(TraceProcessorContext* context,
TrackEventTracker* track_event_tracker)
: … { … }
ModuleResult TrackEventTokenizer::TokenizeRangeOfInterestPacket(
RefPtr<PacketSequenceStateGeneration> ,
const protos::pbzero::TracePacket::Decoder& packet,
int64_t ) { … }
ModuleResult TrackEventTokenizer::TokenizeTrackDescriptorPacket(
RefPtr<PacketSequenceStateGeneration> state,
const protos::pbzero::TracePacket::Decoder& packet,
int64_t packet_timestamp) { … }
ModuleResult TrackEventTokenizer::TokenizeThreadDescriptorPacket(
RefPtr<PacketSequenceStateGeneration> state,
const protos::pbzero::TracePacket::Decoder& packet) { … }
void TrackEventTokenizer::TokenizeThreadDescriptor(
PacketSequenceStateGeneration& state,
const protos::pbzero::ThreadDescriptor::Decoder& thread) { … }
ModuleResult TrackEventTokenizer::TokenizeTrackEventPacket(
RefPtr<PacketSequenceStateGeneration> state,
const protos::pbzero::TracePacket::Decoder& packet,
TraceBlobView* packet_blob,
int64_t packet_timestamp) { … }
template <typename T>
base::Status TrackEventTokenizer::AddExtraCounterValues(
TrackEventData& data,
size_t& index,
uint32_t trusted_packet_sequence_id,
protozero::RepeatedFieldIterator<T> value_it,
protozero::RepeatedFieldIterator<uint64_t> packet_track_uuid_it,
protozero::RepeatedFieldIterator<uint64_t> default_track_uuid_it) { … }
base::Status TrackEventTokenizer::TokenizeLegacySampleEvent(
const protos::pbzero::TrackEvent::Decoder& event,
const protos::pbzero::TrackEvent::LegacyEvent::Decoder& legacy,
PacketSequenceStateGeneration& state) { … }
}