#include "src/trace_processor/importers/perf/perf_data_tokenizer.h"
#include <algorithm>
#include <cinttypes>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <optional>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include "perfetto/base/flat_set.h"
#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/status_or.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/clock_snapshot.pbzero.h"
#include "protos/third_party/simpleperf/record_file.pbzero.h"
#include "src/trace_processor/importers/common/clock_tracker.h"
#include "src/trace_processor/importers/common/slice_tracker.h"
#include "src/trace_processor/importers/perf/attrs_section_reader.h"
#include "src/trace_processor/importers/perf/dso_tracker.h"
#include "src/trace_processor/importers/perf/features.h"
#include "src/trace_processor/importers/perf/perf_event.h"
#include "src/trace_processor/importers/perf/perf_event_attr.h"
#include "src/trace_processor/importers/perf/perf_file.h"
#include "src/trace_processor/importers/perf/perf_session.h"
#include "src/trace_processor/importers/perf/reader.h"
#include "src/trace_processor/importers/perf/record.h"
#include "src/trace_processor/importers/proto/perf_sample_tracker.h"
#include "src/trace_processor/sorter/trace_sorter.h"
#include "src/trace_processor/storage/stats.h"
#include "src/trace_processor/util/build_id.h"
#include "src/trace_processor/util/status_macros.h"
namespace perfetto::trace_processor::perf_importer {
namespace {
void AddIds(uint8_t id_offset,
uint64_t flags,
base::FlatSet<uint8_t>& feature_ids) { … }
base::FlatSet<uint8_t> ExtractFeatureIds(const uint64_t& flags,
const uint64_t (&flags1)[3]) { … }
bool ReadTime(const Record& record, std::optional<uint64_t>& time) { … }
}
PerfDataTokenizer::PerfDataTokenizer(TraceProcessorContext* ctx)
: … { … }
PerfDataTokenizer::~PerfDataTokenizer() = default;
base::Status PerfDataTokenizer::Parse(TraceBlobView blob) { … }
base::StatusOr<PerfDataTokenizer::ParsingResult>
PerfDataTokenizer::ParseHeader() { … }
base::StatusOr<PerfDataTokenizer::ParsingResult>
PerfDataTokenizer::ParseAttrs() { … }
base::StatusOr<PerfDataTokenizer::ParsingResult>
PerfDataTokenizer::SeekRecords() { … }
base::StatusOr<PerfDataTokenizer::ParsingResult>
PerfDataTokenizer::ParseRecords() { … }
base::StatusOr<PerfDataTokenizer::ParsingResult> PerfDataTokenizer::ParseRecord(
Record& record) { … }
base::StatusOr<int64_t> PerfDataTokenizer::ToTraceTimestamp(
std::optional<uint64_t> time) { … }
bool PerfDataTokenizer::PushRecord(Record record) { … }
base::StatusOr<PerfDataTokenizer::ParsingResult>
PerfDataTokenizer::ParseFeatureSections() { … }
base::StatusOr<PerfDataTokenizer::ParsingResult>
PerfDataTokenizer::ParseFeatures() { … }
base::Status PerfDataTokenizer::ParseFeature(uint8_t feature_id,
TraceBlobView data) { … }
base::Status PerfDataTokenizer::NotifyEndOfFile() { … }
}