1-- 2-- Copyright 2021 The Android Open Source Project 3-- 4-- Licensed under the Apache License, Version 2.0 (the "License"); 5-- you may not use this file except in compliance with the License. 6-- You may obtain a copy of the License at 7-- 8-- https://www.apache.org/licenses/LICENSE-2.0 9-- 10-- Unless required by applicable law or agreed to in writing, software 11-- distributed under the License is distributed on an "AS IS" BASIS, 12-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13-- See the License for the specific language governing permissions and 14-- limitations under the License. 15-- 16-- Get all chrome processes and threads tables set up. 17SELECT RUN_METRIC('chrome/chrome_processes.sql'); 18 19-- When working on InputLatency events we need to ensure we have all the events 20-- from the browser, renderer, and GPU processes. This query isn't quite 21-- perfect. In system tracing we could have 3 browser processes all in the 22-- background and this would match, but for now its the best we can do (renderer 23-- and GPU names on android are quite complicated, but this should filter 99% 24-- (citation needed) of what we want. 25-- 26-- See b/151077536 for historical context. 27DROP VIEW IF EXISTS sufficient_chrome_processes; 28CREATE VIEW sufficient_chrome_processes AS 29SELECT 30 CASE WHEN ( 31 SELECT COUNT(*) FROM chrome_process) = 0 32 THEN 33 FALSE 34 ELSE ( 35 SELECT COUNT(*) >= 3 FROM ( 36 SELECT name FROM chrome_process 37 WHERE 38 name GLOB "Browser" 39 OR name GLOB "Renderer" 40 OR name GLOB "Gpu" 41 OR name GLOB 'com.android.chrome*' 42 OR name GLOB 'com.chrome.beta*' 43 OR name GLOB 'com.chrome.dev*' 44 OR name GLOB 'com.chrome.canary*' 45 OR name GLOB 'com.google.android.apps.chrome*' 46 OR name GLOB 'org.chromium.chrome*' 47 GROUP BY name 48 )) END AS have_enough_chrome_processes; 49