#include "src/trace_processor/importers/proto/gpu_event_parser.h"
#include <cinttypes>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <optional>
#include <string>
#include "perfetto/base/logging.h"
#include "perfetto/ext/base/string_utils.h"
#include "perfetto/ext/base/string_view.h"
#include "perfetto/ext/base/string_writer.h"
#include "perfetto/protozero/field.h"
#include "protos/perfetto/trace/android/gpu_mem_event.pbzero.h"
#include "src/trace_processor/importers/common/args_tracker.h"
#include "src/trace_processor/importers/common/event_tracker.h"
#include "src/trace_processor/importers/common/process_tracker.h"
#include "src/trace_processor/importers/common/slice_tracker.h"
#include "src/trace_processor/importers/common/track_tracker.h"
#include "src/trace_processor/importers/proto/packet_sequence_state_generation.h"
#include "src/trace_processor/importers/proto/vulkan_memory_tracker.h"
#include "src/trace_processor/storage/stats.h"
#include "src/trace_processor/storage/trace_storage.h"
#include "src/trace_processor/tables/profiler_tables_py.h"
#include "src/trace_processor/tables/slice_tables_py.h"
#include "src/trace_processor/tables/track_tables_py.h"
#include "src/trace_processor/types/trace_processor_context.h"
#include "protos/perfetto/common/gpu_counter_descriptor.pbzero.h"
#include "protos/perfetto/trace/gpu/gpu_counter_event.pbzero.h"
#include "protos/perfetto/trace/gpu/gpu_log.pbzero.h"
#include "protos/perfetto/trace/gpu/gpu_render_stage_event.pbzero.h"
#include "protos/perfetto/trace/gpu/vulkan_api_event.pbzero.h"
#include "protos/perfetto/trace/gpu/vulkan_memory_event.pbzero.h"
#include "protos/perfetto/trace/interned_data/interned_data.pbzero.h"
#include "src/trace_processor/types/variadic.h"
namespace perfetto::trace_processor {
namespace {
enum VkObjectType { … };
VulkanMemoryEvent;
}
GpuEventParser::GpuEventParser(TraceProcessorContext* context)
: … { … }
void GpuEventParser::ParseGpuCounterEvent(int64_t ts, ConstBytes blob) { … }
StringId GpuEventParser::GetFullStageName(
PacketSequenceStateGeneration* sequence_state,
const protos::pbzero::GpuRenderStageEvent_Decoder& event) const { … }
void GpuEventParser::InsertGpuTrack(
const protos::pbzero::
GpuRenderStageEvent_Specifications_Description_Decoder& hw_queue) { … }
std::optional<std::string> GpuEventParser::FindDebugName(
int32_t vk_object_type,
uint64_t vk_handle) const { … }
StringId GpuEventParser::ParseRenderSubpasses(
const protos::pbzero::GpuRenderStageEvent_Decoder& event) const { … }
void GpuEventParser::ParseGpuRenderStageEvent(
int64_t ts,
PacketSequenceStateGeneration* sequence_state,
ConstBytes blob) { … }
void GpuEventParser::UpdateVulkanMemoryAllocationCounters(
UniquePid upid,
const VulkanMemoryEvent::Decoder& event) { … }
void GpuEventParser::ParseVulkanMemoryEvent(
PacketSequenceStateGeneration* sequence_state,
ConstBytes blob) { … }
void GpuEventParser::ParseGpuLog(int64_t ts, ConstBytes blob) { … }
void GpuEventParser::ParseVulkanApiEvent(int64_t ts, ConstBytes blob) { … }
void GpuEventParser::ParseGpuMemTotalEvent(int64_t ts, ConstBytes blob) { … }
}