• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1-- Copyright 2023 The Chromium Authors
2-- Use of this source code is governed by a BSD-style license that can be
3-- found in the LICENSE file.
4
5-- This file specifies common metrics/tables for critical user interactions. It
6-- is expected to be in flux as metrics are added across different CUI types.
7-- Currently we only track Chrome page loads and their associated metrics.
8
9INCLUDE PERFETTO MODULE chrome.page_loads;
10INCLUDE PERFETTO MODULE chrome.scroll_interactions;
11INCLUDE PERFETTO MODULE chrome.startups;
12INCLUDE PERFETTO MODULE chrome.web_content_interactions;
13
14-- All critical user interaction events, including type and table with
15-- associated metrics.
16CREATE PERFETTO TABLE chrome_interactions(
17  -- Identifier of the interaction; this is not guaranteed to be unique to the table -
18  -- rather, it is unique within an individual interaction type. Combine with type to get
19  -- a unique identifier in this table.
20  scoped_id LONG,
21  -- Type of this interaction, which together with scoped_id uniquely identifies this
22  -- interaction. Also corresponds to a SQL table name containing more details specific
23  -- to this type of interaction.
24  type STRING,
25  -- Interaction name - e.g. 'PageLoad', 'Tap', etc. Interactions will have unique metrics
26  -- stored in other tables.
27  name STRING,
28  -- Timestamp of the CUI event.
29  ts TIMESTAMP,
30  -- Duration of the CUI event.
31  dur DURATION
32) AS
33SELECT
34  id AS scoped_id,
35  'chrome_page_loads' AS type,
36  'PageLoad' AS name,
37  navigation_start_ts AS ts,
38  IFNULL(lcp, fcp) AS dur
39FROM chrome_page_loads
40UNION ALL
41SELECT
42  id AS scoped_id,
43  'chrome_startups' AS type,
44  name,
45  startup_begin_ts AS ts,
46  CASE
47    WHEN first_visible_content_ts IS NOT NULL
48      THEN first_visible_content_ts - startup_begin_ts
49    ELSE 0
50  END AS dur
51FROM chrome_startups
52UNION ALL
53SELECT
54  id AS scoped_id,
55  'chrome_web_content_interactions' AS type,
56  'InteractionToFirstPaint' AS name,
57  ts,
58  dur
59FROM chrome_web_content_interactions
60UNION ALL
61SELECT
62  id AS scoped_id,
63  'chrome_scroll_interactions' AS type,
64  'Scroll' AS name,
65  ts,
66  dur
67FROM chrome_scroll_interactions;
68