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