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 28from .profiler_tables import STACK_PROFILE_FRAME_TABLE 29from .profiler_tables import STACK_PROFILE_MAPPING_TABLE 30from .metadata_tables import THREAD_TABLE 31 32SPE_RECORD_TABLE = Table( 33 python_module=__file__, 34 class_name='SpeRecordTable', 35 sql_name='__intrinsic_spe_record', 36 columns=[ 37 C('ts', CppInt64(), ColumnFlag.SORTED), 38 C('utid', CppOptional(CppTableId(THREAD_TABLE))), 39 C('exception_level', CppString()), 40 C('instruction_frame_id', 41 CppOptional(CppTableId(STACK_PROFILE_FRAME_TABLE))), 42 C('operation', CppString()), 43 C('data_virtual_address', CppInt64()), 44 C('data_physical_address', CppInt64()), 45 C('total_latency', CppUint32()), 46 C('issue_latency', CppUint32()), 47 C('translation_latency', CppUint32()), 48 C('events_bitmask', CppInt64()), 49 C('data_source', CppString()), 50 ], 51 tabledoc=TableDoc( 52 doc=''' 53 This table has a row for each sampled operation in an ARM Statistical 54 Profiling Extension trace. 55 ''', 56 group='Perf', 57 columns={ 58 'ts': 59 'Time the operation was sampled', 60 'utid': 61 'EXecuting thread', 62 'exception_level': 63 'Exception level the operation executed in', 64 'instruction_frame_id': 65 ColumnDoc( 66 'Instruction virtual address', 67 joinable='stack_profile_frame.id'), 68 'operation': 69 'Operation executed', 70 'data_virtual_address': 71 'Virtual address of accesses data (if any)', 72 'data_physical_address': 73 ''' 74 Physical address of accesses data (if any) 75 ''', 76 'total_latency': 77 ''' 78 Cycle count from the operation being dispatched for issue to 79 the operation being complete. 80 ''', 81 'issue_latency': 82 ''' 83 Cycle count from the operation being dispatched for issue to 84 the operation being issued for execution. 85 ''', 86 'translation_latency': 87 ''' 88 Cycle count from a virtual address being passed to the MMU for 89 translation to the result of the translation being available. 90 ''', 91 'events_bitmask': 92 'Events generated by the operation', 93 'data_source': 94 ''' 95 Where the data returned for a load operation was sourced 96 ''', 97 }, 98 ), 99) 100 101MMAP_RECORD = Table( 102 python_module=__file__, 103 class_name='MmapRecordTable', 104 sql_name='__intrinsic_mmap_record', 105 columns=[ 106 C('ts', CppInt64()), 107 C('upid', CppOptional(CppUint32())), 108 C('mapping_id', CppTableId(STACK_PROFILE_MAPPING_TABLE)), 109 ], 110 tabledoc=TableDoc( 111 doc=''' 112 This table has a row for each mmap or mmap2 record in a perf trace. 113 It allows us to determine when mappings are created and what process 114 created them. 115 ''', 116 group='Perf', 117 columns={ 118 'ts': 119 'Time the mapping was created.', 120 'upid': 121 'Process that created the mapping', 122 'mapping_id': 123 ColumnDoc('Mapping', joinable='stack_profile_mapping.id'), 124 }, 125 )) 126 127ALL_TABLES = [ 128 SPE_RECORD_TABLE, 129 MMAP_RECORD, 130] 131