• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2022 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.binder;
18
19-- Count Binder transactions per process
20DROP VIEW IF EXISTS binder_metrics_by_process;
21CREATE PERFETTO VIEW binder_metrics_by_process AS
22SELECT * FROM android_binder_metrics_by_process;
23
24DROP VIEW IF EXISTS android_binder_output;
25CREATE PERFETTO VIEW android_binder_output AS
26SELECT AndroidBinderMetric(
27  'process_breakdown', (
28    SELECT RepeatedField(
29      AndroidBinderMetric_PerProcessBreakdown(
30        'process_name', process_name,
31        'pid', pid,
32        'slice_name', slice_name,
33        'count', event_count
34      )
35    )
36    FROM android_binder_metrics_by_process
37  ),
38  'unaggregated_txn_breakdown', (
39    SELECT RepeatedField(
40      AndroidBinderMetric_UnaggregatedTxnBreakdown(
41        'aidl_name', aidl_name,
42        'aidl_ts', aidl_ts,
43        'aidl_dur', aidl_dur,
44        'client_process', client_process,
45        'client_thread', client_thread,
46        'is_main_thread', is_main_thread,
47        'client_ts', client_ts,
48        'client_dur', client_dur,
49        'client_tid', client_tid,
50        'client_pid', client_pid,
51        'client_oom_score', client_oom_score,
52        'server_process', server_process,
53        'server_thread', server_thread,
54        'server_ts', server_ts,
55        'server_dur', server_dur,
56        'server_tid', server_tid,
57        'server_pid', server_pid,
58        'server_oom_score', server_oom_score,
59        'is_sync', is_sync,
60        'client_monotonic_dur', client_monotonic_dur,
61        'server_monotonic_dur', server_monotonic_dur,
62        'client_package_version_code', client_package_version_code,
63        'server_package_version_code', server_package_version_code,
64        'is_client_package_debuggable', is_client_package_debuggable,
65        'is_server_package_debuggable', is_server_package_debuggable,
66        'thread_states', (
67          SELECT RepeatedField(
68            AndroidBinderMetric_ThreadStateBreakdown(
69              'thread_state_type', thread_state_type,
70              'thread_state', thread_state,
71              'thread_state_dur', thread_state_dur,
72              'thread_state_count', thread_state_count
73            )
74          ) FROM android_sync_binder_thread_state_by_txn t WHERE t.binder_txn_id = android_binder_txns.binder_txn_id
75        ),
76        'blocked_functions', (
77          SELECT RepeatedField(
78            AndroidBinderMetric_BlockedFunctionBreakdown(
79              'thread_state_type', thread_state_type,
80              'blocked_function', blocked_function,
81              'blocked_function_dur', blocked_function_dur,
82              'blocked_function_count', blocked_function_count
83            )
84          ) FROM android_sync_binder_blocked_functions_by_txn b WHERE b.binder_txn_id = android_binder_txns.binder_txn_id
85        )
86      )
87    )
88    FROM android_binder_txns
89  )
90);
91