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