• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 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 *      http://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
17export interface TraceConfiguration {
18  name: string | undefined;
19  run: boolean | undefined;
20  isTraceCollection: boolean | undefined;
21  config: ConfigurationOptions | undefined;
22}
23
24export interface TraceConfigurationMap {
25  [key: string]: TraceConfiguration;
26}
27
28interface ConfigurationOptions {
29  enableConfigs: EnableConfiguration[];
30  selectionConfigs: SelectionConfiguration[];
31}
32
33export interface EnableConfiguration {
34  name: string;
35  key: string;
36  enabled: boolean;
37}
38
39export interface SelectionConfiguration {
40  key: string;
41  name: string;
42  options: string[];
43  value: string;
44}
45
46export interface ConfigMap {
47  [key: string]: string[] | string;
48}
49
50const wmTraceSelectionConfigs: SelectionConfiguration[] = [
51  {
52    key: 'wmbuffersize',
53    name: 'buffer size (KB)',
54    options: ['4000', '8000', '16000', '32000'],
55    value: '32000',
56  },
57  {
58    key: 'tracingtype',
59    name: 'tracing type',
60    options: ['frame', 'transaction'],
61    value: 'frame',
62  },
63  {
64    key: 'tracinglevel',
65    name: 'tracing level',
66    options: ['verbose', 'debug', 'critical'],
67    value: 'verbose',
68  },
69];
70
71const sfTraceEnableConfigs: EnableConfiguration[] = [
72  {
73    name: 'input',
74    key: 'input',
75    enabled: true,
76  },
77  {
78    name: 'composition',
79    key: 'composition',
80    enabled: true,
81  },
82  {
83    name: 'metadata',
84    key: 'metadata',
85    enabled: false,
86  },
87  {
88    name: 'hwc',
89    key: 'hwc',
90    enabled: true,
91  },
92  {
93    name: 'trace buffers',
94    key: 'tracebuffers',
95    enabled: true,
96  },
97  {
98    name: 'virtual displays',
99    key: 'virtualdisplays',
100    enabled: false,
101  },
102];
103
104const sfTraceSelectionConfigs: SelectionConfiguration[] = [
105  {
106    key: 'sfbuffersize',
107    name: 'buffer size (KB)',
108    options: ['4000', '8000', '16000', '32000'],
109    value: '32000',
110  },
111];
112
113export const traceConfigurations: TraceConfigurationMap = {
114  layers_trace: {
115    name: 'Surface Flinger',
116    run: true,
117    isTraceCollection: undefined,
118    config: {
119      enableConfigs: sfTraceEnableConfigs,
120      selectionConfigs: sfTraceSelectionConfigs,
121    },
122  },
123  window_trace: {
124    name: 'Window Manager',
125    run: true,
126    isTraceCollection: undefined,
127    config: {
128      enableConfigs: [],
129      selectionConfigs: wmTraceSelectionConfigs,
130    },
131  },
132  screen_recording: {
133    name: 'Screen Recording',
134    isTraceCollection: undefined,
135    run: true,
136    config: undefined,
137  },
138  ime_tracing: {
139    name: 'IME Tracing',
140    run: true,
141    isTraceCollection: true,
142    config: {
143      enableConfigs: [
144        {
145          name: 'Input Method Clients',
146          key: 'ime_trace_clients',
147          enabled: true,
148        },
149        {
150          name: 'Input Method Service',
151          key: 'ime_trace_service',
152          enabled: true,
153        },
154        {
155          name: 'Input Method Manager Service',
156          key: 'ime_trace_managerservice',
157          enabled: true,
158        },
159      ],
160      selectionConfigs: [],
161    },
162  },
163  ime_trace_clients: {
164    name: 'Input Method Clients',
165    isTraceCollection: undefined,
166    run: true,
167    config: undefined,
168  },
169  ime_trace_service: {
170    name: 'Input Method Service',
171    isTraceCollection: undefined,
172    run: true,
173    config: undefined,
174  },
175  ime_trace_managerservice: {
176    name: 'Input Method Manager Service',
177    isTraceCollection: undefined,
178    run: true,
179    config: undefined,
180  },
181  accessibility_trace: {
182    name: 'Accessibility',
183    isTraceCollection: undefined,
184    run: false,
185    config: undefined,
186  },
187  transactions: {
188    name: 'Transaction',
189    isTraceCollection: undefined,
190    run: false,
191    config: undefined,
192  },
193  proto_log: {
194    name: 'ProtoLog',
195    isTraceCollection: undefined,
196    run: false,
197    config: undefined,
198  },
199  wayland_trace: {
200    name: 'Wayland',
201    isTraceCollection: undefined,
202    run: false,
203    config: undefined,
204  },
205  eventlog: {
206    name: 'Event Log',
207    isTraceCollection: undefined,
208    run: false,
209    config: undefined,
210  },
211  transition_traces: {
212    name: 'Shell Transitions',
213    isTraceCollection: undefined,
214    run: false,
215    config: undefined,
216  },
217};
218
219export const TRACES: {[key: string]: TraceConfigurationMap} = {
220  default: {
221    window_trace: traceConfigurations['window_trace'],
222    accessibility_trace: traceConfigurations['accessibility_trace'],
223    layers_trace: traceConfigurations['layers_trace'],
224    transactions: traceConfigurations['transactions'],
225    proto_log: traceConfigurations['proto_log'],
226    screen_recording: traceConfigurations['screen_recording'],
227    ime_tracing: traceConfigurations['ime_tracing'],
228    eventlog: traceConfigurations['eventlog'],
229    transition_traces: traceConfigurations['transition_traces'],
230  },
231  arc: {
232    wayland_trace: traceConfigurations['wayland_trace'],
233  },
234};
235