1# Copyright (C) 2022 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14"""Contains tables for unitviewing.""" 15 16from python.generators.trace_processor_table.public import Column as C 17from python.generators.trace_processor_table.public import ColumnFlag 18from python.generators.trace_processor_table.public import Table 19from python.generators.trace_processor_table.public import CppTableId 20from python.generators.trace_processor_table.public import CppUint32 21from python.generators.trace_processor_table.public import CppInt64 22from python.generators.trace_processor_table.public import CppString 23 24VIEW_THREAD_TABLE = Table( 25 python_module=__file__, 26 class_name="ViewThreadTable", 27 sql_name="thread_table", 28 columns=[ 29 C("name", CppString()), 30 C("tid", CppUint32()), 31 ]) 32 33VIEW_TRACK_TABLE = Table( 34 python_module=__file__, 35 class_name="ViewTrackTable", 36 sql_name="track_table", 37 columns=[ 38 C("name", CppString()), 39 ]) 40 41VIEW_THREAD_TRACK_TABLE = Table( 42 python_module=__file__, 43 class_name="ViewThreadTrackTable", 44 sql_name="thread_track_table", 45 parent=VIEW_TRACK_TABLE, 46 columns=[ 47 C("utid", CppTableId(VIEW_THREAD_TABLE)), 48 ]) 49 50VIEW_EVENT_TABLE = Table( 51 python_module=__file__, 52 class_name="ViewEventTable", 53 sql_name="event_table", 54 columns=[ 55 C("ts", CppInt64(), flags=ColumnFlag.SORTED), 56 C("track_id", CppTableId(VIEW_TRACK_TABLE)), 57 ]) 58 59VIEW_SLICE_TABLE = Table( 60 python_module=__file__, 61 class_name="ViewSliceTable", 62 sql_name="slice_table", 63 parent=VIEW_EVENT_TABLE, 64 columns=[ 65 C("name", CppString()), 66 ]) 67 68# Keep this list sorted. 69ALL_TABLES = [ 70 VIEW_EVENT_TABLE, 71 VIEW_SLICE_TABLE, 72 VIEW_THREAD_TABLE, 73 VIEW_THREAD_TRACK_TABLE, 74 VIEW_TRACK_TABLE, 75] 76