• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2-- Copyright 2025 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.startups;
17INCLUDE PERFETTO MODULE wattson.curves.estimates;
18INCLUDE PERFETTO MODULE viz.summary.threads_w_processes;
19
20-- Create the base table (`android_jank_cuj`) containing all completed CUJs
21-- found in the trace.
22SELECT RUN_METRIC('android/jank/cujs.sql');
23
24DROP VIEW IF EXISTS _atrace_apps_window;
25CREATE PERFETTO VIEW _atrace_apps_window AS
26SELECT
27  ts,
28  dur,
29  cuj_id as period_id
30FROM android_jank_cuj;
31
32SELECT RUN_METRIC(
33  'android/wattson_tasks_attribution.sql',
34  'window_table',
35  '_atrace_apps_window'
36);
37
38DROP VIEW IF EXISTS wattson_atrace_apps_threads_output;
39CREATE PERFETTO VIEW wattson_atrace_apps_threads_output AS
40SELECT AndroidWattsonTasksAttributionMetric(
41  'metric_version', 5,
42  'power_model_version', 1,
43  'period_info', (
44    SELECT RepeatedField(
45      AndroidWattsonTaskPeriodInfo(
46        'period_id', task.period_id,
47        'period_name', cuj.cuj_name,
48        'task_info', task.proto
49      )
50    )
51    FROM _wattson_per_task AS task
52    JOIN android_jank_cuj AS cuj ON cuj.cuj_id = task.period_id
53  )
54);
55