1 /* 2 * Copyright (C) 2019 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_SLICE_TABLES_H_ 18 #define SRC_TRACE_PROCESSOR_TABLES_SLICE_TABLES_H_ 19 20 #include "src/trace_processor/tables/macros.h" 21 #include "src/trace_processor/tables/track_tables.h" 22 23 namespace perfetto { 24 namespace trace_processor { 25 namespace tables { 26 27 // @name slice 28 // @tablegroup Events 29 // @param ts timestamp of the start of the slice (in nanoseconds) 30 // @param dur duration of the slice (in nanoseconds) 31 // @param arg_set_id {@joinable args.arg_set_id} 32 #define PERFETTO_TP_SLICE_TABLE_DEF(NAME, PARENT, C) \ 33 NAME(SliceTable, "internal_slice") \ 34 PERFETTO_TP_ROOT_TABLE(PARENT, C) \ 35 C(int64_t, ts, Column::Flag::kSorted) \ 36 C(int64_t, dur) \ 37 C(TrackTable::Id, track_id) \ 38 C(base::Optional<StringPool::Id>, category) \ 39 C(base::Optional<StringPool::Id>, name) \ 40 C(uint32_t, depth) \ 41 C(int64_t, stack_id) \ 42 C(int64_t, parent_stack_id) \ 43 C(base::Optional<SliceTable::Id>, parent_id) \ 44 C(uint32_t, arg_set_id) 45 46 PERFETTO_TP_TABLE(PERFETTO_TP_SLICE_TABLE_DEF); 47 48 // @tablegroup Events 49 // @param ts timestamp of the start of the slice (in nanoseconds) 50 // @param arg_set_id {@joinable args.arg_set_id} 51 #define PERFETTO_TP_INSTANT_TABLE_DEF(NAME, PARENT, C) \ 52 NAME(InstantTable, "instant") \ 53 PERFETTO_TP_ROOT_TABLE(PARENT, C) \ 54 C(int64_t, ts, Column::Flag::kSorted) \ 55 C(StringPool::Id, name) \ 56 C(int64_t, ref) \ 57 C(StringPool::Id, ref_type) \ 58 C(uint32_t, arg_set_id) 59 60 PERFETTO_TP_TABLE(PERFETTO_TP_INSTANT_TABLE_DEF); 61 62 // @tablegroup Events 63 // @param ts timestamp of the start of the slice (in nanoseconds) 64 // @param dur duration of the slice (in nanoseconds) 65 // @param utid {@joinable thread.utid} 66 #define PERFETTO_TP_SCHED_SLICE_TABLE_DEF(NAME, PARENT, C) \ 67 NAME(SchedSliceTable, "sched_slice") \ 68 PERFETTO_TP_ROOT_TABLE(PARENT, C) \ 69 C(int64_t, ts, Column::Flag::kSorted) \ 70 C(int64_t, dur) \ 71 C(uint32_t, cpu) \ 72 C(uint32_t, utid) \ 73 C(StringPool::Id, end_state) \ 74 C(int32_t, priority) 75 76 PERFETTO_TP_TABLE(PERFETTO_TP_SCHED_SLICE_TABLE_DEF); 77 78 // @tablegroup Events 79 // @param utid {@joinable thread.utid} 80 #define PERFETTO_TP_THREAD_STATE_TABLE_DEF(NAME, PARENT, C) \ 81 NAME(ThreadStateTable, "thread_state") \ 82 PERFETTO_TP_ROOT_TABLE(PARENT, C) \ 83 C(int64_t, ts) \ 84 C(int64_t, dur) \ 85 C(base::Optional<uint32_t>, cpu) \ 86 C(uint32_t, utid) \ 87 C(StringPool::Id, state) \ 88 C(base::Optional<uint32_t>, io_wait) \ 89 C(base::Optional<StringPool::Id>, blocked_function) 90 91 PERFETTO_TP_TABLE(PERFETTO_TP_THREAD_STATE_TABLE_DEF); 92 93 // @tablegroup Events 94 #define PERFETTO_TP_GPU_SLICES_DEF(NAME, PARENT, C) \ 95 NAME(GpuSliceTable, "gpu_slice") \ 96 PARENT(PERFETTO_TP_SLICE_TABLE_DEF, C) \ 97 C(base::Optional<int64_t>, context_id) \ 98 C(base::Optional<int64_t>, render_target) \ 99 C(StringPool::Id, render_target_name) \ 100 C(base::Optional<int64_t>, render_pass) \ 101 C(StringPool::Id, render_pass_name) \ 102 C(base::Optional<int64_t>, command_buffer) \ 103 C(StringPool::Id, command_buffer_name) \ 104 C(base::Optional<uint32_t>, frame_id) \ 105 C(base::Optional<uint32_t>, submission_id) \ 106 C(base::Optional<int64_t>, hw_queue_id) \ 107 C(StringPool::Id, render_subpasses) 108 109 PERFETTO_TP_TABLE(PERFETTO_TP_GPU_SLICES_DEF); 110 111 // @tablegroup Events 112 #define PERFETTO_TP_GRAPHICS_FRAME_SLICES_DEF(NAME, PARENT, C) \ 113 NAME(GraphicsFrameSliceTable, "frame_slice") \ 114 PARENT(PERFETTO_TP_SLICE_TABLE_DEF, C) \ 115 C(uint32_t, frame_number) \ 116 C(StringPool::Id, layer_name) \ 117 C(int64_t, queue_to_acquire_time) \ 118 C(int64_t, acquire_to_latch_time) \ 119 C(int64_t, latch_to_present_time) 120 121 PERFETTO_TP_TABLE(PERFETTO_TP_GRAPHICS_FRAME_SLICES_DEF); 122 123 #define PERFETTO_TP_DESCRIBE_SLICE_TABLE(NAME, PARENT, C) \ 124 NAME(DescribeSliceTable, "describe_slice") \ 125 PERFETTO_TP_ROOT_TABLE(PARENT, C) \ 126 C(uint32_t, slice_id, Column::Flag::kHidden) \ 127 C(StringPool::Id, description) \ 128 C(StringPool::Id, doc_link) 129 130 PERFETTO_TP_TABLE(PERFETTO_TP_DESCRIBE_SLICE_TABLE); 131 132 #define PERFETTO_TP_EXPECTED_FRAME_TIMELINE_SLICES_DEF(NAME, PARENT, C) \ 133 NAME(ExpectedFrameTimelineSliceTable, "expected_frame_timeline_slice") \ 134 PARENT(PERFETTO_TP_SLICE_TABLE_DEF, C) \ 135 C(int64_t, display_frame_token) \ 136 C(int64_t, surface_frame_token) \ 137 C(uint32_t, upid) \ 138 C(StringPool::Id, layer_name) 139 140 PERFETTO_TP_TABLE(PERFETTO_TP_EXPECTED_FRAME_TIMELINE_SLICES_DEF); 141 142 #define PERFETTO_TP_ACTUAL_FRAME_TIMELINE_SLICES_DEF(NAME, PARENT, C) \ 143 NAME(ActualFrameTimelineSliceTable, "actual_frame_timeline_slice") \ 144 PARENT(PERFETTO_TP_SLICE_TABLE_DEF, C) \ 145 C(int64_t, display_frame_token) \ 146 C(int64_t, surface_frame_token) \ 147 C(uint32_t, upid) \ 148 C(StringPool::Id, layer_name) \ 149 C(StringPool::Id, present_type) \ 150 C(int32_t, on_time_finish) \ 151 C(int32_t, gpu_composition) \ 152 C(StringPool::Id, jank_type) \ 153 C(StringPool::Id, prediction_type) \ 154 C(StringPool::Id, jank_tag) 155 156 PERFETTO_TP_TABLE(PERFETTO_TP_ACTUAL_FRAME_TIMELINE_SLICES_DEF); 157 158 // @param thread_instruction_count The value of the CPU instruction counter at 159 // the start of the slice. 160 // @param thread_instruction_delta The change in value from 161 // @param thread_instruction_count to the end of the slice. 162 #define PERFETTO_TP_THREAD_SLICE_DEF(NAME, PARENT, C) \ 163 NAME(ThreadSliceTable, "thread_slice") \ 164 PARENT(PERFETTO_TP_SLICE_TABLE_DEF, C) \ 165 C(base::Optional<int64_t>, thread_ts) \ 166 C(base::Optional<int64_t>, thread_dur) \ 167 C(base::Optional<int64_t>, thread_instruction_count) \ 168 C(base::Optional<int64_t>, thread_instruction_delta) 169 170 PERFETTO_TP_TABLE(PERFETTO_TP_THREAD_SLICE_DEF); 171 172 #define PERFETTO_TP_EXPERIMENTAL_FLAT_SLICE_TABLE_DEF(NAME, PARENT, C) \ 173 NAME(ExperimentalFlatSliceTable, "experimental_flat_slice") \ 174 PERFETTO_TP_ROOT_TABLE(PARENT, C) \ 175 C(int64_t, ts) \ 176 C(int64_t, dur) \ 177 C(TrackTable::Id, track_id) \ 178 C(base::Optional<StringPool::Id>, category) \ 179 C(base::Optional<StringPool::Id>, name) \ 180 C(uint32_t, arg_set_id) \ 181 C(base::Optional<SliceTable::Id>, source_id) \ 182 C(int64_t, start_bound, Column::Flag::kHidden) \ 183 C(int64_t, end_bound, Column::Flag::kHidden) 184 185 PERFETTO_TP_TABLE(PERFETTO_TP_EXPERIMENTAL_FLAT_SLICE_TABLE_DEF); 186 187 } // namespace tables 188 } // namespace trace_processor 189 } // namespace perfetto 190 191 #endif // SRC_TRACE_PROCESSOR_TABLES_SLICE_TABLES_H_ 192