1# Copyright (C) 2024 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""" 15Contains tables related to perf data ingestion. 16""" 17 18from python.generators.trace_processor_table.public import Column as C 19from python.generators.trace_processor_table.public import ColumnDoc 20from python.generators.trace_processor_table.public import ColumnFlag 21from python.generators.trace_processor_table.public import CppInt64 22from python.generators.trace_processor_table.public import CppOptional 23from python.generators.trace_processor_table.public import CppString 24from python.generators.trace_processor_table.public import CppTableId 25from python.generators.trace_processor_table.public import CppUint32 26from python.generators.trace_processor_table.public import Table 27from python.generators.trace_processor_table.public import TableDoc 28 29ETM_V4_CONFIGURATION = Table( 30 python_module=__file__, 31 class_name='EtmV4ConfigurationTable', 32 sql_name='__intrinsic_etm_v4_configuration', 33 columns=[ 34 C('set_id', CppUint32(), flags=ColumnFlag.SORTED | ColumnFlag.SET_ID), 35 C('cpu', CppUint32()), 36 C('cs_trace_id', CppUint32()), 37 C('core_profile', CppString()), 38 C('arch_version', CppString()), 39 C('major_version', CppUint32()), 40 C('minor_version', CppUint32()), 41 C('max_speculation_depth', CppUint32()), 42 C('bool_flags', CppInt64()), 43 ], 44 tabledoc=TableDoc( 45 doc=''' 46 This table tracks ETM configurations. Rows are grouped by a set_id 47 to represent the configurations of each of the CPUs. 48 ''', 49 group='ETM', 50 columns={ 51 'set_id': 52 ''' 53 Groups all configuration ros that belong to the same trace. 54 There is one row per each CPU where ETM was configured. 55 ''', 56 'cpu': 57 'CPU this configuration applies to.', 58 'cs_trace_id': 59 'Trace Stream ID register', 60 'core_profile': 61 'Core Profile (e.g. Cortex-A or Cortex-M)', 62 'arch_version': 63 'Architecture version (e.g. AA64)', 64 'major_version': 65 'Major version', 66 'minor_version': 67 'Minor version', 68 'max_speculation_depth': 69 'Maximum speculation depth of the core', 70 'bool_flags': 71 'Collection of boolean flags.', 72 }, 73 )) 74 75ETM_V4_SESSION = Table( 76 python_module=__file__, 77 class_name='EtmV4SessionTable', 78 sql_name='__intrinsic_etm_v4_session', 79 columns=[ 80 C('configuration_id', CppTableId(ETM_V4_CONFIGURATION)), 81 C('start_ts', CppOptional(CppInt64())), 82 ], 83 tabledoc=TableDoc( 84 doc=''' 85 Represents a trace session on one core. From time the tracing is 86 started to when it is stopped. 87 ''', 88 group='ETM', 89 columns={ 90 'configuration_id': 91 ColumnDoc( 92 'ETM configuration', 93 joinable='__intrinsic_etm_v4_configuration.id'), 94 'start_ts': 95 'time the trace ETM trace collection started.', 96 }, 97 )) 98 99ETM_V4_TRACE = Table( 100 python_module=__file__, 101 class_name='EtmV4TraceTable', 102 sql_name='__intrinsic_etm_v4_trace', 103 columns=[ 104 C('session_id', CppTableId(ETM_V4_SESSION)), 105 C('trace_set_id', 106 CppUint32(), 107 flags=ColumnFlag.SORTED | ColumnFlag.SET_ID), 108 C('size', CppInt64()), 109 ], 110 tabledoc=TableDoc( 111 doc=''' 112 Represents a contiguous chunk of ETM trace data for a core. The data 113 collected during a session might be split into different chunks in the 114 case of data loss. 115 ''', 116 group='ETM', 117 columns={ 118 'session_id': 119 ColumnDoc( 120 'Session this data belongs to', 121 joinable='__intrinsic_etm_v4_trace.id'), 122 'trace_set_id': 123 'Groups all the traces belonging to the same session.', 124 'size': 125 'Size in bytes', 126 }, 127 )) 128 129ALL_TABLES = [ETM_V4_CONFIGURATION, ETM_V4_TRACE, ETM_V4_SESSION] 130