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