#include "src/trace_processor/importers/proto/track_event_parser.h"
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/string_view.h"
#include "perfetto/ext/base/string_writer.h"
#include "perfetto/protozero/field.h"
#include "perfetto/protozero/proto_decoder.h"
#include "perfetto/public/compiler.h"
#include "perfetto/trace_processor/basic_types.h"
#include "src/trace_processor/containers/null_term_string_view.h"
#include "src/trace_processor/containers/string_pool.h"
#include "src/trace_processor/importers/common/args_tracker.h"
#include "src/trace_processor/importers/common/args_translation_table.h"
#include "src/trace_processor/importers/common/cpu_tracker.h"
#include "src/trace_processor/importers/common/event_tracker.h"
#include "src/trace_processor/importers/common/flow_tracker.h"
#include "src/trace_processor/importers/common/global_args_tracker.h"
#include "src/trace_processor/importers/common/legacy_v8_cpu_profile_tracker.h"
#include "src/trace_processor/importers/common/parser_types.h"
#include "src/trace_processor/importers/common/process_track_translation_table.h"
#include "src/trace_processor/importers/common/process_tracker.h"
#include "src/trace_processor/importers/common/track_tracker.h"
#include "src/trace_processor/importers/common/virtual_memory_mapping.h"
#include "src/trace_processor/importers/proto/args_parser.h"
#include "src/trace_processor/importers/proto/packet_analyzer.h"
#include "src/trace_processor/importers/proto/stack_profile_sequence_state.h"
#include "src/trace_processor/importers/proto/track_event_tracker.h"
#include "src/trace_processor/storage/stats.h"
#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/tables/slice_tables_py.h"
#include "src/trace_processor/types/variadic.h"
#include "src/trace_processor/util/debug_annotation_parser.h"
#include "src/trace_processor/util/proto_to_args_parser.h"
#include "src/trace_processor/util/status_macros.h"
#include "protos/perfetto/common/android_log_constants.pbzero.h"
#include "protos/perfetto/trace/interned_data/interned_data.pbzero.h"
#include "protos/perfetto/trace/track_event/chrome_active_processes.pbzero.h"
#include "protos/perfetto/trace/track_event/chrome_compositor_scheduler_state.pbzero.h"
#include "protos/perfetto/trace/track_event/chrome_histogram_sample.pbzero.h"
#include "protos/perfetto/trace/track_event/chrome_process_descriptor.pbzero.h"
#include "protos/perfetto/trace/track_event/chrome_thread_descriptor.pbzero.h"
#include "protos/perfetto/trace/track_event/counter_descriptor.pbzero.h"
#include "protos/perfetto/trace/track_event/debug_annotation.pbzero.h"
#include "protos/perfetto/trace/track_event/log_message.pbzero.h"
#include "protos/perfetto/trace/track_event/process_descriptor.pbzero.h"
#include "protos/perfetto/trace/track_event/source_location.pbzero.h"
#include "protos/perfetto/trace/track_event/task_execution.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"
namespace perfetto::trace_processor {
namespace {
BoundInserter;
TrackEvent;
LegacyEvent;
ConstBytes;
constexpr int64_t kPendingThreadDuration = …;
constexpr int64_t kPendingThreadInstructionDelta = …;
std::string NormalizePathSeparators(const protozero::ConstChars& path) { … }
std::optional<base::Status> MaybeParseUnsymbolizedSourceLocation(
const std::string& prefix,
const protozero::Field& field,
util::ProtoToArgsParser::Delegate& delegate) { … }
std::optional<base::Status> MaybeParseSourceLocation(
const std::string& prefix,
const protozero::Field& field,
util::ProtoToArgsParser::Delegate& delegate) { … }
protos::pbzero::AndroidLogPriority ToAndroidLogPriority(
protos::pbzero::LogMessage::Priority prio) { … }
}
class TrackEventParser::EventImporter { … };
TrackEventParser::TrackEventParser(TraceProcessorContext* context,
TrackEventTracker* track_event_tracker)
: … { … }
void TrackEventParser::ParseTrackDescriptor(
int64_t packet_timestamp,
protozero::ConstBytes track_descriptor,
uint32_t packet_sequence_id) { … }
UniquePid TrackEventParser::ParseProcessDescriptor(
int64_t packet_timestamp,
protozero::ConstBytes process_descriptor) { … }
void TrackEventParser::ParseChromeProcessDescriptor(
UniquePid upid,
protozero::ConstBytes chrome_process_descriptor) { … }
UniqueTid TrackEventParser::ParseThreadDescriptor(
protozero::ConstBytes thread_descriptor) { … }
void TrackEventParser::ParseChromeThreadDescriptor(
UniqueTid utid,
protozero::ConstBytes chrome_thread_descriptor) { … }
void TrackEventParser::ParseCounterDescriptor(
TrackId track_id,
protozero::ConstBytes counter_descriptor) { … }
void TrackEventParser::ParseTrackEvent(int64_t ts,
const TrackEventData* event_data,
ConstBytes blob,
uint32_t packet_sequence_id) { … }
void TrackEventParser::AddActiveProcess(int64_t packet_timestamp, int32_t pid) { … }
void TrackEventParser::NotifyEndOfFile() { … }
}