• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2024 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.auto.multiuser;
18INCLUDE PERFETTO MODULE time.conversion;
19
20DROP VIEW IF EXISTS android_auto_multiuser_output;
21CREATE PERFETTO VIEW android_auto_multiuser_output AS
22SELECT AndroidAutoMultiuserMetric(
23    'user_switch', (
24        SELECT RepeatedField(
25            AndroidAutoMultiuserMetric_EventData(
26                'user_id', cast_int!(event_start_user_id),
27                'start_event', event_start_name,
28                'end_event', event_end_name,
29                'duration_ms', time_to_ms(duration),
30                'previous_user_info', AndroidAutoMultiuserMetric_EventData_UserData(
31                    'user_id', user_id,
32                    'total_cpu_time_ms', time_to_ms(total_cpu_time),
33                    'total_memory_usage_kb', total_memory_usage_kb
34                )
35            )
36        )
37        FROM android_auto_multiuser_timing_with_previous_user_resource_usage
38    )
39);