xref: /aosp_15_r20/external/perfetto/src/trace_processor/tables/counter_tables.py (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
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 CppDouble
18from python.generators.trace_processor_table.public import ColumnFlag
19from python.generators.trace_processor_table.public import CppInt64
20from python.generators.trace_processor_table.public import CppOptional
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.metadata_tables import MACHINE_TABLE
27from src.trace_processor.tables.track_tables import TRACK_TABLE
28
29COUNTER_TABLE = Table(
30    python_module=__file__,
31    class_name='CounterTable',
32    sql_name='__intrinsic_counter',
33    columns=[
34        C('ts', CppInt64(), flags=ColumnFlag.SORTED),
35        C('track_id', CppTableId(TRACK_TABLE)),
36        C('value', CppDouble()),
37        C('arg_set_id', CppOptional(CppUint32())),
38    ],
39    tabledoc=TableDoc(
40        doc='''''',
41        group='Events',
42        columns={
43            'ts': '''''',
44            'track_id': '''''',
45            'value': '''''',
46            'arg_set_id': '''''',
47        }))
48
49# Keep this list sorted.
50ALL_TABLES = [
51    COUNTER_TABLE,
52]
53