Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions src/trace_processor/importers/ftrace/ftrace_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@ FtraceParser::FtraceParser(TraceProcessorContext* context,
gpu_power_state_off_id_(context->storage->InternString("OFF")),
gpu_power_state_pg_id_(context->storage->InternString("PG")),
gpu_power_state_on_id_(context->storage->InternString("ON")),
gpu_cmdbatch_slice_name_id_(context->storage->InternString("GPU")),
ddic_underrun_id_(context_->storage->InternString("ddic_underrun")),
memcg_reclaim_order_id_(
context->storage->InternString("memcg_reclaim_order")),
Expand Down Expand Up @@ -933,10 +932,6 @@ base::Status FtraceParser::ParseFtraceEvent(uint32_t cpu,
ParseKgslGpuFreq(ts, fld_bytes);
break;
}
case FtraceEvent::kKgslAdrenoCmdbatchRetiredFieldNumber: {
ParseKgslAdrenoCmdbatchRetired(ts, fld_bytes);
break;
}
case FtraceEvent::kCpuIdleFieldNumber: {
ParseCpuIdle(ts, fld_bytes);
break;
Expand Down Expand Up @@ -1941,37 +1936,6 @@ void FtraceParser::ParseKgslGpuFreq(int64_t timestamp, ConstBytes blob) {
context_->event_tracker->PushCounter(timestamp, new_freq, track);
}

void FtraceParser::ParseKgslAdrenoCmdbatchRetired(int64_t timestamp,
protozero::ConstBytes data) {
protos::pbzero::KgslAdrenoCmdbatchRetiredFtraceEvent::Decoder evt(data);

static constexpr auto kBlueprint = TrackCompressor::SliceBlueprint(
"adreno_gpu_cmdbatch",
tracks::DimensionBlueprints(tracks::UintDimensionBlueprint("context_id"),
tracks::UintDimensionBlueprint("prio")),
tracks::FnNameBlueprint([](uint32_t context_id, uint32_t prio) {
return base::StackString<64>("Adreno GPU Cmdbatch (Ctx=%u, Prio=%u)",
context_id, prio);
}));

if (evt.retire() < evt.start()) {
return;
}
// Adreno GPU ticks run at 19.2 MHz, fixed across all Qualcomm mobile SoCs
// (see KGSL_XO_CLK_FREQ in kgsl_pwrctrl.h).
constexpr int64_t kAdrenoGpuTicksPerUs = 19200;
const int64_t duration = static_cast<int64_t>((evt.retire() - evt.start()) *
1000000 / kAdrenoGpuTicksPerUs);

const uint32_t context_id = evt.id();
TrackId track_id = context_->track_compressor->InternScoped(
kBlueprint,
tracks::Dimensions(context_id, static_cast<uint32_t>(evt.prio())),
timestamp, duration);
context_->slice_tracker->Scoped(timestamp, track_id, kNullStringId,
gpu_cmdbatch_slice_name_id_, duration);
}

void FtraceParser::ParseCpuIdle(int64_t timestamp, ConstBytes blob) {
protos::pbzero::CpuIdleFtraceEvent::Decoder idle(blob);
TrackId track = context_->track_tracker->InternTrack(
Expand Down
2 changes: 0 additions & 2 deletions src/trace_processor/importers/ftrace/ftrace_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class FtraceParser {
void ParseCpuFreqThrottle(int64_t timestamp, protozero::ConstBytes);
void ParseGpuFreq(int64_t timestamp, protozero::ConstBytes);
void ParseKgslGpuFreq(int64_t timestamp, protozero::ConstBytes);
void ParseKgslAdrenoCmdbatchRetired(int64_t timestamp, protozero::ConstBytes);
void ParseCpuIdle(int64_t timestamp, protozero::ConstBytes);
void ParsePrint(int64_t timestamp, uint32_t pid, protozero::ConstBytes);
void ParseZero(int64_t timestamp, uint32_t pid, protozero::ConstBytes);
Expand Down Expand Up @@ -464,7 +463,6 @@ class FtraceParser {
const StringId gpu_power_state_off_id_;
const StringId gpu_power_state_pg_id_;
const StringId gpu_power_state_on_id_;
const StringId gpu_cmdbatch_slice_name_id_;
const StringId ddic_underrun_id_;
std::array<StringId, 8> f2fs_checkpoint_reason_ids_;

Expand Down
108 changes: 2 additions & 106 deletions src/trace_processor/importers/ftrace/ftrace_tokenizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
#include "protos/perfetto/trace/ftrace/ftrace_event.pbzero.h"
#include "protos/perfetto/trace/ftrace/ftrace_event_bundle.pbzero.h"
#include "protos/perfetto/trace/ftrace/fwtp_ftrace.pbzero.h"
#include "protos/perfetto/trace/ftrace/kgsl.pbzero.h"
#include "protos/perfetto/trace/ftrace/power.pbzero.h"
#include "protos/perfetto/trace/ftrace/thermal_exynos.pbzero.h"
#include "src/trace_processor/util/clock_synchronizer.h"
Expand All @@ -70,7 +69,6 @@ using protos::pbzero::FtraceEventBundle;
namespace {

constexpr uint32_t kSequenceScopedClockId = 64;
constexpr uint32_t kAdrenoGpuClockId = 65;

// Fast path for parsing the event id of an ftrace event.
// Speculate on the fact that, if the timestamp was found, the common pid
Expand Down Expand Up @@ -158,7 +156,7 @@ base::Status FtraceTokenizer::TokenizeFtraceBundle(

for (auto it = decoder.event(); it; ++it) {
TokenizeFtraceEvent(cpu, clock_id, bundle.slice(it->data(), it->size()),
state, packet_sequence_id);
state);
}

// v50+: optional proto descriptors for generic (i.e. not known at
Expand Down Expand Up @@ -218,8 +216,7 @@ void FtraceTokenizer::TokenizeFtraceEvent(
uint32_t cpu,
ClockTracker::ClockId clock_id,
TraceBlobView event,
RefPtr<PacketSequenceStateGeneration> state,
uint32_t packet_sequence_id) {
RefPtr<PacketSequenceStateGeneration> state) {
constexpr auto kTimestampFieldNumber =
protos::pbzero::FtraceEvent::kTimestampFieldNumber;
constexpr auto kTimestampFieldTag = MakeTagVarInt(kTimestampFieldNumber);
Expand Down Expand Up @@ -306,22 +303,6 @@ void FtraceTokenizer::TokenizeFtraceEvent(
TokenizeFtraceFwtpPerfettoSlice(cpu, std::move(event), std::move(state));
return;
}
if (PERFETTO_UNLIKELY(event_id ==
protos::pbzero::FtraceEvent::
kKgslAdrenoCmdbatchSubmittedFieldNumber)) {
TokenizeFtraceAdrenoCmdbatchSubmitted(cpu, clock_id, raw_timestamp,
std::move(event), std::move(state),
packet_sequence_id);
return;
}
if (PERFETTO_UNLIKELY(
event_id ==
protos::pbzero::FtraceEvent::kKgslAdrenoCmdbatchRetiredFieldNumber)) {
TokenizeFtraceAdrenoCmdbatchRetired(cpu, clock_id, raw_timestamp,
std::move(event), std::move(state),
packet_sequence_id);
return;
}

std::optional<int64_t> timestamp = context_->clock_tracker->ToTraceTime(
clock_id, static_cast<int64_t>(raw_timestamp));
Expand Down Expand Up @@ -517,91 +498,6 @@ FtraceTokenizer::HandleFtraceClockSnapshot(
return clock_id;
}

void FtraceTokenizer::TokenizeFtraceAdrenoCmdbatchSubmitted(
uint32_t cpu,
ClockTracker::ClockId clock_id,
uint64_t raw_timestamp,
TraceBlobView event,
RefPtr<PacketSequenceStateGeneration> state,
uint32_t packet_sequence_id) {
// Adreno GPU ticks run at 19.2 MHz, fixed across all Qualcomm mobile SoCs
// (see KGSL_XO_CLK_FREQ in kgsl_pwrctrl.h).
constexpr int64_t kAdrenoGpuTicksPerUs = 19200;

auto field = GetFtraceEventField(
protos::pbzero::FtraceEvent::kKgslAdrenoCmdbatchSubmittedFieldNumber,
event);
if (!field.has_value())
return;

protos::pbzero::KgslAdrenoCmdbatchSubmittedFtraceEvent::Decoder evt(
field->as_bytes());
// Only register a single clock snapshot: the GPU clock is fixed-frequency
// 19.2 MHz with negligible drift, so one sync point is sufficient.
if (!adreno_gpu_clock_registered_) {
const int64_t sync_time_ns =
static_cast<int64_t>(evt.secs()) * 1000000000LL +
static_cast<int64_t>(evt.usecs()) * 1000LL;
if (sync_time_ns > 0) {
const int64_t gpu_ticks_ns =
static_cast<int64_t>(evt.ticks()) * 1000000 / kAdrenoGpuTicksPerUs;
auto gpu_clock = ClockId::Sequence(context_->trace_id().value,
packet_sequence_id, kAdrenoGpuClockId);
context_->clock_tracker->AddSnapshot({
ClockTracker::ClockTimestamp(gpu_clock, gpu_ticks_ns),
ClockTracker::ClockTimestamp(clock_id, sync_time_ns),
});
adreno_gpu_clock_registered_ = true;
}
}

std::optional<int64_t> timestamp = context_->clock_tracker->ToTraceTime(
clock_id, static_cast<int64_t>(raw_timestamp));
if (!timestamp.has_value()) {
return;
}
module_context_->PushFtraceEvent(
cpu, *timestamp, TracePacketData{std::move(event), std::move(state)});
}

void FtraceTokenizer::TokenizeFtraceAdrenoCmdbatchRetired(
uint32_t cpu,
ClockTracker::ClockId clock_id,
uint64_t raw_timestamp,
TraceBlobView event,
RefPtr<PacketSequenceStateGeneration> state,
uint32_t packet_sequence_id) {
constexpr int64_t kAdrenoGpuTicksPerUs = 19200;

auto field = GetFtraceEventField(
protos::pbzero::FtraceEvent::kKgslAdrenoCmdbatchRetiredFieldNumber,
event);
if (!field.has_value())
return;

protos::pbzero::KgslAdrenoCmdbatchRetiredFtraceEvent::Decoder evt(
field->as_bytes());
auto gpu_clock = ClockId::Sequence(context_->trace_id().value,
packet_sequence_id, kAdrenoGpuClockId);
const int64_t gpu_start_ns =
static_cast<int64_t>(evt.start()) * 1000000 / kAdrenoGpuTicksPerUs;
auto ts = context_->clock_tracker->ToTraceTime(
gpu_clock, gpu_start_ns, std::nullopt, /*suppress_errors=*/true);
if (ts.has_value()) {
module_context_->PushFtraceEvent(
cpu, *ts, TracePacketData{std::move(event), std::move(state)});
return;
}

std::optional<int64_t> timestamp = context_->clock_tracker->ToTraceTime(
clock_id, static_cast<int64_t>(raw_timestamp));
if (!timestamp.has_value()) {
return;
}
module_context_->PushFtraceEvent(
cpu, *timestamp, TracePacketData{std::move(event), std::move(state)});
}

void FtraceTokenizer::TokenizeFtraceGpuWorkPeriod(
uint32_t cpu,
TraceBlobView event,
Expand Down
18 changes: 1 addition & 17 deletions src/trace_processor/importers/ftrace/ftrace_tokenizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ class FtraceTokenizer {
void TokenizeFtraceEvent(uint32_t cpu,
ClockTracker::ClockId,
TraceBlobView event,
RefPtr<PacketSequenceStateGeneration> state,
uint32_t packet_sequence_id);
RefPtr<PacketSequenceStateGeneration> state);
void TokenizeFtraceCompactSched(uint32_t cpu,
ClockTracker::ClockId,
protozero::ConstBytes);
Expand All @@ -76,20 +75,6 @@ class FtraceTokenizer {
base::StatusOr<ClockTracker::ClockId> HandleFtraceClockSnapshot(
protos::pbzero::FtraceEventBundle::Decoder& decoder,
uint32_t packet_sequence_id);
void TokenizeFtraceAdrenoCmdbatchSubmitted(
uint32_t cpu,
ClockTracker::ClockId clock_id,
uint64_t raw_timestamp,
TraceBlobView event,
RefPtr<PacketSequenceStateGeneration> state,
uint32_t packet_sequence_id);
void TokenizeFtraceAdrenoCmdbatchRetired(
uint32_t cpu,
ClockTracker::ClockId clock_id,
uint64_t raw_timestamp,
TraceBlobView event,
RefPtr<PacketSequenceStateGeneration> state,
uint32_t packet_sequence_id);
void TokenizeFtraceGpuWorkPeriod(uint32_t cpu,
TraceBlobView event,
RefPtr<PacketSequenceStateGeneration> state);
Expand Down Expand Up @@ -124,7 +109,6 @@ class FtraceTokenizer {
GenericFtraceTracker* generic_tracker_;

int64_t latest_ftrace_clock_snapshot_ts_ = 0;
bool adreno_gpu_clock_registered_ = false;
std::vector<bool> per_cpu_seen_first_bundle_;
};

Expand Down
2 changes: 0 additions & 2 deletions test/trace_processor/diff_tests/include_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
from diff_tests.parser.etm.tests import Etm
from diff_tests.parser.etw.tests import Etw
from diff_tests.parser.fs.tests import Fs
from diff_tests.parser.ftrace.adreno_cmdbatch_tests import AdrenoCmdbatch
from diff_tests.parser.ftrace.block_io_tests import BlockIo
from diff_tests.parser.ftrace.ftrace_crop_tests import FtraceCrop
from diff_tests.parser.ftrace.kprobes_tests import Kprobes
Expand Down Expand Up @@ -267,7 +266,6 @@ def fetch_all_diff_tests(
ParsingRssStats,
ParsingSysStats,
ParsingMemoryCounters,
AdrenoCmdbatch,
BlockIo,
FtraceCrop,
Kprobes,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,6 @@ export const SLICE_TRACK_SCHEMAS: ReadonlyArray<SliceTrackTypeSchema> = [
topLevelGroup: 'HARDWARE',
group: undefined,
},
{
type: 'adreno_gpu_cmdbatch',
topLevelGroup: 'GPU',
group: 'Adreno Cmdbatch',
},
{
type: 'triggers',
topLevelGroup: 'SYSTEM',
Expand Down
Loading