1# Copyright (C) 2023 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 relevant for TODO.""" 15 16from python.generators.trace_processor_table.public import Column as C 17from python.generators.trace_processor_table.public import CppInt64 18from python.generators.trace_processor_table.public import CppOptional 19from python.generators.trace_processor_table.public import CppSelfTableId 20from python.generators.trace_processor_table.public import CppString 21from python.generators.trace_processor_table.public import Table 22from python.generators.trace_processor_table.public import TableDoc 23from python.generators.trace_processor_table.public import CppTableId 24from python.generators.trace_processor_table.public import CppUint32 25 26from src.trace_processor.tables.track_tables import TRACK_TABLE 27 28MEMORY_SNAPSHOT_TABLE = Table( 29 python_module=__file__, 30 class_name='MemorySnapshotTable', 31 sql_name='memory_snapshot', 32 columns=[ 33 C('timestamp', CppInt64()), 34 C('track_id', CppTableId(TRACK_TABLE)), 35 C('detail_level', CppString()), 36 ], 37 tabledoc=TableDoc( 38 doc='''''', 39 group='Memory Snapshots', 40 columns={ 41 'timestamp': '''''', 42 'track_id': '''''', 43 'detail_level': '''''' 44 })) 45 46PROCESS_MEMORY_SNAPSHOT_TABLE = Table( 47 python_module=__file__, 48 class_name='ProcessMemorySnapshotTable', 49 sql_name='process_memory_snapshot', 50 columns=[ 51 C('snapshot_id', CppTableId(MEMORY_SNAPSHOT_TABLE)), 52 C('upid', CppUint32()), 53 ], 54 tabledoc=TableDoc( 55 doc='''''', 56 group='Memory Snapshots', 57 columns={ 58 'snapshot_id': '''''', 59 'upid': '''''' 60 })) 61 62MEMORY_SNAPSHOT_NODE_TABLE = Table( 63 python_module=__file__, 64 class_name='MemorySnapshotNodeTable', 65 sql_name='memory_snapshot_node', 66 columns=[ 67 C('process_snapshot_id', CppTableId(PROCESS_MEMORY_SNAPSHOT_TABLE)), 68 C('parent_node_id', CppOptional(CppSelfTableId())), 69 C('path', CppString()), 70 C('size', CppInt64()), 71 C('effective_size', CppInt64()), 72 C('arg_set_id', CppOptional(CppUint32())), 73 ], 74 tabledoc=TableDoc( 75 doc='''''', 76 group='Memory Snapshots', 77 columns={ 78 'process_snapshot_id': '''''', 79 'parent_node_id': '''''', 80 'path': '''''', 81 'size': '''''', 82 'effective_size': '''''', 83 'arg_set_id': '''''' 84 })) 85 86MEMORY_SNAPSHOT_EDGE_TABLE = Table( 87 python_module=__file__, 88 class_name='MemorySnapshotEdgeTable', 89 sql_name='memory_snapshot_edge', 90 columns=[ 91 C('source_node_id', CppTableId(MEMORY_SNAPSHOT_NODE_TABLE)), 92 C('target_node_id', CppTableId(MEMORY_SNAPSHOT_NODE_TABLE)), 93 C('importance', CppUint32()), 94 ], 95 tabledoc=TableDoc( 96 doc='''''', 97 group='Memory Snapshots', 98 columns={ 99 'source_node_id': '''''', 100 'target_node_id': '''''', 101 'importance': '''''' 102 })) 103 104# Keep this list sorted. 105ALL_TABLES = [ 106 MEMORY_SNAPSHOT_EDGE_TABLE, 107 MEMORY_SNAPSHOT_NODE_TABLE, 108 MEMORY_SNAPSHOT_TABLE, 109 PROCESS_MEMORY_SNAPSHOT_TABLE, 110] 111