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