• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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--
16
17INCLUDE PERFETTO MODULE android.monitor_contention;
18
19DROP VIEW IF EXISTS android_monitor_contention_output;
20CREATE PERFETTO VIEW android_monitor_contention_output AS
21SELECT AndroidMonitorContentionMetric(
22  'node', (
23    SELECT RepeatedField(
24      AndroidMonitorContentionMetric_Node(
25        'node_parent_id', parent_id,
26        'node_child_id', child_id,
27        'node_id', id,
28        'ts', ts,
29        'dur', dur,
30        'monotonic_dur', monotonic_dur,
31        'blocking_method', blocking_method,
32        'blocked_method', blocked_method,
33        'short_blocking_method', short_blocking_method,
34        'short_blocked_method', short_blocked_method,
35        'blocking_src', blocking_src,
36        'blocked_src', blocked_src,
37        'waiter_count', waiter_count,
38        'blocking_thread_name', blocking_thread_name,
39        'blocked_thread_name', blocked_thread_name,
40        'blocked_thread_tid', blocked_thread_tid,
41        'blocking_thread_tid', blocking_thread_tid,
42        'process_name', process_name,
43        'pid', pid,
44        'is_blocked_thread_main', is_blocked_thread_main,
45        'is_blocking_thread_main', is_blocking_thread_main,
46        'binder_reply_ts', binder_reply_ts,
47        'binder_reply_tid', binder_reply_tid,
48        'thread_states', (
49          SELECT RepeatedField(
50            AndroidMonitorContentionMetric_ThreadStateBreakdown(
51              'thread_state', thread_state,
52              'thread_state_dur', thread_state_dur,
53              'thread_state_count', thread_state_count
54            )
55          ) FROM android_monitor_contention_chain_thread_state_by_txn t WHERE t.id = android_monitor_contention_chain.id
56        ),
57        'blocked_functions', (
58          SELECT RepeatedField(
59            AndroidMonitorContentionMetric_BlockedFunctionBreakdown(
60              'blocked_function', blocked_function,
61              'blocked_function_dur', blocked_function_dur,
62              'blocked_function_count', blocked_function_count
63            )
64          ) FROM android_monitor_contention_chain_blocked_functions_by_txn b WHERE b.id = android_monitor_contention_chain.id
65        )
66      )
67    )
68    FROM android_monitor_contention_chain
69  )
70);
71