• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2019 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.startup.startup_events;
17
18CREATE PERFETTO VIEW _startup_async_events AS
19SELECT
20  ts,
21  dur,
22  CAST(SUBSTR(name, 19) AS INT) AS startup_id
23FROM slice
24WHERE
25  name GLOB 'launchingActivity#*'
26  AND dur != 0
27  AND INSTR(name, ':') = 0;
28
29CREATE PERFETTO VIEW _startup_complete_events AS
30SELECT
31  CAST(STR_SPLIT(completed, ':', 0) AS INT) AS startup_id,
32  STR_SPLIT(completed, ':', 2) AS package_name,
33  CASE
34    WHEN STR_SPLIT(completed, ':', 1) = 'completed-hot' THEN 'hot'
35    WHEN STR_SPLIT(completed, ':', 1) = 'completed-warm' THEN 'warm'
36    WHEN STR_SPLIT(completed, ':', 1) = 'completed-cold' THEN 'cold'
37    ELSE NULL
38  END AS startup_type,
39  MIN(ts)
40FROM (
41  SELECT ts, SUBSTR(name, 19) AS completed
42  FROM slice
43  WHERE
44    dur = 0
45    -- Originally completed was unqualified, but at some point we introduced
46    -- the startup type as well
47    AND name GLOB 'launchingActivity#*:completed*:*'
48)
49GROUP BY 1, 2, 3;
50
51CREATE PERFETTO TABLE _startups_minsdk33 AS
52SELECT
53  "minsdk33" as sdk,
54  startup_id,
55  ts,
56  ts + dur AS ts_end,
57  dur,
58  package_name AS package,
59  startup_type
60FROM _startup_async_events
61JOIN _startup_complete_events USING (startup_id);
62
63
64
65