• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SRC_TRACE_PROCESSOR_TABLES_METADATA_TABLES_H_
18 #define SRC_TRACE_PROCESSOR_TABLES_METADATA_TABLES_H_
19 
20 #include "src/trace_processor/tables/macros.h"
21 
22 namespace perfetto {
23 namespace trace_processor {
24 namespace tables {
25 
26 // @param arg_set_id {@joinable args.arg_set_id}
27 #define PERFETTO_TP_RAW_TABLE_DEF(NAME, PARENT, C) \
28   NAME(RawTable, "raw")                            \
29   PERFETTO_TP_ROOT_TABLE(PARENT, C)                \
30   C(int64_t, ts, Column::Flag::kSorted)            \
31   C(StringPool::Id, name)                          \
32   C(uint32_t, cpu)                                 \
33   C(uint32_t, utid)                                \
34   C(uint32_t, arg_set_id)
35 
36 PERFETTO_TP_TABLE(PERFETTO_TP_RAW_TABLE_DEF);
37 
38 #define PERFETTO_TP_ARG_TABLE_DEF(NAME, PARENT, C) \
39   NAME(ArgTable, "args")                           \
40   PERFETTO_TP_ROOT_TABLE(PARENT, C)                \
41   C(uint32_t, arg_set_id, Column::Flag::kSorted)   \
42   C(StringPool::Id, flat_key)                      \
43   C(StringPool::Id, key)                           \
44   C(base::Optional<int64_t>, int_value)            \
45   C(base::Optional<StringPool::Id>, string_value)  \
46   C(base::Optional<double>, real_value)            \
47   C(StringPool::Id, value_type)
48 
49 PERFETTO_TP_TABLE(PERFETTO_TP_ARG_TABLE_DEF);
50 
51 #define PERFETTO_TP_METADATA_TABLE_DEF(NAME, PARENT, C) \
52   NAME(MetadataTable, "metadata")                       \
53   PERFETTO_TP_ROOT_TABLE(PARENT, C)                     \
54   C(StringPool::Id, name)                               \
55   C(StringPool::Id, key_type)                           \
56   C(base::Optional<int64_t>, int_value)                 \
57   C(base::Optional<StringPool::Id>, str_value)
58 
59 PERFETTO_TP_TABLE(PERFETTO_TP_METADATA_TABLE_DEF);
60 
61 // @name thread
62 // @param utid {uint32_t} Unique thread id. This is != the OS tid. This is a
63 //        monotonic number associated to each thread. The OS thread id (tid)
64 //        cannot be used as primary key because tids and pids are recycled
65 //        by most kernels.
66 // @param upid {@joinable process.upid}
67 #define PERFETTO_TP_THREAD_TABLE_DEF(NAME, PARENT, C) \
68   NAME(ThreadTable, "internal_thread")                \
69   PERFETTO_TP_ROOT_TABLE(PARENT, C)                   \
70   C(uint32_t, tid)                                    \
71   C(StringPool::Id, name)                             \
72   C(base::Optional<int64_t>, start_ts)                \
73   C(base::Optional<int64_t>, end_ts)                  \
74   C(base::Optional<uint32_t>, upid)                   \
75   C(base::Optional<uint32_t>, is_main_thread)
76 
77 PERFETTO_TP_TABLE(PERFETTO_TP_THREAD_TABLE_DEF);
78 
79 // @name process
80 // @param upid {uint32_t} Unique process id. This is != the OS pid. This is a
81 //        monotonic number associated to each process. The OS process id (pid)
82 //        cannot be used as primary key because tids and pids are recycled by
83 //        most kernels.
84 // @param uid The Unix user id of the process {@joinable package_list.uid}.
85 #define PERFETTO_TP_PROCESS_TABLE_DEF(NAME, PARENT, C) \
86   NAME(ProcessTable, "internal_process")               \
87   PERFETTO_TP_ROOT_TABLE(PARENT, C)                    \
88   C(uint32_t, pid)                                     \
89   C(StringPool::Id, name)                              \
90   C(base::Optional<int64_t>, start_ts)                 \
91   C(base::Optional<int64_t>, end_ts)                   \
92   C(base::Optional<uint32_t>, parent_upid)             \
93   C(base::Optional<uint32_t>, uid)                     \
94   C(base::Optional<uint32_t>, android_appid)
95 
96 PERFETTO_TP_TABLE(PERFETTO_TP_PROCESS_TABLE_DEF);
97 
98 #define PERFETTO_TP_CPU_TABLE_DEF(NAME, PARENT, C) \
99   NAME(CpuTable, "cpu")                            \
100   PERFETTO_TP_ROOT_TABLE(PARENT, C)                \
101   C(uint32_t, time_in_state_cpu_id)                \
102   C(StringPool::Id, processor)
103 
104 PERFETTO_TP_TABLE(PERFETTO_TP_CPU_TABLE_DEF);
105 
106 #define PERFETTO_TP_CPU_FREQ_TABLE_DEF(NAME, PARENT, C) \
107   NAME(CpuFreqTable, "cpu_freq")                        \
108   PERFETTO_TP_ROOT_TABLE(PARENT, C)                     \
109   C(CpuTable::Id, cpu_id)                               \
110   C(uint32_t, freq)
111 
112 PERFETTO_TP_TABLE(PERFETTO_TP_CPU_FREQ_TABLE_DEF);
113 
114 }  // namespace tables
115 }  // namespace trace_processor
116 }  // namespace perfetto
117 
118 #endif  // SRC_TRACE_PROCESSOR_TABLES_METADATA_TABLES_H_
119