Skip to content

Commit

Permalink
Merge "COPYBARA_IMPORT=Project import generated by Copybara." into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Treehugger Robot authored and Gerrit Code Review committed Nov 29, 2024
2 parents f429651 + f640d10 commit dbfeb77
Show file tree
Hide file tree
Showing 18 changed files with 756 additions and 51 deletions.
566 changes: 566 additions & 0 deletions src/trace_processor/perfetto_sql/stdlib/chrome/chrome_scrolls.sql

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/trace_processor/perfetto_sql/stdlib/chrome/cpu_powerups.sql
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ CREATE PERFETTO TABLE chrome_cpu_power_first_sched_slice_after_powerup(
-- The cpu on which the slice executed.
cpu LONG,
-- Id for the sched_slice table.
sched_id JOINID(sched.id),
sched_id LONG,
-- Unique id for the thread that ran within the slice.
utid JOINID(thread.id),
utid LONG,
-- The CPU's power state before this slice.
previous_power_state LONG,
-- A unique ID for the CPU power-up.
Expand Down Expand Up @@ -163,11 +163,11 @@ CREATE PERFETTO TABLE chrome_cpu_power_post_powerup_slice(
-- The CPU the sched slice ran on.
cpu LONG,
-- Unique thread id for the slice.
utid JOINID(thread.id),
utid LONG,
-- 'id' field from the sched_slice table.
sched_id JOINID(sched.id),
sched_id LONG,
-- Id of the top-level slice for this (sched) slice.
slice_id JOINID(slice.id),
slice_id LONG,
-- Previous power state.
previous_power_state LONG,
-- Id of the powerup.
Expand All @@ -178,7 +178,7 @@ SELECT * FROM _chrome_cpu_power_post_powerup_slice_sj;
-- The first top-level slice that ran after a CPU power-up.
CREATE PERFETTO VIEW chrome_cpu_power_first_toplevel_slice_after_powerup(
-- ID of the slice in the slice table.
slice_id JOINID(slice.id),
slice_id LONG,
-- The power state of the CPU prior to power-up.
previous_power_state LONG
) AS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- into phases, where each subphase can happen only once.
CREATE PERFETTO FUNCTION _descendant_slice_begin(
-- Id of the parent slice.
parent_id JOINID(slice.id),
parent_id LONG,
-- Name of the child with the desired start TS.
child_name STRING
)
Expand All @@ -25,7 +25,7 @@ LIMIT 1;
-- into phases, where each subphase can happen only once.
CREATE PERFETTO FUNCTION _descendant_slice_end(
-- Id of the parent slice.
parent_id JOINID(slice.id),
parent_id LONG,
-- Name of the child with the desired end TS.
child_name STRING
)
Expand Down Expand Up @@ -90,7 +90,7 @@ CREATE PERFETTO TABLE chrome_event_latencies(
-- EventLatency event type.
event_type STRING,
-- Perfetto track this slice is found on.
track_id JOINID(track.id),
track_id LONG,
-- Vsync interval (in milliseconds).
vsync_interval_ms DOUBLE,
-- Whether the corresponding frame is janky.
Expand Down Expand Up @@ -203,7 +203,7 @@ CREATE PERFETTO TABLE chrome_gesture_scroll_events(
-- EventLatency event type.
event_type STRING,
-- Perfetto track this slice is found on.
track_id JOINID(track.id)
track_id LONG
) AS
SELECT
id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ CREATE PERFETTO TABLE chrome_graphics_pipeline_surface_frame_steps(
-- Id of the graphics pipeline, pre-surface aggregation.
surface_frame_trace_id LONG,
-- Utid of the thread where this slice exists.
utid JOINID(thread.id))
utid LONG,
-- Start time of the parent Chrome scheduler task (if any) of this step.
task_start_time_ts INT)
AS
SELECT
id,
Expand All @@ -36,7 +38,8 @@ SELECT
extract_arg(arg_set_id, 'chrome_graphics_pipeline.step') AS step,
extract_arg(arg_set_id, 'chrome_graphics_pipeline.surface_frame_trace_id')
AS surface_frame_trace_id,
utid
utid,
ts - (EXTRACT_ARG(thread_slice.arg_set_id, 'current_task.event_offset_from_task_start_time_us') * 1000) AS task_start_time_ts
FROM thread_slice
WHERE name = 'Graphics.Pipeline' AND surface_frame_trace_id IS NOT NULL;

Expand All @@ -60,7 +63,9 @@ CREATE PERFETTO TABLE chrome_graphics_pipeline_display_frame_steps(
-- Id of the graphics pipeline, post-surface aggregation.
display_trace_id LONG,
-- Utid of the thread where this slice exists.
utid JOINID(thread.id))
utid LONG,
-- Start time of the parent Chrome scheduler task (if any) of this step.
task_start_time_ts INT)
AS
SELECT
id,
Expand All @@ -69,7 +74,8 @@ SELECT
extract_arg(arg_set_id, 'chrome_graphics_pipeline.step') AS step,
extract_arg(arg_set_id, 'chrome_graphics_pipeline.display_trace_id')
AS display_trace_id,
utid
utid,
ts - (EXTRACT_ARG(thread_slice.arg_set_id, 'current_task.event_offset_from_task_start_time_us') * 1000) AS task_start_time_ts
FROM thread_slice
WHERE name = 'Graphics.Pipeline' AND display_trace_id IS NOT NULL;

Expand Down
6 changes: 3 additions & 3 deletions src/trace_processor/perfetto_sql/stdlib/chrome/histograms.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ CREATE PERFETTO TABLE chrome_histograms(
-- Thread name.
thread_name STRING,
-- Utid of the thread.
utid JOINID(thread.id),
utid LONG,
-- Tid of the thread.
tid LONG,
-- Process name.
process_name STRING,
-- Upid of the process.
upid JOINID(process.id),
upid LONG,
-- Pid of the process.
pid LONG
) AS
Expand All @@ -40,4 +40,4 @@ JOIN thread USING (utid)
JOIN process USING (upid)
WHERE
slice.name = "HistogramSample"
AND category = "disabled-by-default-histogram_samples";
AND category = "disabled-by-default-histogram_samples";
8 changes: 4 additions & 4 deletions src/trace_processor/perfetto_sql/stdlib/chrome/input.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ CREATE PERFETTO TABLE _chrome_input_pipeline_steps_no_input_type(
-- Id of this Chrome input pipeline (LatencyInfo).
latency_id LONG,
-- Slice id
slice_id JOINID(slice.id),
slice_id LONG,
-- The step timestamp.
ts TIMESTAMP,
-- Step duration.
dur DURATION,
-- Utid of the thread.
utid JOINID(thread.id),
utid LONG,
-- Step name (ChromeLatencyInfo.step).
step STRING,
-- Input type.
Expand Down Expand Up @@ -62,13 +62,13 @@ CREATE PERFETTO TABLE chrome_input_pipeline_steps(
-- Id of this Chrome input pipeline (LatencyInfo).
latency_id LONG,
-- Slice id
slice_id JOINID(slice.id),
slice_id LONG,
-- The step timestamp.
ts TIMESTAMP,
-- Step duration.
dur DURATION,
-- Utid of the thread.
utid JOINID(thread.id),
utid LONG,
-- Step name (ChromeLatencyInfo.step).
step STRING,
-- Input type.
Expand Down
4 changes: 2 additions & 2 deletions src/trace_processor/perfetto_sql/stdlib/chrome/page_loads.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RETURNS TABLE(
ts TIMESTAMP,
dur DURATION,
navigation_id LONG,
browser_upid JOINID(process.id)
browser_upid LONG
) AS
SELECT
ts,
Expand Down Expand Up @@ -75,7 +75,7 @@ CREATE PERFETTO TABLE chrome_page_loads(
-- URL at the page load event.
url STRING,
-- The unique process id (upid) of the browser process where the page load occurred.
browser_upid JOINID(process.id)
browser_upid LONG
) AS
SELECT
ROW_NUMBER() OVER(ORDER BY fcp.ts) AS id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CREATE PERFETTO TABLE chrome_scroll_interactions(
-- has applied its scroll prediction algorithm.
predictor_janky_frame_count LONG,
-- The process id this event occurred on.
renderer_upid JOINID(process.id)
renderer_upid LONG
) AS
WITH scroll_metrics AS (
SELECT
Expand Down Expand Up @@ -63,4 +63,4 @@ SELECT
delayed_frame_count,
predictor_janky_frame_count,
renderer_upid
FROM scroll_metrics;
FROM scroll_metrics;
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ CREATE PERFETTO TABLE chrome_predictor_error(
scroll_id LONG,
-- An ID for this particular EventLatency regardless of it being presented or
-- not.
event_latency_slice_id JOINID(slice.id),
event_latency_slice_id LONG,
-- An ID that ties this |event_latency_id| with the Trace Id (another
-- event_latency_id) that it was presented with.
scroll_update_id LONG,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CREATE PERFETTO TABLE chrome_janky_event_latencies_v3(
-- The duration of the slice.
dur DURATION,
-- The track_id for the slice.
track_id JOINID(track.id),
track_id LONG,
-- The name of the slice (EventLatency).
name STRING,
-- The stage of EventLatency that the caused the jank.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CREATE PERFETTO FUNCTION _direct_children_slice(
parent_id LONG)
RETURNS TABLE(
-- Alias for `slice.id`.
id JOINID(slice.id),
id LONG,
-- Alias for `slice.type`.
type STRING,
-- Alias for `slice.ts`.
Expand All @@ -20,11 +20,11 @@ RETURNS TABLE(
-- Alias for `slice.name`.
name STRING,
-- Alias for `slice.track_id`.
track_id JOINID(track.id),
track_id LONG,
-- Alias for `slice.depth`.
depth LONG,
-- Alias for `slice.parent_id`.
parent_id JOINID(slice.id),
parent_id LONG,
-- Alias for `slice.arg_set_id`.
arg_set_id LONG,
-- Alias for `slice.thread_ts`.
Expand Down Expand Up @@ -56,10 +56,10 @@ WHERE parent_id = $parent_id;
-- under B, making 5 - 0 = 5 the maximum delta between both slice's direct children
CREATE PERFETTO FUNCTION chrome_get_v3_jank_cause_id(
-- The slice id of the parent slice that we want to cause among it's children.
janky_slice_id JOINID(slice.id),
janky_slice_id LONG,
-- The slice id of the parent slice that's the reference in comparison to
-- |janky_slice_id|.
prev_slice_id JOINID(slice.id)
prev_slice_id LONG
)
-- The slice id of the breakdown that has the maximum duration delta.
RETURNS LONG AS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ CREATE PERFETTO TABLE chrome_scroll_input_offsets(
scroll_id LONG,
-- An ID for this particular EventLatency regardless of it being presented or
-- not.
event_latency_slice_id JOINID(slice.id),
event_latency_slice_id LONG,
-- An ID that ties this |event_latency_id| with the Trace Id (another
-- event_latency_id) that it was presented with.
scroll_update_id LONG,
Expand Down Expand Up @@ -123,7 +123,7 @@ CREATE PERFETTO TABLE chrome_presented_scroll_offsets(
scroll_id LONG,
-- An ID for this particular EventLatency regardless of it being presented or
-- not.
event_latency_slice_id JOINID(slice.id),
event_latency_slice_id LONG,
-- An ID that ties this |event_latency_id| with the Trace Id (another
-- event_latency_id) that it was presented with.
scroll_update_id LONG,
Expand All @@ -146,4 +146,4 @@ SELECT
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS relative_offset_y
FROM _scroll_deltas_with_delays
WHERE presentation_timestamp IS NOT NULL
;
;
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ CREATE PERFETTO TABLE chrome_startups(
-- Launch cause. See Startup.LaunchCauseType in chrome_track_event.proto.
launch_cause STRING,
-- Process ID of the Browser where the startup occurred.
browser_upid JOINID(process.id)
browser_upid LONG
) AS
SELECT
ROW_NUMBER() OVER (ORDER BY start_events.startup_begin_ts) AS id,
Expand Down
22 changes: 11 additions & 11 deletions src/trace_processor/perfetto_sql/stdlib/chrome/tasks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SELECT EXISTS(
-- argument of descendant ScopedSetIpcHash slice.
-- This is relevant only for the older Chrome traces, where mojo IPC
-- hash was reported in a separate ScopedSetIpcHash slice.
CREATE PERFETTO FUNCTION _extract_mojo_ipc_hash(slice_id JOINID(slice.id))
CREATE PERFETTO FUNCTION _extract_mojo_ipc_hash(slice_id LONG)
RETURNS LONG AS
SELECT EXTRACT_ARG(arg_set_id, "chrome_mojo_event_info.ipc_hash")
FROM descendant_slice($slice_id)
Expand All @@ -31,7 +31,7 @@ LIMIT 1;

-- Returns the frame type (main frame vs subframe) for key navigation tasks
-- which capture the associated RenderFrameHost in an argument.
CREATE PERFETTO FUNCTION _extract_frame_type(slice_id JOINID(slice.id))
CREATE PERFETTO FUNCTION _extract_frame_type(slice_id LONG)
RETURNS LONG AS
SELECT EXTRACT_ARG(arg_set_id, "render_frame_host.frame_type")
FROM descendant_slice($slice_id)
Expand Down Expand Up @@ -270,7 +270,7 @@ CREATE PERFETTO VIEW chrome_java_views(
-- Whether this slice is a part of accelerated capture toolbar screenshot.
is_hardware_screenshot BOOL,
-- Slice id.
slice_id JOINID(slice.id)
slice_id LONG
) AS
SELECT
java_view.name AS filtered_name,
Expand Down Expand Up @@ -384,15 +384,15 @@ CREATE PERFETTO VIEW chrome_scheduler_tasks(
-- Duration.
dur DURATION,
-- Utid of the thread this task run on.
utid JOINID(thread.id),
utid LONG,
-- Name of the thread this task run on.
thread_name STRING,
-- Upid of the process of this task.
upid JOINID(process.id),
upid LONG,
-- Name of the process of this task.
process_name STRING,
-- Same as slice.track_id.
track_id JOINID(track.id),
track_id LONG,
-- Same as slice.category.
category STRING,
-- Same as slice.depth.
Expand Down Expand Up @@ -437,7 +437,7 @@ ORDER BY task.id;
-- Select the slice that might be the descendant mojo slice for the given task
-- slice if it exists.
CREATE PERFETTO FUNCTION _get_descendant_mojo_slice_candidate(
slice_id JOINID(slice.id)
slice_id LONG
)
RETURNS LONG AS
SELECT
Expand All @@ -458,7 +458,7 @@ WHERE
ORDER by depth, ts
LIMIT 1;

CREATE PERFETTO FUNCTION _descendant_mojo_slice(slice_id JOINID(slice.id))
CREATE PERFETTO FUNCTION _descendant_mojo_slice(slice_id LONG)
RETURNS TABLE(task_name STRING) AS
SELECT
printf("%s %s (hash=%d)",
Expand Down Expand Up @@ -601,17 +601,17 @@ CREATE PERFETTO VIEW chrome_tasks(
-- Thread name.
thread_name STRING,
-- Utid.
utid JOINID(thread.id),
utid LONG,
-- Process name.
process_name STRING,
-- Upid.
upid JOINID(process.id),
upid LONG,
-- Alias of |slice.ts|.
ts TIMESTAMP,
-- Alias of |slice.dur|.
dur DURATION,
-- Alias of |slice.track_id|.
track_id JOINID(track.id),
track_id LONG,
-- Alias of |slice.category|.
category STRING,
-- Alias of |slice.arg_set_id|.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
-- TraceEvents and this table will be empty.
CREATE PERFETTO TABLE chrome_vsync_intervals(
-- Slice id of the vsync slice.
slice_id JOINID(slice.id),
slice_id LONG,
-- Timestamp of the vsync slice.
ts TIMESTAMP,
-- Duration of the vsync slice.
dur DURATION,
-- Track id of the vsync slice.
track_id JOINID(track.id),
track_id LONG,
-- Duration until next vsync arrives.
time_to_next_vsync LONG
) AS
Expand Down
Loading

0 comments on commit dbfeb77

Please sign in to comment.