1-- 2-- Copyright 2023 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 16INCLUDE PERFETTO MODULE android.slices; 17 18DROP TABLE IF EXISTS android_sysui_notifications_blocking_calls; 19CREATE PERFETTO TABLE android_sysui_notifications_blocking_calls AS 20SELECT 21 s.name name, 22 COUNT(s.name) count, 23 MAX(dur) AS max_dur_ns, 24 MIN(dur) AS min_dur_ns, 25 SUM(dur) AS total_dur_ns 26FROM slice s 27 JOIN thread_track ON s.track_id = thread_track.id 28 JOIN thread USING (utid) 29WHERE 30 thread.is_main_thread AND 31 s.dur > 0 AND ( 32 s.name GLOB 'NotificationStackScrollLayout#onMeasure' 33 OR s.name GLOB 'NotificationToplineView#onMeasure' 34 OR s.name GLOB 'ExpNotRow#*' 35 OR s.name GLOB 'NotificationShadeWindowView#onMeasure' 36 OR s.name GLOB 'ImageFloatingTextView#onMeasure' 37) 38GROUP BY s.name; 39 40DROP VIEW IF EXISTS android_sysui_notifications_blocking_calls_metric_output; 41CREATE PERFETTO VIEW android_sysui_notifications_blocking_calls_metric_output AS 42SELECT AndroidSysUINotificationsBlockingCallsMetric('blocking_calls', ( 43 SELECT RepeatedField( 44 AndroidBlockingCall( 45 'name', a.name, 46 'cnt', a.count, 47 'total_dur_ns', a.total_dur_ns, 48 'max_dur_ns', a.max_dur_ns, 49 'min_dur_ns', a.min_dur_ns 50 ) 51 ) 52 FROM android_sysui_notifications_blocking_calls a 53 ORDER BY total_dur_ns DESC 54 ) 55); 56