#include "src/trace_processor/importers/perf/record_parser.h"
#include <cinttypes>
#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/public/compiler.h"
#include "perfetto/trace_processor/ref_counted.h"
#include "src/trace_processor/importers/common/address_range.h"
#include "src/trace_processor/importers/common/create_mapping_params.h"
#include "src/trace_processor/importers/common/mapping_tracker.h"
#include "src/trace_processor/importers/common/process_tracker.h"
#include "src/trace_processor/importers/common/stack_profile_tracker.h"
#include "src/trace_processor/importers/common/virtual_memory_mapping.h"
#include "src/trace_processor/importers/perf/mmap_record.h"
#include "src/trace_processor/importers/perf/perf_counter.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/reader.h"
#include "src/trace_processor/importers/perf/record.h"
#include "src/trace_processor/importers/perf/sample.h"
#include "src/trace_processor/importers/proto/perf_sample_tracker.h"
#include "src/trace_processor/importers/proto/profile_packet_utils.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/tables/profiler_tables_py.h"
#include "src/trace_processor/util/build_id.h"
#include "src/trace_processor/util/status_macros.h"
#include "protos/perfetto/trace/profiling/profile_packet.pbzero.h"
namespace perfetto::trace_processor::perf_importer {
namespace {
CreateMappingParams BuildCreateMappingParams(
const CommonMmapRecordFields& fields,
std::string filename,
std::optional<BuildId> build_id) { … }
bool IsInKernel(protos::pbzero::Profiling::CpuMode cpu_mode) { … }
}
FramesTable;
CallsitesTable;
RecordParser::RecordParser(TraceProcessorContext* context)
: … { … }
RecordParser::~RecordParser() = default;
void RecordParser::ParsePerfRecord(int64_t ts, Record record) { … }
base::Status RecordParser::ParseRecord(int64_t ts, Record record) { … }
base::Status RecordParser::ParseSample(int64_t ts, Record record) { … }
base::Status RecordParser::InternSample(Sample sample) { … }
std::optional<CallsiteId> RecordParser::InternCallchain(
UniquePid upid,
const std::vector<Sample::Frame>& callchain,
bool adjust_pc) { … }
base::Status RecordParser::ParseComm(Record record) { … }
base::Status RecordParser::ParseMmap(Record record) { … }
base::Status RecordParser::ParseMmap2(Record record) { … }
UniquePid RecordParser::GetUpid(const CommonMmapRecordFields& fields) const { … }
base::Status RecordParser::UpdateCounters(const Sample& sample) { … }
base::Status RecordParser::UpdateCountersInReadGroups(const Sample& sample) { … }
DummyMemoryMapping* RecordParser::GetDummyMapping(UniquePid upid) { … }
}