Skip to content

Commit

Permalink
tp: fix crash with linux device frequency tracks
Browse files Browse the repository at this point in the history
Fixes: 374847581
Change-Id: Id8445187d22af2a143d978c4872c496dcf81f063
  • Loading branch information
LalitMaganti committed Oct 28, 2024
1 parent f3084a8 commit 6028433
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
10 changes: 3 additions & 7 deletions src/trace_processor/importers/ftrace/ftrace_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3807,13 +3807,9 @@ void FtraceParser::ParseDeviceFrequency(int64_t ts,
StringId device_name = context_->storage->InternString(
(dev_name.substr(position + sizeof(kDelimiter) - 1) + "freq").c_str());

TrackTracker::DimensionsBuilder dims_builder =
context_->track_tracker->CreateDimensionsBuilder();
dims_builder.AppendDimension(device_name_id_, Variadic::String(device_name));
TrackTracker::Dimensions dims_id = std::move(dims_builder).Build();

TrackId track_id = context_->track_tracker->InternCounterTrack(
tracks::linux_device_frequency, dims_id);
TrackId track_id = context_->track_tracker->InternSingleDimensionTrack(
tracks::linux_device_frequency, device_name_id_,
Variadic::String(device_name));
context_->event_tracker->PushCounter(ts, static_cast<double>(event.freq()),
track_id);
}
Expand Down
9 changes: 4 additions & 5 deletions src/trace_processor/perfetto_sql/stdlib/linux/devfreq.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ SELECT
FROM counter_leading_intervals!((
SELECT c.*
FROM counter c
JOIN counter_track ct ON ct.id = c.track_id
WHERE ct.classification = 'linux_device_frequency'
AND EXTRACT_ARG(ct.dimension_arg_set_id, 'device_name') = $device_name
)) AS count_w_dur
JOIN counter_track AS ct ON track_id = ct.id;
JOIN track t ON t.id = c.track_id
WHERE t.classification = 'linux_device_frequency'
AND EXTRACT_ARG(t.dimension_arg_set_id, 'device_name') = $device_name
)) AS count_w_dur;

-- ARM DSU device frequency counters. This table will only be populated on
-- traces collected with "devfreq/devfreq_frequency" ftrace event enabled,
Expand Down
1 change: 1 addition & 0 deletions ui/src/plugins/dev.perfetto.AsyncSlices/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class AsyncSlicePlugin implements PerfettoPlugin {
and (name != '${suspendResumeLatencyTrackName}' or name is null)
and classification not in (
'linux_rpm',
'linux_device_frequency',
'irq_counter',
'softirq_counter',
'android_energy_estimation_breakdown',
Expand Down

0 comments on commit 6028433

Please sign in to comment.