1-- 2-- Copyright 2024 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 17-- All scheduled jobs and their latencies. 18CREATE PERFETTO TABLE android_job_scheduler_events ( 19 -- Id of the scheduled job assigned by the app developer. 20 job_id INT, 21 -- Uid of the process running the scheduled job. 22 uid INT, 23 -- Package name of the process running the scheduled job. 24 package_name STRING, 25 -- Service component name of the scheduled job. 26 job_service_name STRING, 27 -- Thread track id of the job scheduler event slice. 28 track_id INT, 29 -- Slice id of the job scheduler event slice. 30 id INT, 31 -- Timestamp the job was scheduled. 32 ts INT, 33 -- Duration of the scheduled job. 34 dur INT 35 ) AS 36SELECT 37 CAST(STR_SPLIT(slice.name, '#', 1) AS INT) AS job_id, 38 CAST(STR_SPLIT(STR_SPLIT(slice.name, '<', 1), '>', 0) AS INT) AS uid, 39 STR_SPLIT(STR_SPLIT(slice.name, '>', 1), '/', 0) AS package_name, 40 STR_SPLIT(STR_SPLIT(slice.name, '/', 1), '#', 0) AS job_service_name, 41 track_id, 42 slice.id, 43 slice.ts, 44 IIF(slice.dur = -1, trace_end() - slice.ts, slice.dur) AS dur 45FROM 46 slice 47JOIN process_track 48 ON slice.track_id = process_track.id 49JOIN process 50 ON process.upid = process_track.upid 51WHERE 52 process.name = 'system_server' 53 AND slice.name GLOB '*job*' 54 AND process_track.name = 'JobScheduler'; 55