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.startups; 11INCLUDE PERFETTO MODULE chrome.web_content_interactions; 12 13-- All critical user interaction events, including type and table with 14-- associated metrics. 15CREATE PERFETTO TABLE chrome_interactions( 16 -- Identifier of the interaction; this is not guaranteed to be unique to the table - 17 -- rather, it is unique within an individual interaction type. Combine with type to get 18 -- a unique identifier in this table. 19 scoped_id INT, 20 -- Type of this interaction, which together with scoped_id uniquely identifies this 21 -- interaction. Also corresponds to a SQL table name containing more details specific 22 -- to this type of interaction. 23 type STRING, 24 -- Interaction name - e.g. 'PageLoad', 'Tap', etc. Interactions will have unique metrics 25 -- stored in other tables. 26 name STRING, 27 -- Timestamp of the CUI event. 28 ts INT, 29 -- Duration of the CUI event. 30 dur INT 31) AS 32SELECT 33 id AS scoped_id, 34 'chrome_page_loads' AS type, 35 'PageLoad' AS name, 36 navigation_start_ts AS ts, 37 IFNULL(lcp, fcp) AS dur 38FROM chrome_page_loads 39UNION ALL 40SELECT 41 id AS scoped_id, 42 'chrome_startups' AS type, 43 name, 44 startup_begin_ts AS ts, 45 CASE 46 WHEN first_visible_content_ts IS NOT NULL 47 THEN first_visible_content_ts - startup_begin_ts 48 ELSE 0 49 END AS dur 50FROM chrome_startups 51UNION ALL 52SELECT 53 id AS scoped_id, 54 'chrome_web_content_interactions' AS type, 55 'InteractionToFirstPaint' AS name, 56 ts, 57 dur 58FROM chrome_web_content_interactions; 59