1 #ifndef SRC_TRACE_PROCESSOR_TABLES_SLICE_TABLES_PY_H_ 2 #define SRC_TRACE_PROCESSOR_TABLES_SLICE_TABLES_PY_H_ 3 4 #include <array> 5 #include <cstddef> 6 #include <cstdint> 7 #include <memory> 8 #include <optional> 9 #include <type_traits> 10 #include <utility> 11 #include <vector> 12 13 #include "perfetto/base/logging.h" 14 #include "perfetto/trace_processor/basic_types.h" 15 #include "perfetto/trace_processor/ref_counted.h" 16 #include "src/trace_processor/containers/bit_vector.h" 17 #include "src/trace_processor/containers/row_map.h" 18 #include "src/trace_processor/containers/string_pool.h" 19 #include "src/trace_processor/db/column/arrangement_overlay.h" 20 #include "src/trace_processor/db/column/data_layer.h" 21 #include "src/trace_processor/db/column/dense_null_overlay.h" 22 #include "src/trace_processor/db/column/numeric_storage.h" 23 #include "src/trace_processor/db/column/id_storage.h" 24 #include "src/trace_processor/db/column/null_overlay.h" 25 #include "src/trace_processor/db/column/range_overlay.h" 26 #include "src/trace_processor/db/column/selector_overlay.h" 27 #include "src/trace_processor/db/column/set_id_storage.h" 28 #include "src/trace_processor/db/column/string_storage.h" 29 #include "src/trace_processor/db/column/types.h" 30 #include "src/trace_processor/db/column_storage.h" 31 #include "src/trace_processor/db/column.h" 32 #include "src/trace_processor/db/table.h" 33 #include "src/trace_processor/db/typed_column.h" 34 #include "src/trace_processor/db/typed_column_internal.h" 35 #include "src/trace_processor/tables/macros_internal.h" 36 37 #include "src/trace_processor/tables/track_tables_py.h" 38 39 namespace perfetto::trace_processor::tables { 40 41 class SliceTable : public macros_internal::MacroTable { 42 public: 43 static constexpr uint32_t kColumnCount = 16; 44 45 struct Id : public BaseId { 46 Id() = default; IdId47 explicit constexpr Id(uint32_t v) : BaseId(v) {} 48 }; 49 static_assert(std::is_trivially_destructible_v<Id>, 50 "Inheritance used without trivial destruction"); 51 52 struct ColumnIndex { 53 static constexpr uint32_t id = 0; 54 static constexpr uint32_t type = 1; 55 static constexpr uint32_t ts = 2; 56 static constexpr uint32_t dur = 3; 57 static constexpr uint32_t track_id = 4; 58 static constexpr uint32_t category = 5; 59 static constexpr uint32_t name = 6; 60 static constexpr uint32_t depth = 7; 61 static constexpr uint32_t stack_id = 8; 62 static constexpr uint32_t parent_stack_id = 9; 63 static constexpr uint32_t parent_id = 10; 64 static constexpr uint32_t arg_set_id = 11; 65 static constexpr uint32_t thread_ts = 12; 66 static constexpr uint32_t thread_dur = 13; 67 static constexpr uint32_t thread_instruction_count = 14; 68 static constexpr uint32_t thread_instruction_delta = 15; 69 }; 70 struct ColumnType { 71 using id = IdColumn<SliceTable::Id>; 72 using type = TypedColumn<StringPool::Id>; 73 using ts = TypedColumn<int64_t>; 74 using dur = TypedColumn<int64_t>; 75 using track_id = TypedColumn<TrackTable::Id>; 76 using category = TypedColumn<std::optional<StringPool::Id>>; 77 using name = TypedColumn<std::optional<StringPool::Id>>; 78 using depth = TypedColumn<uint32_t>; 79 using stack_id = TypedColumn<int64_t>; 80 using parent_stack_id = TypedColumn<int64_t>; 81 using parent_id = TypedColumn<std::optional<SliceTable::Id>>; 82 using arg_set_id = TypedColumn<uint32_t>; 83 using thread_ts = TypedColumn<std::optional<int64_t>>; 84 using thread_dur = TypedColumn<std::optional<int64_t>>; 85 using thread_instruction_count = TypedColumn<std::optional<int64_t>>; 86 using thread_instruction_delta = TypedColumn<std::optional<int64_t>>; 87 }; 88 struct Row : public macros_internal::RootParentTable::Row { 89 Row(int64_t in_ts = {}, 90 int64_t in_dur = {}, 91 TrackTable::Id in_track_id = {}, 92 std::optional<StringPool::Id> in_category = {}, 93 std::optional<StringPool::Id> in_name = {}, 94 uint32_t in_depth = {}, 95 int64_t in_stack_id = {}, 96 int64_t in_parent_stack_id = {}, 97 std::optional<SliceTable::Id> in_parent_id = {}, 98 uint32_t in_arg_set_id = {}, 99 std::optional<int64_t> in_thread_ts = {}, 100 std::optional<int64_t> in_thread_dur = {}, 101 std::optional<int64_t> in_thread_instruction_count = {}, 102 std::optional<int64_t> in_thread_instruction_delta = {}, 103 std::nullptr_t = nullptr) RowRow104 : macros_internal::RootParentTable::Row(), 105 ts(in_ts), 106 dur(in_dur), 107 track_id(in_track_id), 108 category(in_category), 109 name(in_name), 110 depth(in_depth), 111 stack_id(in_stack_id), 112 parent_stack_id(in_parent_stack_id), 113 parent_id(in_parent_id), 114 arg_set_id(in_arg_set_id), 115 thread_ts(in_thread_ts), 116 thread_dur(in_thread_dur), 117 thread_instruction_count(in_thread_instruction_count), 118 thread_instruction_delta(in_thread_instruction_delta) { 119 type_ = "__intrinsic_slice"; 120 } 121 int64_t ts; 122 int64_t dur; 123 TrackTable::Id track_id; 124 std::optional<StringPool::Id> category; 125 std::optional<StringPool::Id> name; 126 uint32_t depth; 127 int64_t stack_id; 128 int64_t parent_stack_id; 129 std::optional<SliceTable::Id> parent_id; 130 uint32_t arg_set_id; 131 std::optional<int64_t> thread_ts; 132 std::optional<int64_t> thread_dur; 133 std::optional<int64_t> thread_instruction_count; 134 std::optional<int64_t> thread_instruction_delta; 135 136 bool operator==(const SliceTable::Row& other) const { 137 return type() == other.type() && ColumnType::ts::Equals(ts, other.ts) && 138 ColumnType::dur::Equals(dur, other.dur) && 139 ColumnType::track_id::Equals(track_id, other.track_id) && 140 ColumnType::category::Equals(category, other.category) && 141 ColumnType::name::Equals(name, other.name) && 142 ColumnType::depth::Equals(depth, other.depth) && 143 ColumnType::stack_id::Equals(stack_id, other.stack_id) && 144 ColumnType::parent_stack_id::Equals(parent_stack_id, other.parent_stack_id) && 145 ColumnType::parent_id::Equals(parent_id, other.parent_id) && 146 ColumnType::arg_set_id::Equals(arg_set_id, other.arg_set_id) && 147 ColumnType::thread_ts::Equals(thread_ts, other.thread_ts) && 148 ColumnType::thread_dur::Equals(thread_dur, other.thread_dur) && 149 ColumnType::thread_instruction_count::Equals(thread_instruction_count, other.thread_instruction_count) && 150 ColumnType::thread_instruction_delta::Equals(thread_instruction_delta, other.thread_instruction_delta); 151 } 152 }; 153 struct ColumnFlag { 154 static constexpr uint32_t ts = static_cast<uint32_t>(ColumnLegacy::Flag::kSorted) | ColumnType::ts::default_flags(); 155 static constexpr uint32_t dur = ColumnType::dur::default_flags(); 156 static constexpr uint32_t track_id = ColumnType::track_id::default_flags(); 157 static constexpr uint32_t category = ColumnType::category::default_flags(); 158 static constexpr uint32_t name = ColumnType::name::default_flags(); 159 static constexpr uint32_t depth = ColumnType::depth::default_flags(); 160 static constexpr uint32_t stack_id = ColumnType::stack_id::default_flags(); 161 static constexpr uint32_t parent_stack_id = ColumnType::parent_stack_id::default_flags(); 162 static constexpr uint32_t parent_id = ColumnType::parent_id::default_flags(); 163 static constexpr uint32_t arg_set_id = ColumnType::arg_set_id::default_flags(); 164 static constexpr uint32_t thread_ts = ColumnType::thread_ts::default_flags(); 165 static constexpr uint32_t thread_dur = ColumnType::thread_dur::default_flags(); 166 static constexpr uint32_t thread_instruction_count = ColumnType::thread_instruction_count::default_flags(); 167 static constexpr uint32_t thread_instruction_delta = ColumnType::thread_instruction_delta::default_flags(); 168 }; 169 170 class RowNumber; 171 class ConstRowReference; 172 class RowReference; 173 174 class RowNumber : public macros_internal::AbstractRowNumber< 175 SliceTable, ConstRowReference, RowReference> { 176 public: RowNumber(uint32_t row_number)177 explicit RowNumber(uint32_t row_number) 178 : AbstractRowNumber(row_number) {} 179 }; 180 static_assert(std::is_trivially_destructible_v<RowNumber>, 181 "Inheritance used without trivial destruction"); 182 183 class ConstRowReference : public macros_internal::AbstractConstRowReference< 184 SliceTable, RowNumber> { 185 public: ConstRowReference(const SliceTable * table,uint32_t row_number)186 ConstRowReference(const SliceTable* table, uint32_t row_number) 187 : AbstractConstRowReference(table, row_number) {} 188 id()189 ColumnType::id::type id() const { 190 return table()->id()[row_number_]; 191 } type()192 ColumnType::type::type type() const { 193 return table()->type()[row_number_]; 194 } ts()195 ColumnType::ts::type ts() const { 196 return table()->ts()[row_number_]; 197 } dur()198 ColumnType::dur::type dur() const { 199 return table()->dur()[row_number_]; 200 } track_id()201 ColumnType::track_id::type track_id() const { 202 return table()->track_id()[row_number_]; 203 } category()204 ColumnType::category::type category() const { 205 return table()->category()[row_number_]; 206 } name()207 ColumnType::name::type name() const { 208 return table()->name()[row_number_]; 209 } depth()210 ColumnType::depth::type depth() const { 211 return table()->depth()[row_number_]; 212 } stack_id()213 ColumnType::stack_id::type stack_id() const { 214 return table()->stack_id()[row_number_]; 215 } parent_stack_id()216 ColumnType::parent_stack_id::type parent_stack_id() const { 217 return table()->parent_stack_id()[row_number_]; 218 } parent_id()219 ColumnType::parent_id::type parent_id() const { 220 return table()->parent_id()[row_number_]; 221 } arg_set_id()222 ColumnType::arg_set_id::type arg_set_id() const { 223 return table()->arg_set_id()[row_number_]; 224 } thread_ts()225 ColumnType::thread_ts::type thread_ts() const { 226 return table()->thread_ts()[row_number_]; 227 } thread_dur()228 ColumnType::thread_dur::type thread_dur() const { 229 return table()->thread_dur()[row_number_]; 230 } thread_instruction_count()231 ColumnType::thread_instruction_count::type thread_instruction_count() const { 232 return table()->thread_instruction_count()[row_number_]; 233 } thread_instruction_delta()234 ColumnType::thread_instruction_delta::type thread_instruction_delta() const { 235 return table()->thread_instruction_delta()[row_number_]; 236 } 237 }; 238 static_assert(std::is_trivially_destructible_v<ConstRowReference>, 239 "Inheritance used without trivial destruction"); 240 class RowReference : public ConstRowReference { 241 public: RowReference(const SliceTable * table,uint32_t row_number)242 RowReference(const SliceTable* table, uint32_t row_number) 243 : ConstRowReference(table, row_number) {} 244 set_ts(ColumnType::ts::non_optional_type v)245 void set_ts( 246 ColumnType::ts::non_optional_type v) { 247 return mutable_table()->mutable_ts()->Set(row_number_, v); 248 } set_dur(ColumnType::dur::non_optional_type v)249 void set_dur( 250 ColumnType::dur::non_optional_type v) { 251 return mutable_table()->mutable_dur()->Set(row_number_, v); 252 } set_track_id(ColumnType::track_id::non_optional_type v)253 void set_track_id( 254 ColumnType::track_id::non_optional_type v) { 255 return mutable_table()->mutable_track_id()->Set(row_number_, v); 256 } set_category(ColumnType::category::non_optional_type v)257 void set_category( 258 ColumnType::category::non_optional_type v) { 259 return mutable_table()->mutable_category()->Set(row_number_, v); 260 } set_name(ColumnType::name::non_optional_type v)261 void set_name( 262 ColumnType::name::non_optional_type v) { 263 return mutable_table()->mutable_name()->Set(row_number_, v); 264 } set_depth(ColumnType::depth::non_optional_type v)265 void set_depth( 266 ColumnType::depth::non_optional_type v) { 267 return mutable_table()->mutable_depth()->Set(row_number_, v); 268 } set_stack_id(ColumnType::stack_id::non_optional_type v)269 void set_stack_id( 270 ColumnType::stack_id::non_optional_type v) { 271 return mutable_table()->mutable_stack_id()->Set(row_number_, v); 272 } set_parent_stack_id(ColumnType::parent_stack_id::non_optional_type v)273 void set_parent_stack_id( 274 ColumnType::parent_stack_id::non_optional_type v) { 275 return mutable_table()->mutable_parent_stack_id()->Set(row_number_, v); 276 } set_parent_id(ColumnType::parent_id::non_optional_type v)277 void set_parent_id( 278 ColumnType::parent_id::non_optional_type v) { 279 return mutable_table()->mutable_parent_id()->Set(row_number_, v); 280 } set_arg_set_id(ColumnType::arg_set_id::non_optional_type v)281 void set_arg_set_id( 282 ColumnType::arg_set_id::non_optional_type v) { 283 return mutable_table()->mutable_arg_set_id()->Set(row_number_, v); 284 } set_thread_ts(ColumnType::thread_ts::non_optional_type v)285 void set_thread_ts( 286 ColumnType::thread_ts::non_optional_type v) { 287 return mutable_table()->mutable_thread_ts()->Set(row_number_, v); 288 } set_thread_dur(ColumnType::thread_dur::non_optional_type v)289 void set_thread_dur( 290 ColumnType::thread_dur::non_optional_type v) { 291 return mutable_table()->mutable_thread_dur()->Set(row_number_, v); 292 } set_thread_instruction_count(ColumnType::thread_instruction_count::non_optional_type v)293 void set_thread_instruction_count( 294 ColumnType::thread_instruction_count::non_optional_type v) { 295 return mutable_table()->mutable_thread_instruction_count()->Set(row_number_, v); 296 } set_thread_instruction_delta(ColumnType::thread_instruction_delta::non_optional_type v)297 void set_thread_instruction_delta( 298 ColumnType::thread_instruction_delta::non_optional_type v) { 299 return mutable_table()->mutable_thread_instruction_delta()->Set(row_number_, v); 300 } 301 302 private: mutable_table()303 SliceTable* mutable_table() const { 304 return const_cast<SliceTable*>(table()); 305 } 306 }; 307 static_assert(std::is_trivially_destructible_v<RowReference>, 308 "Inheritance used without trivial destruction"); 309 310 class ConstIterator; 311 class ConstIterator : public macros_internal::AbstractConstIterator< 312 ConstIterator, SliceTable, RowNumber, ConstRowReference> { 313 public: id()314 ColumnType::id::type id() const { 315 const auto& col = table()->id(); 316 return col.GetAtIdx( 317 iterator_.StorageIndexForColumn(col.index_in_table())); 318 } type()319 ColumnType::type::type type() const { 320 const auto& col = table()->type(); 321 return col.GetAtIdx( 322 iterator_.StorageIndexForColumn(col.index_in_table())); 323 } ts()324 ColumnType::ts::type ts() const { 325 const auto& col = table()->ts(); 326 return col.GetAtIdx( 327 iterator_.StorageIndexForColumn(col.index_in_table())); 328 } dur()329 ColumnType::dur::type dur() const { 330 const auto& col = table()->dur(); 331 return col.GetAtIdx( 332 iterator_.StorageIndexForColumn(col.index_in_table())); 333 } track_id()334 ColumnType::track_id::type track_id() const { 335 const auto& col = table()->track_id(); 336 return col.GetAtIdx( 337 iterator_.StorageIndexForColumn(col.index_in_table())); 338 } category()339 ColumnType::category::type category() const { 340 const auto& col = table()->category(); 341 return col.GetAtIdx( 342 iterator_.StorageIndexForColumn(col.index_in_table())); 343 } name()344 ColumnType::name::type name() const { 345 const auto& col = table()->name(); 346 return col.GetAtIdx( 347 iterator_.StorageIndexForColumn(col.index_in_table())); 348 } depth()349 ColumnType::depth::type depth() const { 350 const auto& col = table()->depth(); 351 return col.GetAtIdx( 352 iterator_.StorageIndexForColumn(col.index_in_table())); 353 } stack_id()354 ColumnType::stack_id::type stack_id() const { 355 const auto& col = table()->stack_id(); 356 return col.GetAtIdx( 357 iterator_.StorageIndexForColumn(col.index_in_table())); 358 } parent_stack_id()359 ColumnType::parent_stack_id::type parent_stack_id() const { 360 const auto& col = table()->parent_stack_id(); 361 return col.GetAtIdx( 362 iterator_.StorageIndexForColumn(col.index_in_table())); 363 } parent_id()364 ColumnType::parent_id::type parent_id() const { 365 const auto& col = table()->parent_id(); 366 return col.GetAtIdx( 367 iterator_.StorageIndexForColumn(col.index_in_table())); 368 } arg_set_id()369 ColumnType::arg_set_id::type arg_set_id() const { 370 const auto& col = table()->arg_set_id(); 371 return col.GetAtIdx( 372 iterator_.StorageIndexForColumn(col.index_in_table())); 373 } thread_ts()374 ColumnType::thread_ts::type thread_ts() const { 375 const auto& col = table()->thread_ts(); 376 return col.GetAtIdx( 377 iterator_.StorageIndexForColumn(col.index_in_table())); 378 } thread_dur()379 ColumnType::thread_dur::type thread_dur() const { 380 const auto& col = table()->thread_dur(); 381 return col.GetAtIdx( 382 iterator_.StorageIndexForColumn(col.index_in_table())); 383 } thread_instruction_count()384 ColumnType::thread_instruction_count::type thread_instruction_count() const { 385 const auto& col = table()->thread_instruction_count(); 386 return col.GetAtIdx( 387 iterator_.StorageIndexForColumn(col.index_in_table())); 388 } thread_instruction_delta()389 ColumnType::thread_instruction_delta::type thread_instruction_delta() const { 390 const auto& col = table()->thread_instruction_delta(); 391 return col.GetAtIdx( 392 iterator_.StorageIndexForColumn(col.index_in_table())); 393 } 394 395 protected: ConstIterator(const SliceTable * table,Table::Iterator iterator)396 explicit ConstIterator(const SliceTable* table, 397 Table::Iterator iterator) 398 : AbstractConstIterator(table, std::move(iterator)) {} 399 CurrentRowNumber()400 uint32_t CurrentRowNumber() const { 401 return iterator_.StorageIndexForLastOverlay(); 402 } 403 404 private: 405 friend class SliceTable; 406 friend class macros_internal::AbstractConstIterator< 407 ConstIterator, SliceTable, RowNumber, ConstRowReference>; 408 }; 409 class Iterator : public ConstIterator { 410 public: row_reference()411 RowReference row_reference() const { 412 return {const_cast<SliceTable*>(table()), CurrentRowNumber()}; 413 } 414 415 private: 416 friend class SliceTable; 417 Iterator(SliceTable * table,Table::Iterator iterator)418 explicit Iterator(SliceTable* table, Table::Iterator iterator) 419 : ConstIterator(table, std::move(iterator)) {} 420 }; 421 422 struct IdAndRow { 423 Id id; 424 uint32_t row; 425 RowReference row_reference; 426 RowNumber row_number; 427 }; 428 GetColumns(SliceTable * self,const macros_internal::MacroTable * parent)429 static std::vector<ColumnLegacy> GetColumns( 430 SliceTable* self, 431 const macros_internal::MacroTable* parent) { 432 std::vector<ColumnLegacy> columns = 433 CopyColumnsFromParentOrAddRootColumns(self, parent); 434 uint32_t olay_idx = OverlayCount(parent); 435 AddColumnToVector(columns, "ts", &self->ts_, ColumnFlag::ts, 436 static_cast<uint32_t>(columns.size()), olay_idx); 437 AddColumnToVector(columns, "dur", &self->dur_, ColumnFlag::dur, 438 static_cast<uint32_t>(columns.size()), olay_idx); 439 AddColumnToVector(columns, "track_id", &self->track_id_, ColumnFlag::track_id, 440 static_cast<uint32_t>(columns.size()), olay_idx); 441 AddColumnToVector(columns, "category", &self->category_, ColumnFlag::category, 442 static_cast<uint32_t>(columns.size()), olay_idx); 443 AddColumnToVector(columns, "name", &self->name_, ColumnFlag::name, 444 static_cast<uint32_t>(columns.size()), olay_idx); 445 AddColumnToVector(columns, "depth", &self->depth_, ColumnFlag::depth, 446 static_cast<uint32_t>(columns.size()), olay_idx); 447 AddColumnToVector(columns, "stack_id", &self->stack_id_, ColumnFlag::stack_id, 448 static_cast<uint32_t>(columns.size()), olay_idx); 449 AddColumnToVector(columns, "parent_stack_id", &self->parent_stack_id_, ColumnFlag::parent_stack_id, 450 static_cast<uint32_t>(columns.size()), olay_idx); 451 AddColumnToVector(columns, "parent_id", &self->parent_id_, ColumnFlag::parent_id, 452 static_cast<uint32_t>(columns.size()), olay_idx); 453 AddColumnToVector(columns, "arg_set_id", &self->arg_set_id_, ColumnFlag::arg_set_id, 454 static_cast<uint32_t>(columns.size()), olay_idx); 455 AddColumnToVector(columns, "thread_ts", &self->thread_ts_, ColumnFlag::thread_ts, 456 static_cast<uint32_t>(columns.size()), olay_idx); 457 AddColumnToVector(columns, "thread_dur", &self->thread_dur_, ColumnFlag::thread_dur, 458 static_cast<uint32_t>(columns.size()), olay_idx); 459 AddColumnToVector(columns, "thread_instruction_count", &self->thread_instruction_count_, ColumnFlag::thread_instruction_count, 460 static_cast<uint32_t>(columns.size()), olay_idx); 461 AddColumnToVector(columns, "thread_instruction_delta", &self->thread_instruction_delta_, ColumnFlag::thread_instruction_delta, 462 static_cast<uint32_t>(columns.size()), olay_idx); 463 return columns; 464 } 465 SliceTable(StringPool * pool)466 PERFETTO_NO_INLINE explicit SliceTable(StringPool* pool) 467 : macros_internal::MacroTable( 468 pool, 469 GetColumns(this, nullptr), 470 nullptr), 471 ts_(ColumnStorage<ColumnType::ts::stored_type>::Create<false>()), 472 dur_(ColumnStorage<ColumnType::dur::stored_type>::Create<false>()), 473 track_id_(ColumnStorage<ColumnType::track_id::stored_type>::Create<false>()), 474 category_(ColumnStorage<ColumnType::category::stored_type>::Create<false>()), 475 name_(ColumnStorage<ColumnType::name::stored_type>::Create<false>()), 476 depth_(ColumnStorage<ColumnType::depth::stored_type>::Create<false>()), 477 stack_id_(ColumnStorage<ColumnType::stack_id::stored_type>::Create<false>()), 478 parent_stack_id_(ColumnStorage<ColumnType::parent_stack_id::stored_type>::Create<false>()), 479 parent_id_(ColumnStorage<ColumnType::parent_id::stored_type>::Create<false>()), 480 arg_set_id_(ColumnStorage<ColumnType::arg_set_id::stored_type>::Create<false>()), 481 thread_ts_(ColumnStorage<ColumnType::thread_ts::stored_type>::Create<false>()), 482 thread_dur_(ColumnStorage<ColumnType::thread_dur::stored_type>::Create<false>()), 483 thread_instruction_count_(ColumnStorage<ColumnType::thread_instruction_count::stored_type>::Create<false>()), 484 thread_instruction_delta_(ColumnStorage<ColumnType::thread_instruction_delta::stored_type>::Create<false>()) 485 , 486 id_storage_layer_(new column::IdStorage()), 487 type_storage_layer_( 488 new column::StringStorage(string_pool(), &type_.vector())), 489 ts_storage_layer_( 490 new column::NumericStorage<ColumnType::ts::non_optional_stored_type>( 491 &ts_.vector(), 492 ColumnTypeHelper<ColumnType::ts::stored_type>::ToColumnType(), 493 true)), 494 dur_storage_layer_( 495 new column::NumericStorage<ColumnType::dur::non_optional_stored_type>( 496 &dur_.vector(), 497 ColumnTypeHelper<ColumnType::dur::stored_type>::ToColumnType(), 498 false)), 499 track_id_storage_layer_( 500 new column::NumericStorage<ColumnType::track_id::non_optional_stored_type>( 501 &track_id_.vector(), 502 ColumnTypeHelper<ColumnType::track_id::stored_type>::ToColumnType(), 503 false)), 504 category_storage_layer_( 505 new column::StringStorage(string_pool(), &category_.vector())), 506 name_storage_layer_( 507 new column::StringStorage(string_pool(), &name_.vector())), 508 depth_storage_layer_( 509 new column::NumericStorage<ColumnType::depth::non_optional_stored_type>( 510 &depth_.vector(), 511 ColumnTypeHelper<ColumnType::depth::stored_type>::ToColumnType(), 512 false)), 513 stack_id_storage_layer_( 514 new column::NumericStorage<ColumnType::stack_id::non_optional_stored_type>( 515 &stack_id_.vector(), 516 ColumnTypeHelper<ColumnType::stack_id::stored_type>::ToColumnType(), 517 false)), 518 parent_stack_id_storage_layer_( 519 new column::NumericStorage<ColumnType::parent_stack_id::non_optional_stored_type>( 520 &parent_stack_id_.vector(), 521 ColumnTypeHelper<ColumnType::parent_stack_id::stored_type>::ToColumnType(), 522 false)), 523 parent_id_storage_layer_( 524 new column::NumericStorage<ColumnType::parent_id::non_optional_stored_type>( 525 &parent_id_.non_null_vector(), 526 ColumnTypeHelper<ColumnType::parent_id::stored_type>::ToColumnType(), 527 false)), 528 arg_set_id_storage_layer_( 529 new column::NumericStorage<ColumnType::arg_set_id::non_optional_stored_type>( 530 &arg_set_id_.vector(), 531 ColumnTypeHelper<ColumnType::arg_set_id::stored_type>::ToColumnType(), 532 false)), 533 thread_ts_storage_layer_( 534 new column::NumericStorage<ColumnType::thread_ts::non_optional_stored_type>( 535 &thread_ts_.non_null_vector(), 536 ColumnTypeHelper<ColumnType::thread_ts::stored_type>::ToColumnType(), 537 false)), 538 thread_dur_storage_layer_( 539 new column::NumericStorage<ColumnType::thread_dur::non_optional_stored_type>( 540 &thread_dur_.non_null_vector(), 541 ColumnTypeHelper<ColumnType::thread_dur::stored_type>::ToColumnType(), 542 false)), 543 thread_instruction_count_storage_layer_( 544 new column::NumericStorage<ColumnType::thread_instruction_count::non_optional_stored_type>( 545 &thread_instruction_count_.non_null_vector(), 546 ColumnTypeHelper<ColumnType::thread_instruction_count::stored_type>::ToColumnType(), 547 false)), 548 thread_instruction_delta_storage_layer_( 549 new column::NumericStorage<ColumnType::thread_instruction_delta::non_optional_stored_type>( 550 &thread_instruction_delta_.non_null_vector(), 551 ColumnTypeHelper<ColumnType::thread_instruction_delta::stored_type>::ToColumnType(), 552 false)) 553 , 554 parent_id_null_layer_(new column::NullOverlay(parent_id_.bv())), 555 thread_ts_null_layer_(new column::NullOverlay(thread_ts_.bv())), 556 thread_dur_null_layer_(new column::NullOverlay(thread_dur_.bv())), 557 thread_instruction_count_null_layer_(new column::NullOverlay(thread_instruction_count_.bv())), 558 thread_instruction_delta_null_layer_(new column::NullOverlay(thread_instruction_delta_.bv())) { 559 static_assert( 560 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::ts::stored_type>( 561 ColumnFlag::ts), 562 "Column type and flag combination is not valid"); 563 static_assert( 564 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::dur::stored_type>( 565 ColumnFlag::dur), 566 "Column type and flag combination is not valid"); 567 static_assert( 568 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::track_id::stored_type>( 569 ColumnFlag::track_id), 570 "Column type and flag combination is not valid"); 571 static_assert( 572 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::category::stored_type>( 573 ColumnFlag::category), 574 "Column type and flag combination is not valid"); 575 static_assert( 576 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::name::stored_type>( 577 ColumnFlag::name), 578 "Column type and flag combination is not valid"); 579 static_assert( 580 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::depth::stored_type>( 581 ColumnFlag::depth), 582 "Column type and flag combination is not valid"); 583 static_assert( 584 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::stack_id::stored_type>( 585 ColumnFlag::stack_id), 586 "Column type and flag combination is not valid"); 587 static_assert( 588 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::parent_stack_id::stored_type>( 589 ColumnFlag::parent_stack_id), 590 "Column type and flag combination is not valid"); 591 static_assert( 592 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::parent_id::stored_type>( 593 ColumnFlag::parent_id), 594 "Column type and flag combination is not valid"); 595 static_assert( 596 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::arg_set_id::stored_type>( 597 ColumnFlag::arg_set_id), 598 "Column type and flag combination is not valid"); 599 static_assert( 600 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::thread_ts::stored_type>( 601 ColumnFlag::thread_ts), 602 "Column type and flag combination is not valid"); 603 static_assert( 604 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::thread_dur::stored_type>( 605 ColumnFlag::thread_dur), 606 "Column type and flag combination is not valid"); 607 static_assert( 608 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::thread_instruction_count::stored_type>( 609 ColumnFlag::thread_instruction_count), 610 "Column type and flag combination is not valid"); 611 static_assert( 612 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::thread_instruction_delta::stored_type>( 613 ColumnFlag::thread_instruction_delta), 614 "Column type and flag combination is not valid"); 615 OnConstructionCompletedRegularConstructor( 616 {id_storage_layer_,type_storage_layer_,ts_storage_layer_,dur_storage_layer_,track_id_storage_layer_,category_storage_layer_,name_storage_layer_,depth_storage_layer_,stack_id_storage_layer_,parent_stack_id_storage_layer_,parent_id_storage_layer_,arg_set_id_storage_layer_,thread_ts_storage_layer_,thread_dur_storage_layer_,thread_instruction_count_storage_layer_,thread_instruction_delta_storage_layer_}, 617 {{},{},{},{},{},{},{},{},{},{},parent_id_null_layer_,{},thread_ts_null_layer_,thread_dur_null_layer_,thread_instruction_count_null_layer_,thread_instruction_delta_null_layer_}); 618 } 619 ~SliceTable() override; 620 Name()621 static const char* Name() { return "__intrinsic_slice"; } 622 ComputeStaticSchema()623 static Table::Schema ComputeStaticSchema() { 624 Table::Schema schema; 625 schema.columns.emplace_back(Table::Schema::Column{ 626 "id", SqlValue::Type::kLong, true, true, false, false}); 627 schema.columns.emplace_back(Table::Schema::Column{ 628 "type", SqlValue::Type::kString, false, false, false, false}); 629 schema.columns.emplace_back(Table::Schema::Column{ 630 "ts", ColumnType::ts::SqlValueType(), false, 631 true, 632 false, 633 false}); 634 schema.columns.emplace_back(Table::Schema::Column{ 635 "dur", ColumnType::dur::SqlValueType(), false, 636 false, 637 false, 638 false}); 639 schema.columns.emplace_back(Table::Schema::Column{ 640 "track_id", ColumnType::track_id::SqlValueType(), false, 641 false, 642 false, 643 false}); 644 schema.columns.emplace_back(Table::Schema::Column{ 645 "category", ColumnType::category::SqlValueType(), false, 646 false, 647 false, 648 false}); 649 schema.columns.emplace_back(Table::Schema::Column{ 650 "name", ColumnType::name::SqlValueType(), false, 651 false, 652 false, 653 false}); 654 schema.columns.emplace_back(Table::Schema::Column{ 655 "depth", ColumnType::depth::SqlValueType(), false, 656 false, 657 false, 658 false}); 659 schema.columns.emplace_back(Table::Schema::Column{ 660 "stack_id", ColumnType::stack_id::SqlValueType(), false, 661 false, 662 false, 663 false}); 664 schema.columns.emplace_back(Table::Schema::Column{ 665 "parent_stack_id", ColumnType::parent_stack_id::SqlValueType(), false, 666 false, 667 false, 668 false}); 669 schema.columns.emplace_back(Table::Schema::Column{ 670 "parent_id", ColumnType::parent_id::SqlValueType(), false, 671 false, 672 false, 673 false}); 674 schema.columns.emplace_back(Table::Schema::Column{ 675 "arg_set_id", ColumnType::arg_set_id::SqlValueType(), false, 676 false, 677 false, 678 false}); 679 schema.columns.emplace_back(Table::Schema::Column{ 680 "thread_ts", ColumnType::thread_ts::SqlValueType(), false, 681 false, 682 false, 683 false}); 684 schema.columns.emplace_back(Table::Schema::Column{ 685 "thread_dur", ColumnType::thread_dur::SqlValueType(), false, 686 false, 687 false, 688 false}); 689 schema.columns.emplace_back(Table::Schema::Column{ 690 "thread_instruction_count", ColumnType::thread_instruction_count::SqlValueType(), false, 691 false, 692 false, 693 false}); 694 schema.columns.emplace_back(Table::Schema::Column{ 695 "thread_instruction_delta", ColumnType::thread_instruction_delta::SqlValueType(), false, 696 false, 697 false, 698 false}); 699 return schema; 700 } 701 IterateRows()702 ConstIterator IterateRows() const { 703 return ConstIterator(this, Table::IterateRows()); 704 } 705 IterateRows()706 Iterator IterateRows() { return Iterator(this, Table::IterateRows()); } 707 FilterToIterator(const Query & q)708 ConstIterator FilterToIterator(const Query& q) const { 709 return ConstIterator(this, QueryToIterator(q)); 710 } 711 FilterToIterator(const Query & q)712 Iterator FilterToIterator(const Query& q) { 713 return Iterator(this, QueryToIterator(q)); 714 } 715 ShrinkToFit()716 void ShrinkToFit() { 717 type_.ShrinkToFit(); 718 ts_.ShrinkToFit(); 719 dur_.ShrinkToFit(); 720 track_id_.ShrinkToFit(); 721 category_.ShrinkToFit(); 722 name_.ShrinkToFit(); 723 depth_.ShrinkToFit(); 724 stack_id_.ShrinkToFit(); 725 parent_stack_id_.ShrinkToFit(); 726 parent_id_.ShrinkToFit(); 727 arg_set_id_.ShrinkToFit(); 728 thread_ts_.ShrinkToFit(); 729 thread_dur_.ShrinkToFit(); 730 thread_instruction_count_.ShrinkToFit(); 731 thread_instruction_delta_.ShrinkToFit(); 732 } 733 734 ConstRowReference operator[](uint32_t r) const { 735 return ConstRowReference(this, r); 736 } 737 RowReference operator[](uint32_t r) { return RowReference(this, r); } 738 ConstRowReference operator[](RowNumber r) const { 739 return ConstRowReference(this, r.row_number()); 740 } 741 RowReference operator[](RowNumber r) { 742 return RowReference(this, r.row_number()); 743 } 744 FindById(Id find_id)745 std::optional<ConstRowReference> FindById(Id find_id) const { 746 std::optional<uint32_t> row = id().IndexOf(find_id); 747 return row ? std::make_optional(ConstRowReference(this, *row)) 748 : std::nullopt; 749 } 750 FindById(Id find_id)751 std::optional<RowReference> FindById(Id find_id) { 752 std::optional<uint32_t> row = id().IndexOf(find_id); 753 return row ? std::make_optional(RowReference(this, *row)) : std::nullopt; 754 } 755 Insert(const Row & row)756 IdAndRow Insert(const Row& row) { 757 uint32_t row_number = row_count(); 758 Id id = Id{row_number}; 759 type_.Append(string_pool()->InternString(row.type())); 760 mutable_ts()->Append(row.ts); 761 mutable_dur()->Append(row.dur); 762 mutable_track_id()->Append(row.track_id); 763 mutable_category()->Append(row.category); 764 mutable_name()->Append(row.name); 765 mutable_depth()->Append(row.depth); 766 mutable_stack_id()->Append(row.stack_id); 767 mutable_parent_stack_id()->Append(row.parent_stack_id); 768 mutable_parent_id()->Append(row.parent_id); 769 mutable_arg_set_id()->Append(row.arg_set_id); 770 mutable_thread_ts()->Append(row.thread_ts); 771 mutable_thread_dur()->Append(row.thread_dur); 772 mutable_thread_instruction_count()->Append(row.thread_instruction_count); 773 mutable_thread_instruction_delta()->Append(row.thread_instruction_delta); 774 UpdateSelfOverlayAfterInsert(); 775 return IdAndRow{id, row_number, RowReference(this, row_number), 776 RowNumber(row_number)}; 777 } 778 779 780 id()781 const IdColumn<SliceTable::Id>& id() const { 782 return static_cast<const ColumnType::id&>(columns()[ColumnIndex::id]); 783 } type()784 const TypedColumn<StringPool::Id>& type() const { 785 return static_cast<const ColumnType::type&>(columns()[ColumnIndex::type]); 786 } ts()787 const TypedColumn<int64_t>& ts() const { 788 return static_cast<const ColumnType::ts&>(columns()[ColumnIndex::ts]); 789 } dur()790 const TypedColumn<int64_t>& dur() const { 791 return static_cast<const ColumnType::dur&>(columns()[ColumnIndex::dur]); 792 } track_id()793 const TypedColumn<TrackTable::Id>& track_id() const { 794 return static_cast<const ColumnType::track_id&>(columns()[ColumnIndex::track_id]); 795 } category()796 const TypedColumn<std::optional<StringPool::Id>>& category() const { 797 return static_cast<const ColumnType::category&>(columns()[ColumnIndex::category]); 798 } name()799 const TypedColumn<std::optional<StringPool::Id>>& name() const { 800 return static_cast<const ColumnType::name&>(columns()[ColumnIndex::name]); 801 } depth()802 const TypedColumn<uint32_t>& depth() const { 803 return static_cast<const ColumnType::depth&>(columns()[ColumnIndex::depth]); 804 } stack_id()805 const TypedColumn<int64_t>& stack_id() const { 806 return static_cast<const ColumnType::stack_id&>(columns()[ColumnIndex::stack_id]); 807 } parent_stack_id()808 const TypedColumn<int64_t>& parent_stack_id() const { 809 return static_cast<const ColumnType::parent_stack_id&>(columns()[ColumnIndex::parent_stack_id]); 810 } parent_id()811 const TypedColumn<std::optional<SliceTable::Id>>& parent_id() const { 812 return static_cast<const ColumnType::parent_id&>(columns()[ColumnIndex::parent_id]); 813 } arg_set_id()814 const TypedColumn<uint32_t>& arg_set_id() const { 815 return static_cast<const ColumnType::arg_set_id&>(columns()[ColumnIndex::arg_set_id]); 816 } thread_ts()817 const TypedColumn<std::optional<int64_t>>& thread_ts() const { 818 return static_cast<const ColumnType::thread_ts&>(columns()[ColumnIndex::thread_ts]); 819 } thread_dur()820 const TypedColumn<std::optional<int64_t>>& thread_dur() const { 821 return static_cast<const ColumnType::thread_dur&>(columns()[ColumnIndex::thread_dur]); 822 } thread_instruction_count()823 const TypedColumn<std::optional<int64_t>>& thread_instruction_count() const { 824 return static_cast<const ColumnType::thread_instruction_count&>(columns()[ColumnIndex::thread_instruction_count]); 825 } thread_instruction_delta()826 const TypedColumn<std::optional<int64_t>>& thread_instruction_delta() const { 827 return static_cast<const ColumnType::thread_instruction_delta&>(columns()[ColumnIndex::thread_instruction_delta]); 828 } 829 mutable_ts()830 TypedColumn<int64_t>* mutable_ts() { 831 return static_cast<ColumnType::ts*>( 832 GetColumn(ColumnIndex::ts)); 833 } mutable_dur()834 TypedColumn<int64_t>* mutable_dur() { 835 return static_cast<ColumnType::dur*>( 836 GetColumn(ColumnIndex::dur)); 837 } mutable_track_id()838 TypedColumn<TrackTable::Id>* mutable_track_id() { 839 return static_cast<ColumnType::track_id*>( 840 GetColumn(ColumnIndex::track_id)); 841 } mutable_category()842 TypedColumn<std::optional<StringPool::Id>>* mutable_category() { 843 return static_cast<ColumnType::category*>( 844 GetColumn(ColumnIndex::category)); 845 } mutable_name()846 TypedColumn<std::optional<StringPool::Id>>* mutable_name() { 847 return static_cast<ColumnType::name*>( 848 GetColumn(ColumnIndex::name)); 849 } mutable_depth()850 TypedColumn<uint32_t>* mutable_depth() { 851 return static_cast<ColumnType::depth*>( 852 GetColumn(ColumnIndex::depth)); 853 } mutable_stack_id()854 TypedColumn<int64_t>* mutable_stack_id() { 855 return static_cast<ColumnType::stack_id*>( 856 GetColumn(ColumnIndex::stack_id)); 857 } mutable_parent_stack_id()858 TypedColumn<int64_t>* mutable_parent_stack_id() { 859 return static_cast<ColumnType::parent_stack_id*>( 860 GetColumn(ColumnIndex::parent_stack_id)); 861 } mutable_parent_id()862 TypedColumn<std::optional<SliceTable::Id>>* mutable_parent_id() { 863 return static_cast<ColumnType::parent_id*>( 864 GetColumn(ColumnIndex::parent_id)); 865 } mutable_arg_set_id()866 TypedColumn<uint32_t>* mutable_arg_set_id() { 867 return static_cast<ColumnType::arg_set_id*>( 868 GetColumn(ColumnIndex::arg_set_id)); 869 } mutable_thread_ts()870 TypedColumn<std::optional<int64_t>>* mutable_thread_ts() { 871 return static_cast<ColumnType::thread_ts*>( 872 GetColumn(ColumnIndex::thread_ts)); 873 } mutable_thread_dur()874 TypedColumn<std::optional<int64_t>>* mutable_thread_dur() { 875 return static_cast<ColumnType::thread_dur*>( 876 GetColumn(ColumnIndex::thread_dur)); 877 } mutable_thread_instruction_count()878 TypedColumn<std::optional<int64_t>>* mutable_thread_instruction_count() { 879 return static_cast<ColumnType::thread_instruction_count*>( 880 GetColumn(ColumnIndex::thread_instruction_count)); 881 } mutable_thread_instruction_delta()882 TypedColumn<std::optional<int64_t>>* mutable_thread_instruction_delta() { 883 return static_cast<ColumnType::thread_instruction_delta*>( 884 GetColumn(ColumnIndex::thread_instruction_delta)); 885 } 886 887 private: 888 889 890 ColumnStorage<ColumnType::ts::stored_type> ts_; 891 ColumnStorage<ColumnType::dur::stored_type> dur_; 892 ColumnStorage<ColumnType::track_id::stored_type> track_id_; 893 ColumnStorage<ColumnType::category::stored_type> category_; 894 ColumnStorage<ColumnType::name::stored_type> name_; 895 ColumnStorage<ColumnType::depth::stored_type> depth_; 896 ColumnStorage<ColumnType::stack_id::stored_type> stack_id_; 897 ColumnStorage<ColumnType::parent_stack_id::stored_type> parent_stack_id_; 898 ColumnStorage<ColumnType::parent_id::stored_type> parent_id_; 899 ColumnStorage<ColumnType::arg_set_id::stored_type> arg_set_id_; 900 ColumnStorage<ColumnType::thread_ts::stored_type> thread_ts_; 901 ColumnStorage<ColumnType::thread_dur::stored_type> thread_dur_; 902 ColumnStorage<ColumnType::thread_instruction_count::stored_type> thread_instruction_count_; 903 ColumnStorage<ColumnType::thread_instruction_delta::stored_type> thread_instruction_delta_; 904 905 RefPtr<column::StorageLayer> id_storage_layer_; 906 RefPtr<column::StorageLayer> type_storage_layer_; 907 RefPtr<column::StorageLayer> ts_storage_layer_; 908 RefPtr<column::StorageLayer> dur_storage_layer_; 909 RefPtr<column::StorageLayer> track_id_storage_layer_; 910 RefPtr<column::StorageLayer> category_storage_layer_; 911 RefPtr<column::StorageLayer> name_storage_layer_; 912 RefPtr<column::StorageLayer> depth_storage_layer_; 913 RefPtr<column::StorageLayer> stack_id_storage_layer_; 914 RefPtr<column::StorageLayer> parent_stack_id_storage_layer_; 915 RefPtr<column::StorageLayer> parent_id_storage_layer_; 916 RefPtr<column::StorageLayer> arg_set_id_storage_layer_; 917 RefPtr<column::StorageLayer> thread_ts_storage_layer_; 918 RefPtr<column::StorageLayer> thread_dur_storage_layer_; 919 RefPtr<column::StorageLayer> thread_instruction_count_storage_layer_; 920 RefPtr<column::StorageLayer> thread_instruction_delta_storage_layer_; 921 922 RefPtr<column::OverlayLayer> parent_id_null_layer_; 923 RefPtr<column::OverlayLayer> thread_ts_null_layer_; 924 RefPtr<column::OverlayLayer> thread_dur_null_layer_; 925 RefPtr<column::OverlayLayer> thread_instruction_count_null_layer_; 926 RefPtr<column::OverlayLayer> thread_instruction_delta_null_layer_; 927 }; 928 929 930 class ActualFrameTimelineSliceTable : public macros_internal::MacroTable { 931 public: 932 static constexpr uint32_t kColumnCount = 27; 933 934 using Id = SliceTable::Id; 935 936 struct ColumnIndex { 937 static constexpr uint32_t id = 0; 938 static constexpr uint32_t type = 1; 939 static constexpr uint32_t ts = 2; 940 static constexpr uint32_t dur = 3; 941 static constexpr uint32_t track_id = 4; 942 static constexpr uint32_t category = 5; 943 static constexpr uint32_t name = 6; 944 static constexpr uint32_t depth = 7; 945 static constexpr uint32_t stack_id = 8; 946 static constexpr uint32_t parent_stack_id = 9; 947 static constexpr uint32_t parent_id = 10; 948 static constexpr uint32_t arg_set_id = 11; 949 static constexpr uint32_t thread_ts = 12; 950 static constexpr uint32_t thread_dur = 13; 951 static constexpr uint32_t thread_instruction_count = 14; 952 static constexpr uint32_t thread_instruction_delta = 15; 953 static constexpr uint32_t display_frame_token = 16; 954 static constexpr uint32_t surface_frame_token = 17; 955 static constexpr uint32_t upid = 18; 956 static constexpr uint32_t layer_name = 19; 957 static constexpr uint32_t present_type = 20; 958 static constexpr uint32_t on_time_finish = 21; 959 static constexpr uint32_t gpu_composition = 22; 960 static constexpr uint32_t jank_type = 23; 961 static constexpr uint32_t jank_severity_type = 24; 962 static constexpr uint32_t prediction_type = 25; 963 static constexpr uint32_t jank_tag = 26; 964 }; 965 struct ColumnType { 966 using id = IdColumn<ActualFrameTimelineSliceTable::Id>; 967 using type = TypedColumn<StringPool::Id>; 968 using ts = TypedColumn<int64_t>; 969 using dur = TypedColumn<int64_t>; 970 using track_id = TypedColumn<TrackTable::Id>; 971 using category = TypedColumn<std::optional<StringPool::Id>>; 972 using name = TypedColumn<std::optional<StringPool::Id>>; 973 using depth = TypedColumn<uint32_t>; 974 using stack_id = TypedColumn<int64_t>; 975 using parent_stack_id = TypedColumn<int64_t>; 976 using parent_id = TypedColumn<std::optional<ActualFrameTimelineSliceTable::Id>>; 977 using arg_set_id = TypedColumn<uint32_t>; 978 using thread_ts = TypedColumn<std::optional<int64_t>>; 979 using thread_dur = TypedColumn<std::optional<int64_t>>; 980 using thread_instruction_count = TypedColumn<std::optional<int64_t>>; 981 using thread_instruction_delta = TypedColumn<std::optional<int64_t>>; 982 using display_frame_token = TypedColumn<int64_t>; 983 using surface_frame_token = TypedColumn<int64_t>; 984 using upid = TypedColumn<uint32_t>; 985 using layer_name = TypedColumn<StringPool::Id>; 986 using present_type = TypedColumn<StringPool::Id>; 987 using on_time_finish = TypedColumn<int32_t>; 988 using gpu_composition = TypedColumn<int32_t>; 989 using jank_type = TypedColumn<StringPool::Id>; 990 using jank_severity_type = TypedColumn<StringPool::Id>; 991 using prediction_type = TypedColumn<StringPool::Id>; 992 using jank_tag = TypedColumn<StringPool::Id>; 993 }; 994 struct Row : public SliceTable::Row { 995 Row(int64_t in_ts = {}, 996 int64_t in_dur = {}, 997 TrackTable::Id in_track_id = {}, 998 std::optional<StringPool::Id> in_category = {}, 999 std::optional<StringPool::Id> in_name = {}, 1000 uint32_t in_depth = {}, 1001 int64_t in_stack_id = {}, 1002 int64_t in_parent_stack_id = {}, 1003 std::optional<ActualFrameTimelineSliceTable::Id> in_parent_id = {}, 1004 uint32_t in_arg_set_id = {}, 1005 std::optional<int64_t> in_thread_ts = {}, 1006 std::optional<int64_t> in_thread_dur = {}, 1007 std::optional<int64_t> in_thread_instruction_count = {}, 1008 std::optional<int64_t> in_thread_instruction_delta = {}, 1009 int64_t in_display_frame_token = {}, 1010 int64_t in_surface_frame_token = {}, 1011 uint32_t in_upid = {}, 1012 StringPool::Id in_layer_name = {}, 1013 StringPool::Id in_present_type = {}, 1014 int32_t in_on_time_finish = {}, 1015 int32_t in_gpu_composition = {}, 1016 StringPool::Id in_jank_type = {}, 1017 StringPool::Id in_jank_severity_type = {}, 1018 StringPool::Id in_prediction_type = {}, 1019 StringPool::Id in_jank_tag = {}, 1020 std::nullptr_t = nullptr) RowRow1021 : SliceTable::Row(in_ts, in_dur, in_track_id, in_category, in_name, in_depth, in_stack_id, in_parent_stack_id, in_parent_id, in_arg_set_id, in_thread_ts, in_thread_dur, in_thread_instruction_count, in_thread_instruction_delta), 1022 display_frame_token(in_display_frame_token), 1023 surface_frame_token(in_surface_frame_token), 1024 upid(in_upid), 1025 layer_name(in_layer_name), 1026 present_type(in_present_type), 1027 on_time_finish(in_on_time_finish), 1028 gpu_composition(in_gpu_composition), 1029 jank_type(in_jank_type), 1030 jank_severity_type(in_jank_severity_type), 1031 prediction_type(in_prediction_type), 1032 jank_tag(in_jank_tag) { 1033 type_ = "actual_frame_timeline_slice"; 1034 } 1035 int64_t display_frame_token; 1036 int64_t surface_frame_token; 1037 uint32_t upid; 1038 StringPool::Id layer_name; 1039 StringPool::Id present_type; 1040 int32_t on_time_finish; 1041 int32_t gpu_composition; 1042 StringPool::Id jank_type; 1043 StringPool::Id jank_severity_type; 1044 StringPool::Id prediction_type; 1045 StringPool::Id jank_tag; 1046 1047 bool operator==(const ActualFrameTimelineSliceTable::Row& other) const { 1048 return type() == other.type() && ColumnType::ts::Equals(ts, other.ts) && 1049 ColumnType::dur::Equals(dur, other.dur) && 1050 ColumnType::track_id::Equals(track_id, other.track_id) && 1051 ColumnType::category::Equals(category, other.category) && 1052 ColumnType::name::Equals(name, other.name) && 1053 ColumnType::depth::Equals(depth, other.depth) && 1054 ColumnType::stack_id::Equals(stack_id, other.stack_id) && 1055 ColumnType::parent_stack_id::Equals(parent_stack_id, other.parent_stack_id) && 1056 ColumnType::parent_id::Equals(parent_id, other.parent_id) && 1057 ColumnType::arg_set_id::Equals(arg_set_id, other.arg_set_id) && 1058 ColumnType::thread_ts::Equals(thread_ts, other.thread_ts) && 1059 ColumnType::thread_dur::Equals(thread_dur, other.thread_dur) && 1060 ColumnType::thread_instruction_count::Equals(thread_instruction_count, other.thread_instruction_count) && 1061 ColumnType::thread_instruction_delta::Equals(thread_instruction_delta, other.thread_instruction_delta) && 1062 ColumnType::display_frame_token::Equals(display_frame_token, other.display_frame_token) && 1063 ColumnType::surface_frame_token::Equals(surface_frame_token, other.surface_frame_token) && 1064 ColumnType::upid::Equals(upid, other.upid) && 1065 ColumnType::layer_name::Equals(layer_name, other.layer_name) && 1066 ColumnType::present_type::Equals(present_type, other.present_type) && 1067 ColumnType::on_time_finish::Equals(on_time_finish, other.on_time_finish) && 1068 ColumnType::gpu_composition::Equals(gpu_composition, other.gpu_composition) && 1069 ColumnType::jank_type::Equals(jank_type, other.jank_type) && 1070 ColumnType::jank_severity_type::Equals(jank_severity_type, other.jank_severity_type) && 1071 ColumnType::prediction_type::Equals(prediction_type, other.prediction_type) && 1072 ColumnType::jank_tag::Equals(jank_tag, other.jank_tag); 1073 } 1074 }; 1075 struct ColumnFlag { 1076 static constexpr uint32_t display_frame_token = ColumnType::display_frame_token::default_flags(); 1077 static constexpr uint32_t surface_frame_token = ColumnType::surface_frame_token::default_flags(); 1078 static constexpr uint32_t upid = ColumnType::upid::default_flags(); 1079 static constexpr uint32_t layer_name = ColumnType::layer_name::default_flags(); 1080 static constexpr uint32_t present_type = ColumnType::present_type::default_flags(); 1081 static constexpr uint32_t on_time_finish = ColumnType::on_time_finish::default_flags(); 1082 static constexpr uint32_t gpu_composition = ColumnType::gpu_composition::default_flags(); 1083 static constexpr uint32_t jank_type = ColumnType::jank_type::default_flags(); 1084 static constexpr uint32_t jank_severity_type = ColumnType::jank_severity_type::default_flags(); 1085 static constexpr uint32_t prediction_type = ColumnType::prediction_type::default_flags(); 1086 static constexpr uint32_t jank_tag = ColumnType::jank_tag::default_flags(); 1087 }; 1088 1089 class RowNumber; 1090 class ConstRowReference; 1091 class RowReference; 1092 1093 class RowNumber : public macros_internal::AbstractRowNumber< 1094 ActualFrameTimelineSliceTable, ConstRowReference, RowReference> { 1095 public: RowNumber(uint32_t row_number)1096 explicit RowNumber(uint32_t row_number) 1097 : AbstractRowNumber(row_number) {} 1098 }; 1099 static_assert(std::is_trivially_destructible_v<RowNumber>, 1100 "Inheritance used without trivial destruction"); 1101 1102 class ConstRowReference : public macros_internal::AbstractConstRowReference< 1103 ActualFrameTimelineSliceTable, RowNumber> { 1104 public: ConstRowReference(const ActualFrameTimelineSliceTable * table,uint32_t row_number)1105 ConstRowReference(const ActualFrameTimelineSliceTable* table, uint32_t row_number) 1106 : AbstractConstRowReference(table, row_number) {} 1107 id()1108 ColumnType::id::type id() const { 1109 return table()->id()[row_number_]; 1110 } type()1111 ColumnType::type::type type() const { 1112 return table()->type()[row_number_]; 1113 } ts()1114 ColumnType::ts::type ts() const { 1115 return table()->ts()[row_number_]; 1116 } dur()1117 ColumnType::dur::type dur() const { 1118 return table()->dur()[row_number_]; 1119 } track_id()1120 ColumnType::track_id::type track_id() const { 1121 return table()->track_id()[row_number_]; 1122 } category()1123 ColumnType::category::type category() const { 1124 return table()->category()[row_number_]; 1125 } name()1126 ColumnType::name::type name() const { 1127 return table()->name()[row_number_]; 1128 } depth()1129 ColumnType::depth::type depth() const { 1130 return table()->depth()[row_number_]; 1131 } stack_id()1132 ColumnType::stack_id::type stack_id() const { 1133 return table()->stack_id()[row_number_]; 1134 } parent_stack_id()1135 ColumnType::parent_stack_id::type parent_stack_id() const { 1136 return table()->parent_stack_id()[row_number_]; 1137 } parent_id()1138 ColumnType::parent_id::type parent_id() const { 1139 return table()->parent_id()[row_number_]; 1140 } arg_set_id()1141 ColumnType::arg_set_id::type arg_set_id() const { 1142 return table()->arg_set_id()[row_number_]; 1143 } thread_ts()1144 ColumnType::thread_ts::type thread_ts() const { 1145 return table()->thread_ts()[row_number_]; 1146 } thread_dur()1147 ColumnType::thread_dur::type thread_dur() const { 1148 return table()->thread_dur()[row_number_]; 1149 } thread_instruction_count()1150 ColumnType::thread_instruction_count::type thread_instruction_count() const { 1151 return table()->thread_instruction_count()[row_number_]; 1152 } thread_instruction_delta()1153 ColumnType::thread_instruction_delta::type thread_instruction_delta() const { 1154 return table()->thread_instruction_delta()[row_number_]; 1155 } display_frame_token()1156 ColumnType::display_frame_token::type display_frame_token() const { 1157 return table()->display_frame_token()[row_number_]; 1158 } surface_frame_token()1159 ColumnType::surface_frame_token::type surface_frame_token() const { 1160 return table()->surface_frame_token()[row_number_]; 1161 } upid()1162 ColumnType::upid::type upid() const { 1163 return table()->upid()[row_number_]; 1164 } layer_name()1165 ColumnType::layer_name::type layer_name() const { 1166 return table()->layer_name()[row_number_]; 1167 } present_type()1168 ColumnType::present_type::type present_type() const { 1169 return table()->present_type()[row_number_]; 1170 } on_time_finish()1171 ColumnType::on_time_finish::type on_time_finish() const { 1172 return table()->on_time_finish()[row_number_]; 1173 } gpu_composition()1174 ColumnType::gpu_composition::type gpu_composition() const { 1175 return table()->gpu_composition()[row_number_]; 1176 } jank_type()1177 ColumnType::jank_type::type jank_type() const { 1178 return table()->jank_type()[row_number_]; 1179 } jank_severity_type()1180 ColumnType::jank_severity_type::type jank_severity_type() const { 1181 return table()->jank_severity_type()[row_number_]; 1182 } prediction_type()1183 ColumnType::prediction_type::type prediction_type() const { 1184 return table()->prediction_type()[row_number_]; 1185 } jank_tag()1186 ColumnType::jank_tag::type jank_tag() const { 1187 return table()->jank_tag()[row_number_]; 1188 } 1189 }; 1190 static_assert(std::is_trivially_destructible_v<ConstRowReference>, 1191 "Inheritance used without trivial destruction"); 1192 class RowReference : public ConstRowReference { 1193 public: RowReference(const ActualFrameTimelineSliceTable * table,uint32_t row_number)1194 RowReference(const ActualFrameTimelineSliceTable* table, uint32_t row_number) 1195 : ConstRowReference(table, row_number) {} 1196 set_ts(ColumnType::ts::non_optional_type v)1197 void set_ts( 1198 ColumnType::ts::non_optional_type v) { 1199 return mutable_table()->mutable_ts()->Set(row_number_, v); 1200 } set_dur(ColumnType::dur::non_optional_type v)1201 void set_dur( 1202 ColumnType::dur::non_optional_type v) { 1203 return mutable_table()->mutable_dur()->Set(row_number_, v); 1204 } set_track_id(ColumnType::track_id::non_optional_type v)1205 void set_track_id( 1206 ColumnType::track_id::non_optional_type v) { 1207 return mutable_table()->mutable_track_id()->Set(row_number_, v); 1208 } set_category(ColumnType::category::non_optional_type v)1209 void set_category( 1210 ColumnType::category::non_optional_type v) { 1211 return mutable_table()->mutable_category()->Set(row_number_, v); 1212 } set_name(ColumnType::name::non_optional_type v)1213 void set_name( 1214 ColumnType::name::non_optional_type v) { 1215 return mutable_table()->mutable_name()->Set(row_number_, v); 1216 } set_depth(ColumnType::depth::non_optional_type v)1217 void set_depth( 1218 ColumnType::depth::non_optional_type v) { 1219 return mutable_table()->mutable_depth()->Set(row_number_, v); 1220 } set_stack_id(ColumnType::stack_id::non_optional_type v)1221 void set_stack_id( 1222 ColumnType::stack_id::non_optional_type v) { 1223 return mutable_table()->mutable_stack_id()->Set(row_number_, v); 1224 } set_parent_stack_id(ColumnType::parent_stack_id::non_optional_type v)1225 void set_parent_stack_id( 1226 ColumnType::parent_stack_id::non_optional_type v) { 1227 return mutable_table()->mutable_parent_stack_id()->Set(row_number_, v); 1228 } set_parent_id(ColumnType::parent_id::non_optional_type v)1229 void set_parent_id( 1230 ColumnType::parent_id::non_optional_type v) { 1231 return mutable_table()->mutable_parent_id()->Set(row_number_, v); 1232 } set_arg_set_id(ColumnType::arg_set_id::non_optional_type v)1233 void set_arg_set_id( 1234 ColumnType::arg_set_id::non_optional_type v) { 1235 return mutable_table()->mutable_arg_set_id()->Set(row_number_, v); 1236 } set_thread_ts(ColumnType::thread_ts::non_optional_type v)1237 void set_thread_ts( 1238 ColumnType::thread_ts::non_optional_type v) { 1239 return mutable_table()->mutable_thread_ts()->Set(row_number_, v); 1240 } set_thread_dur(ColumnType::thread_dur::non_optional_type v)1241 void set_thread_dur( 1242 ColumnType::thread_dur::non_optional_type v) { 1243 return mutable_table()->mutable_thread_dur()->Set(row_number_, v); 1244 } set_thread_instruction_count(ColumnType::thread_instruction_count::non_optional_type v)1245 void set_thread_instruction_count( 1246 ColumnType::thread_instruction_count::non_optional_type v) { 1247 return mutable_table()->mutable_thread_instruction_count()->Set(row_number_, v); 1248 } set_thread_instruction_delta(ColumnType::thread_instruction_delta::non_optional_type v)1249 void set_thread_instruction_delta( 1250 ColumnType::thread_instruction_delta::non_optional_type v) { 1251 return mutable_table()->mutable_thread_instruction_delta()->Set(row_number_, v); 1252 } set_display_frame_token(ColumnType::display_frame_token::non_optional_type v)1253 void set_display_frame_token( 1254 ColumnType::display_frame_token::non_optional_type v) { 1255 return mutable_table()->mutable_display_frame_token()->Set(row_number_, v); 1256 } set_surface_frame_token(ColumnType::surface_frame_token::non_optional_type v)1257 void set_surface_frame_token( 1258 ColumnType::surface_frame_token::non_optional_type v) { 1259 return mutable_table()->mutable_surface_frame_token()->Set(row_number_, v); 1260 } set_upid(ColumnType::upid::non_optional_type v)1261 void set_upid( 1262 ColumnType::upid::non_optional_type v) { 1263 return mutable_table()->mutable_upid()->Set(row_number_, v); 1264 } set_layer_name(ColumnType::layer_name::non_optional_type v)1265 void set_layer_name( 1266 ColumnType::layer_name::non_optional_type v) { 1267 return mutable_table()->mutable_layer_name()->Set(row_number_, v); 1268 } set_present_type(ColumnType::present_type::non_optional_type v)1269 void set_present_type( 1270 ColumnType::present_type::non_optional_type v) { 1271 return mutable_table()->mutable_present_type()->Set(row_number_, v); 1272 } set_on_time_finish(ColumnType::on_time_finish::non_optional_type v)1273 void set_on_time_finish( 1274 ColumnType::on_time_finish::non_optional_type v) { 1275 return mutable_table()->mutable_on_time_finish()->Set(row_number_, v); 1276 } set_gpu_composition(ColumnType::gpu_composition::non_optional_type v)1277 void set_gpu_composition( 1278 ColumnType::gpu_composition::non_optional_type v) { 1279 return mutable_table()->mutable_gpu_composition()->Set(row_number_, v); 1280 } set_jank_type(ColumnType::jank_type::non_optional_type v)1281 void set_jank_type( 1282 ColumnType::jank_type::non_optional_type v) { 1283 return mutable_table()->mutable_jank_type()->Set(row_number_, v); 1284 } set_jank_severity_type(ColumnType::jank_severity_type::non_optional_type v)1285 void set_jank_severity_type( 1286 ColumnType::jank_severity_type::non_optional_type v) { 1287 return mutable_table()->mutable_jank_severity_type()->Set(row_number_, v); 1288 } set_prediction_type(ColumnType::prediction_type::non_optional_type v)1289 void set_prediction_type( 1290 ColumnType::prediction_type::non_optional_type v) { 1291 return mutable_table()->mutable_prediction_type()->Set(row_number_, v); 1292 } set_jank_tag(ColumnType::jank_tag::non_optional_type v)1293 void set_jank_tag( 1294 ColumnType::jank_tag::non_optional_type v) { 1295 return mutable_table()->mutable_jank_tag()->Set(row_number_, v); 1296 } 1297 1298 private: mutable_table()1299 ActualFrameTimelineSliceTable* mutable_table() const { 1300 return const_cast<ActualFrameTimelineSliceTable*>(table()); 1301 } 1302 }; 1303 static_assert(std::is_trivially_destructible_v<RowReference>, 1304 "Inheritance used without trivial destruction"); 1305 1306 class ConstIterator; 1307 class ConstIterator : public macros_internal::AbstractConstIterator< 1308 ConstIterator, ActualFrameTimelineSliceTable, RowNumber, ConstRowReference> { 1309 public: id()1310 ColumnType::id::type id() const { 1311 const auto& col = table()->id(); 1312 return col.GetAtIdx( 1313 iterator_.StorageIndexForColumn(col.index_in_table())); 1314 } type()1315 ColumnType::type::type type() const { 1316 const auto& col = table()->type(); 1317 return col.GetAtIdx( 1318 iterator_.StorageIndexForColumn(col.index_in_table())); 1319 } ts()1320 ColumnType::ts::type ts() const { 1321 const auto& col = table()->ts(); 1322 return col.GetAtIdx( 1323 iterator_.StorageIndexForColumn(col.index_in_table())); 1324 } dur()1325 ColumnType::dur::type dur() const { 1326 const auto& col = table()->dur(); 1327 return col.GetAtIdx( 1328 iterator_.StorageIndexForColumn(col.index_in_table())); 1329 } track_id()1330 ColumnType::track_id::type track_id() const { 1331 const auto& col = table()->track_id(); 1332 return col.GetAtIdx( 1333 iterator_.StorageIndexForColumn(col.index_in_table())); 1334 } category()1335 ColumnType::category::type category() const { 1336 const auto& col = table()->category(); 1337 return col.GetAtIdx( 1338 iterator_.StorageIndexForColumn(col.index_in_table())); 1339 } name()1340 ColumnType::name::type name() const { 1341 const auto& col = table()->name(); 1342 return col.GetAtIdx( 1343 iterator_.StorageIndexForColumn(col.index_in_table())); 1344 } depth()1345 ColumnType::depth::type depth() const { 1346 const auto& col = table()->depth(); 1347 return col.GetAtIdx( 1348 iterator_.StorageIndexForColumn(col.index_in_table())); 1349 } stack_id()1350 ColumnType::stack_id::type stack_id() const { 1351 const auto& col = table()->stack_id(); 1352 return col.GetAtIdx( 1353 iterator_.StorageIndexForColumn(col.index_in_table())); 1354 } parent_stack_id()1355 ColumnType::parent_stack_id::type parent_stack_id() const { 1356 const auto& col = table()->parent_stack_id(); 1357 return col.GetAtIdx( 1358 iterator_.StorageIndexForColumn(col.index_in_table())); 1359 } parent_id()1360 ColumnType::parent_id::type parent_id() const { 1361 const auto& col = table()->parent_id(); 1362 return col.GetAtIdx( 1363 iterator_.StorageIndexForColumn(col.index_in_table())); 1364 } arg_set_id()1365 ColumnType::arg_set_id::type arg_set_id() const { 1366 const auto& col = table()->arg_set_id(); 1367 return col.GetAtIdx( 1368 iterator_.StorageIndexForColumn(col.index_in_table())); 1369 } thread_ts()1370 ColumnType::thread_ts::type thread_ts() const { 1371 const auto& col = table()->thread_ts(); 1372 return col.GetAtIdx( 1373 iterator_.StorageIndexForColumn(col.index_in_table())); 1374 } thread_dur()1375 ColumnType::thread_dur::type thread_dur() const { 1376 const auto& col = table()->thread_dur(); 1377 return col.GetAtIdx( 1378 iterator_.StorageIndexForColumn(col.index_in_table())); 1379 } thread_instruction_count()1380 ColumnType::thread_instruction_count::type thread_instruction_count() const { 1381 const auto& col = table()->thread_instruction_count(); 1382 return col.GetAtIdx( 1383 iterator_.StorageIndexForColumn(col.index_in_table())); 1384 } thread_instruction_delta()1385 ColumnType::thread_instruction_delta::type thread_instruction_delta() const { 1386 const auto& col = table()->thread_instruction_delta(); 1387 return col.GetAtIdx( 1388 iterator_.StorageIndexForColumn(col.index_in_table())); 1389 } display_frame_token()1390 ColumnType::display_frame_token::type display_frame_token() const { 1391 const auto& col = table()->display_frame_token(); 1392 return col.GetAtIdx( 1393 iterator_.StorageIndexForColumn(col.index_in_table())); 1394 } surface_frame_token()1395 ColumnType::surface_frame_token::type surface_frame_token() const { 1396 const auto& col = table()->surface_frame_token(); 1397 return col.GetAtIdx( 1398 iterator_.StorageIndexForColumn(col.index_in_table())); 1399 } upid()1400 ColumnType::upid::type upid() const { 1401 const auto& col = table()->upid(); 1402 return col.GetAtIdx( 1403 iterator_.StorageIndexForColumn(col.index_in_table())); 1404 } layer_name()1405 ColumnType::layer_name::type layer_name() const { 1406 const auto& col = table()->layer_name(); 1407 return col.GetAtIdx( 1408 iterator_.StorageIndexForColumn(col.index_in_table())); 1409 } present_type()1410 ColumnType::present_type::type present_type() const { 1411 const auto& col = table()->present_type(); 1412 return col.GetAtIdx( 1413 iterator_.StorageIndexForColumn(col.index_in_table())); 1414 } on_time_finish()1415 ColumnType::on_time_finish::type on_time_finish() const { 1416 const auto& col = table()->on_time_finish(); 1417 return col.GetAtIdx( 1418 iterator_.StorageIndexForColumn(col.index_in_table())); 1419 } gpu_composition()1420 ColumnType::gpu_composition::type gpu_composition() const { 1421 const auto& col = table()->gpu_composition(); 1422 return col.GetAtIdx( 1423 iterator_.StorageIndexForColumn(col.index_in_table())); 1424 } jank_type()1425 ColumnType::jank_type::type jank_type() const { 1426 const auto& col = table()->jank_type(); 1427 return col.GetAtIdx( 1428 iterator_.StorageIndexForColumn(col.index_in_table())); 1429 } jank_severity_type()1430 ColumnType::jank_severity_type::type jank_severity_type() const { 1431 const auto& col = table()->jank_severity_type(); 1432 return col.GetAtIdx( 1433 iterator_.StorageIndexForColumn(col.index_in_table())); 1434 } prediction_type()1435 ColumnType::prediction_type::type prediction_type() const { 1436 const auto& col = table()->prediction_type(); 1437 return col.GetAtIdx( 1438 iterator_.StorageIndexForColumn(col.index_in_table())); 1439 } jank_tag()1440 ColumnType::jank_tag::type jank_tag() const { 1441 const auto& col = table()->jank_tag(); 1442 return col.GetAtIdx( 1443 iterator_.StorageIndexForColumn(col.index_in_table())); 1444 } 1445 1446 protected: ConstIterator(const ActualFrameTimelineSliceTable * table,Table::Iterator iterator)1447 explicit ConstIterator(const ActualFrameTimelineSliceTable* table, 1448 Table::Iterator iterator) 1449 : AbstractConstIterator(table, std::move(iterator)) {} 1450 CurrentRowNumber()1451 uint32_t CurrentRowNumber() const { 1452 return iterator_.StorageIndexForLastOverlay(); 1453 } 1454 1455 private: 1456 friend class ActualFrameTimelineSliceTable; 1457 friend class macros_internal::AbstractConstIterator< 1458 ConstIterator, ActualFrameTimelineSliceTable, RowNumber, ConstRowReference>; 1459 }; 1460 class Iterator : public ConstIterator { 1461 public: row_reference()1462 RowReference row_reference() const { 1463 return {const_cast<ActualFrameTimelineSliceTable*>(table()), CurrentRowNumber()}; 1464 } 1465 1466 private: 1467 friend class ActualFrameTimelineSliceTable; 1468 Iterator(ActualFrameTimelineSliceTable * table,Table::Iterator iterator)1469 explicit Iterator(ActualFrameTimelineSliceTable* table, Table::Iterator iterator) 1470 : ConstIterator(table, std::move(iterator)) {} 1471 }; 1472 1473 struct IdAndRow { 1474 Id id; 1475 uint32_t row; 1476 RowReference row_reference; 1477 RowNumber row_number; 1478 }; 1479 GetColumns(ActualFrameTimelineSliceTable * self,const macros_internal::MacroTable * parent)1480 static std::vector<ColumnLegacy> GetColumns( 1481 ActualFrameTimelineSliceTable* self, 1482 const macros_internal::MacroTable* parent) { 1483 std::vector<ColumnLegacy> columns = 1484 CopyColumnsFromParentOrAddRootColumns(self, parent); 1485 uint32_t olay_idx = OverlayCount(parent); 1486 AddColumnToVector(columns, "display_frame_token", &self->display_frame_token_, ColumnFlag::display_frame_token, 1487 static_cast<uint32_t>(columns.size()), olay_idx); 1488 AddColumnToVector(columns, "surface_frame_token", &self->surface_frame_token_, ColumnFlag::surface_frame_token, 1489 static_cast<uint32_t>(columns.size()), olay_idx); 1490 AddColumnToVector(columns, "upid", &self->upid_, ColumnFlag::upid, 1491 static_cast<uint32_t>(columns.size()), olay_idx); 1492 AddColumnToVector(columns, "layer_name", &self->layer_name_, ColumnFlag::layer_name, 1493 static_cast<uint32_t>(columns.size()), olay_idx); 1494 AddColumnToVector(columns, "present_type", &self->present_type_, ColumnFlag::present_type, 1495 static_cast<uint32_t>(columns.size()), olay_idx); 1496 AddColumnToVector(columns, "on_time_finish", &self->on_time_finish_, ColumnFlag::on_time_finish, 1497 static_cast<uint32_t>(columns.size()), olay_idx); 1498 AddColumnToVector(columns, "gpu_composition", &self->gpu_composition_, ColumnFlag::gpu_composition, 1499 static_cast<uint32_t>(columns.size()), olay_idx); 1500 AddColumnToVector(columns, "jank_type", &self->jank_type_, ColumnFlag::jank_type, 1501 static_cast<uint32_t>(columns.size()), olay_idx); 1502 AddColumnToVector(columns, "jank_severity_type", &self->jank_severity_type_, ColumnFlag::jank_severity_type, 1503 static_cast<uint32_t>(columns.size()), olay_idx); 1504 AddColumnToVector(columns, "prediction_type", &self->prediction_type_, ColumnFlag::prediction_type, 1505 static_cast<uint32_t>(columns.size()), olay_idx); 1506 AddColumnToVector(columns, "jank_tag", &self->jank_tag_, ColumnFlag::jank_tag, 1507 static_cast<uint32_t>(columns.size()), olay_idx); 1508 return columns; 1509 } 1510 ActualFrameTimelineSliceTable(StringPool * pool,SliceTable * parent)1511 PERFETTO_NO_INLINE explicit ActualFrameTimelineSliceTable(StringPool* pool, SliceTable* parent) 1512 : macros_internal::MacroTable( 1513 pool, 1514 GetColumns(this, parent), 1515 parent), 1516 parent_(parent), const_parent_(parent), display_frame_token_(ColumnStorage<ColumnType::display_frame_token::stored_type>::Create<false>()), 1517 surface_frame_token_(ColumnStorage<ColumnType::surface_frame_token::stored_type>::Create<false>()), 1518 upid_(ColumnStorage<ColumnType::upid::stored_type>::Create<false>()), 1519 layer_name_(ColumnStorage<ColumnType::layer_name::stored_type>::Create<false>()), 1520 present_type_(ColumnStorage<ColumnType::present_type::stored_type>::Create<false>()), 1521 on_time_finish_(ColumnStorage<ColumnType::on_time_finish::stored_type>::Create<false>()), 1522 gpu_composition_(ColumnStorage<ColumnType::gpu_composition::stored_type>::Create<false>()), 1523 jank_type_(ColumnStorage<ColumnType::jank_type::stored_type>::Create<false>()), 1524 jank_severity_type_(ColumnStorage<ColumnType::jank_severity_type::stored_type>::Create<false>()), 1525 prediction_type_(ColumnStorage<ColumnType::prediction_type::stored_type>::Create<false>()), 1526 jank_tag_(ColumnStorage<ColumnType::jank_tag::stored_type>::Create<false>()) 1527 , 1528 display_frame_token_storage_layer_( 1529 new column::NumericStorage<ColumnType::display_frame_token::non_optional_stored_type>( 1530 &display_frame_token_.vector(), 1531 ColumnTypeHelper<ColumnType::display_frame_token::stored_type>::ToColumnType(), 1532 false)), 1533 surface_frame_token_storage_layer_( 1534 new column::NumericStorage<ColumnType::surface_frame_token::non_optional_stored_type>( 1535 &surface_frame_token_.vector(), 1536 ColumnTypeHelper<ColumnType::surface_frame_token::stored_type>::ToColumnType(), 1537 false)), 1538 upid_storage_layer_( 1539 new column::NumericStorage<ColumnType::upid::non_optional_stored_type>( 1540 &upid_.vector(), 1541 ColumnTypeHelper<ColumnType::upid::stored_type>::ToColumnType(), 1542 false)), 1543 layer_name_storage_layer_( 1544 new column::StringStorage(string_pool(), &layer_name_.vector())), 1545 present_type_storage_layer_( 1546 new column::StringStorage(string_pool(), &present_type_.vector())), 1547 on_time_finish_storage_layer_( 1548 new column::NumericStorage<ColumnType::on_time_finish::non_optional_stored_type>( 1549 &on_time_finish_.vector(), 1550 ColumnTypeHelper<ColumnType::on_time_finish::stored_type>::ToColumnType(), 1551 false)), 1552 gpu_composition_storage_layer_( 1553 new column::NumericStorage<ColumnType::gpu_composition::non_optional_stored_type>( 1554 &gpu_composition_.vector(), 1555 ColumnTypeHelper<ColumnType::gpu_composition::stored_type>::ToColumnType(), 1556 false)), 1557 jank_type_storage_layer_( 1558 new column::StringStorage(string_pool(), &jank_type_.vector())), 1559 jank_severity_type_storage_layer_( 1560 new column::StringStorage(string_pool(), &jank_severity_type_.vector())), 1561 prediction_type_storage_layer_( 1562 new column::StringStorage(string_pool(), &prediction_type_.vector())), 1563 jank_tag_storage_layer_( 1564 new column::StringStorage(string_pool(), &jank_tag_.vector())) 1565 { 1566 static_assert( 1567 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::display_frame_token::stored_type>( 1568 ColumnFlag::display_frame_token), 1569 "Column type and flag combination is not valid"); 1570 static_assert( 1571 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::surface_frame_token::stored_type>( 1572 ColumnFlag::surface_frame_token), 1573 "Column type and flag combination is not valid"); 1574 static_assert( 1575 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::upid::stored_type>( 1576 ColumnFlag::upid), 1577 "Column type and flag combination is not valid"); 1578 static_assert( 1579 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::layer_name::stored_type>( 1580 ColumnFlag::layer_name), 1581 "Column type and flag combination is not valid"); 1582 static_assert( 1583 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::present_type::stored_type>( 1584 ColumnFlag::present_type), 1585 "Column type and flag combination is not valid"); 1586 static_assert( 1587 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::on_time_finish::stored_type>( 1588 ColumnFlag::on_time_finish), 1589 "Column type and flag combination is not valid"); 1590 static_assert( 1591 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::gpu_composition::stored_type>( 1592 ColumnFlag::gpu_composition), 1593 "Column type and flag combination is not valid"); 1594 static_assert( 1595 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::jank_type::stored_type>( 1596 ColumnFlag::jank_type), 1597 "Column type and flag combination is not valid"); 1598 static_assert( 1599 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::jank_severity_type::stored_type>( 1600 ColumnFlag::jank_severity_type), 1601 "Column type and flag combination is not valid"); 1602 static_assert( 1603 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::prediction_type::stored_type>( 1604 ColumnFlag::prediction_type), 1605 "Column type and flag combination is not valid"); 1606 static_assert( 1607 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::jank_tag::stored_type>( 1608 ColumnFlag::jank_tag), 1609 "Column type and flag combination is not valid"); 1610 OnConstructionCompletedRegularConstructor( 1611 {const_parent_->storage_layers()[ColumnIndex::id],const_parent_->storage_layers()[ColumnIndex::type],const_parent_->storage_layers()[ColumnIndex::ts],const_parent_->storage_layers()[ColumnIndex::dur],const_parent_->storage_layers()[ColumnIndex::track_id],const_parent_->storage_layers()[ColumnIndex::category],const_parent_->storage_layers()[ColumnIndex::name],const_parent_->storage_layers()[ColumnIndex::depth],const_parent_->storage_layers()[ColumnIndex::stack_id],const_parent_->storage_layers()[ColumnIndex::parent_stack_id],const_parent_->storage_layers()[ColumnIndex::parent_id],const_parent_->storage_layers()[ColumnIndex::arg_set_id],const_parent_->storage_layers()[ColumnIndex::thread_ts],const_parent_->storage_layers()[ColumnIndex::thread_dur],const_parent_->storage_layers()[ColumnIndex::thread_instruction_count],const_parent_->storage_layers()[ColumnIndex::thread_instruction_delta],display_frame_token_storage_layer_,surface_frame_token_storage_layer_,upid_storage_layer_,layer_name_storage_layer_,present_type_storage_layer_,on_time_finish_storage_layer_,gpu_composition_storage_layer_,jank_type_storage_layer_,jank_severity_type_storage_layer_,prediction_type_storage_layer_,jank_tag_storage_layer_}, 1612 {{},{},{},{},{},{},{},{},{},{},const_parent_->null_layers()[ColumnIndex::parent_id],{},const_parent_->null_layers()[ColumnIndex::thread_ts],const_parent_->null_layers()[ColumnIndex::thread_dur],const_parent_->null_layers()[ColumnIndex::thread_instruction_count],const_parent_->null_layers()[ColumnIndex::thread_instruction_delta],{},{},{},{},{},{},{},{},{},{},{}}); 1613 } 1614 ~ActualFrameTimelineSliceTable() override; 1615 Name()1616 static const char* Name() { return "actual_frame_timeline_slice"; } 1617 ComputeStaticSchema()1618 static Table::Schema ComputeStaticSchema() { 1619 Table::Schema schema; 1620 schema.columns.emplace_back(Table::Schema::Column{ 1621 "id", SqlValue::Type::kLong, true, true, false, false}); 1622 schema.columns.emplace_back(Table::Schema::Column{ 1623 "type", SqlValue::Type::kString, false, false, false, false}); 1624 schema.columns.emplace_back(Table::Schema::Column{ 1625 "ts", ColumnType::ts::SqlValueType(), false, 1626 true, 1627 false, 1628 false}); 1629 schema.columns.emplace_back(Table::Schema::Column{ 1630 "dur", ColumnType::dur::SqlValueType(), false, 1631 false, 1632 false, 1633 false}); 1634 schema.columns.emplace_back(Table::Schema::Column{ 1635 "track_id", ColumnType::track_id::SqlValueType(), false, 1636 false, 1637 false, 1638 false}); 1639 schema.columns.emplace_back(Table::Schema::Column{ 1640 "category", ColumnType::category::SqlValueType(), false, 1641 false, 1642 false, 1643 false}); 1644 schema.columns.emplace_back(Table::Schema::Column{ 1645 "name", ColumnType::name::SqlValueType(), false, 1646 false, 1647 false, 1648 false}); 1649 schema.columns.emplace_back(Table::Schema::Column{ 1650 "depth", ColumnType::depth::SqlValueType(), false, 1651 false, 1652 false, 1653 false}); 1654 schema.columns.emplace_back(Table::Schema::Column{ 1655 "stack_id", ColumnType::stack_id::SqlValueType(), false, 1656 false, 1657 false, 1658 false}); 1659 schema.columns.emplace_back(Table::Schema::Column{ 1660 "parent_stack_id", ColumnType::parent_stack_id::SqlValueType(), false, 1661 false, 1662 false, 1663 false}); 1664 schema.columns.emplace_back(Table::Schema::Column{ 1665 "parent_id", ColumnType::parent_id::SqlValueType(), false, 1666 false, 1667 false, 1668 false}); 1669 schema.columns.emplace_back(Table::Schema::Column{ 1670 "arg_set_id", ColumnType::arg_set_id::SqlValueType(), false, 1671 false, 1672 false, 1673 false}); 1674 schema.columns.emplace_back(Table::Schema::Column{ 1675 "thread_ts", ColumnType::thread_ts::SqlValueType(), false, 1676 false, 1677 false, 1678 false}); 1679 schema.columns.emplace_back(Table::Schema::Column{ 1680 "thread_dur", ColumnType::thread_dur::SqlValueType(), false, 1681 false, 1682 false, 1683 false}); 1684 schema.columns.emplace_back(Table::Schema::Column{ 1685 "thread_instruction_count", ColumnType::thread_instruction_count::SqlValueType(), false, 1686 false, 1687 false, 1688 false}); 1689 schema.columns.emplace_back(Table::Schema::Column{ 1690 "thread_instruction_delta", ColumnType::thread_instruction_delta::SqlValueType(), false, 1691 false, 1692 false, 1693 false}); 1694 schema.columns.emplace_back(Table::Schema::Column{ 1695 "display_frame_token", ColumnType::display_frame_token::SqlValueType(), false, 1696 false, 1697 false, 1698 false}); 1699 schema.columns.emplace_back(Table::Schema::Column{ 1700 "surface_frame_token", ColumnType::surface_frame_token::SqlValueType(), false, 1701 false, 1702 false, 1703 false}); 1704 schema.columns.emplace_back(Table::Schema::Column{ 1705 "upid", ColumnType::upid::SqlValueType(), false, 1706 false, 1707 false, 1708 false}); 1709 schema.columns.emplace_back(Table::Schema::Column{ 1710 "layer_name", ColumnType::layer_name::SqlValueType(), false, 1711 false, 1712 false, 1713 false}); 1714 schema.columns.emplace_back(Table::Schema::Column{ 1715 "present_type", ColumnType::present_type::SqlValueType(), false, 1716 false, 1717 false, 1718 false}); 1719 schema.columns.emplace_back(Table::Schema::Column{ 1720 "on_time_finish", ColumnType::on_time_finish::SqlValueType(), false, 1721 false, 1722 false, 1723 false}); 1724 schema.columns.emplace_back(Table::Schema::Column{ 1725 "gpu_composition", ColumnType::gpu_composition::SqlValueType(), false, 1726 false, 1727 false, 1728 false}); 1729 schema.columns.emplace_back(Table::Schema::Column{ 1730 "jank_type", ColumnType::jank_type::SqlValueType(), false, 1731 false, 1732 false, 1733 false}); 1734 schema.columns.emplace_back(Table::Schema::Column{ 1735 "jank_severity_type", ColumnType::jank_severity_type::SqlValueType(), false, 1736 false, 1737 false, 1738 false}); 1739 schema.columns.emplace_back(Table::Schema::Column{ 1740 "prediction_type", ColumnType::prediction_type::SqlValueType(), false, 1741 false, 1742 false, 1743 false}); 1744 schema.columns.emplace_back(Table::Schema::Column{ 1745 "jank_tag", ColumnType::jank_tag::SqlValueType(), false, 1746 false, 1747 false, 1748 false}); 1749 return schema; 1750 } 1751 IterateRows()1752 ConstIterator IterateRows() const { 1753 return ConstIterator(this, Table::IterateRows()); 1754 } 1755 IterateRows()1756 Iterator IterateRows() { return Iterator(this, Table::IterateRows()); } 1757 FilterToIterator(const Query & q)1758 ConstIterator FilterToIterator(const Query& q) const { 1759 return ConstIterator(this, QueryToIterator(q)); 1760 } 1761 FilterToIterator(const Query & q)1762 Iterator FilterToIterator(const Query& q) { 1763 return Iterator(this, QueryToIterator(q)); 1764 } 1765 ShrinkToFit()1766 void ShrinkToFit() { 1767 display_frame_token_.ShrinkToFit(); 1768 surface_frame_token_.ShrinkToFit(); 1769 upid_.ShrinkToFit(); 1770 layer_name_.ShrinkToFit(); 1771 present_type_.ShrinkToFit(); 1772 on_time_finish_.ShrinkToFit(); 1773 gpu_composition_.ShrinkToFit(); 1774 jank_type_.ShrinkToFit(); 1775 jank_severity_type_.ShrinkToFit(); 1776 prediction_type_.ShrinkToFit(); 1777 jank_tag_.ShrinkToFit(); 1778 } 1779 1780 ConstRowReference operator[](uint32_t r) const { 1781 return ConstRowReference(this, r); 1782 } 1783 RowReference operator[](uint32_t r) { return RowReference(this, r); } 1784 ConstRowReference operator[](RowNumber r) const { 1785 return ConstRowReference(this, r.row_number()); 1786 } 1787 RowReference operator[](RowNumber r) { 1788 return RowReference(this, r.row_number()); 1789 } 1790 FindById(Id find_id)1791 std::optional<ConstRowReference> FindById(Id find_id) const { 1792 std::optional<uint32_t> row = id().IndexOf(find_id); 1793 return row ? std::make_optional(ConstRowReference(this, *row)) 1794 : std::nullopt; 1795 } 1796 FindById(Id find_id)1797 std::optional<RowReference> FindById(Id find_id) { 1798 std::optional<uint32_t> row = id().IndexOf(find_id); 1799 return row ? std::make_optional(RowReference(this, *row)) : std::nullopt; 1800 } 1801 Insert(const Row & row)1802 IdAndRow Insert(const Row& row) { 1803 uint32_t row_number = row_count(); 1804 Id id = Id{parent_->Insert(row).id}; 1805 UpdateOverlaysAfterParentInsert(); 1806 mutable_display_frame_token()->Append(row.display_frame_token); 1807 mutable_surface_frame_token()->Append(row.surface_frame_token); 1808 mutable_upid()->Append(row.upid); 1809 mutable_layer_name()->Append(row.layer_name); 1810 mutable_present_type()->Append(row.present_type); 1811 mutable_on_time_finish()->Append(row.on_time_finish); 1812 mutable_gpu_composition()->Append(row.gpu_composition); 1813 mutable_jank_type()->Append(row.jank_type); 1814 mutable_jank_severity_type()->Append(row.jank_severity_type); 1815 mutable_prediction_type()->Append(row.prediction_type); 1816 mutable_jank_tag()->Append(row.jank_tag); 1817 UpdateSelfOverlayAfterInsert(); 1818 return IdAndRow{id, row_number, RowReference(this, row_number), 1819 RowNumber(row_number)}; 1820 } 1821 ExtendParent(const SliceTable & parent,ColumnStorage<ColumnType::display_frame_token::stored_type> display_frame_token,ColumnStorage<ColumnType::surface_frame_token::stored_type> surface_frame_token,ColumnStorage<ColumnType::upid::stored_type> upid,ColumnStorage<ColumnType::layer_name::stored_type> layer_name,ColumnStorage<ColumnType::present_type::stored_type> present_type,ColumnStorage<ColumnType::on_time_finish::stored_type> on_time_finish,ColumnStorage<ColumnType::gpu_composition::stored_type> gpu_composition,ColumnStorage<ColumnType::jank_type::stored_type> jank_type,ColumnStorage<ColumnType::jank_severity_type::stored_type> jank_severity_type,ColumnStorage<ColumnType::prediction_type::stored_type> prediction_type,ColumnStorage<ColumnType::jank_tag::stored_type> jank_tag)1822 static std::unique_ptr<ActualFrameTimelineSliceTable> ExtendParent( 1823 const SliceTable& parent, 1824 ColumnStorage<ColumnType::display_frame_token::stored_type> display_frame_token 1825 , ColumnStorage<ColumnType::surface_frame_token::stored_type> surface_frame_token 1826 , ColumnStorage<ColumnType::upid::stored_type> upid 1827 , ColumnStorage<ColumnType::layer_name::stored_type> layer_name 1828 , ColumnStorage<ColumnType::present_type::stored_type> present_type 1829 , ColumnStorage<ColumnType::on_time_finish::stored_type> on_time_finish 1830 , ColumnStorage<ColumnType::gpu_composition::stored_type> gpu_composition 1831 , ColumnStorage<ColumnType::jank_type::stored_type> jank_type 1832 , ColumnStorage<ColumnType::jank_severity_type::stored_type> jank_severity_type 1833 , ColumnStorage<ColumnType::prediction_type::stored_type> prediction_type 1834 , ColumnStorage<ColumnType::jank_tag::stored_type> jank_tag) { 1835 return std::unique_ptr<ActualFrameTimelineSliceTable>(new ActualFrameTimelineSliceTable( 1836 parent.string_pool(), parent, RowMap(0, parent.row_count()), 1837 std::move(display_frame_token), std::move(surface_frame_token), std::move(upid), std::move(layer_name), std::move(present_type), std::move(on_time_finish), std::move(gpu_composition), std::move(jank_type), std::move(jank_severity_type), std::move(prediction_type), std::move(jank_tag))); 1838 } 1839 SelectAndExtendParent(const SliceTable & parent,std::vector<SliceTable::RowNumber> parent_overlay,ColumnStorage<ColumnType::display_frame_token::stored_type> display_frame_token,ColumnStorage<ColumnType::surface_frame_token::stored_type> surface_frame_token,ColumnStorage<ColumnType::upid::stored_type> upid,ColumnStorage<ColumnType::layer_name::stored_type> layer_name,ColumnStorage<ColumnType::present_type::stored_type> present_type,ColumnStorage<ColumnType::on_time_finish::stored_type> on_time_finish,ColumnStorage<ColumnType::gpu_composition::stored_type> gpu_composition,ColumnStorage<ColumnType::jank_type::stored_type> jank_type,ColumnStorage<ColumnType::jank_severity_type::stored_type> jank_severity_type,ColumnStorage<ColumnType::prediction_type::stored_type> prediction_type,ColumnStorage<ColumnType::jank_tag::stored_type> jank_tag)1840 static std::unique_ptr<ActualFrameTimelineSliceTable> SelectAndExtendParent( 1841 const SliceTable& parent, 1842 std::vector<SliceTable::RowNumber> parent_overlay, 1843 ColumnStorage<ColumnType::display_frame_token::stored_type> display_frame_token 1844 , ColumnStorage<ColumnType::surface_frame_token::stored_type> surface_frame_token 1845 , ColumnStorage<ColumnType::upid::stored_type> upid 1846 , ColumnStorage<ColumnType::layer_name::stored_type> layer_name 1847 , ColumnStorage<ColumnType::present_type::stored_type> present_type 1848 , ColumnStorage<ColumnType::on_time_finish::stored_type> on_time_finish 1849 , ColumnStorage<ColumnType::gpu_composition::stored_type> gpu_composition 1850 , ColumnStorage<ColumnType::jank_type::stored_type> jank_type 1851 , ColumnStorage<ColumnType::jank_severity_type::stored_type> jank_severity_type 1852 , ColumnStorage<ColumnType::prediction_type::stored_type> prediction_type 1853 , ColumnStorage<ColumnType::jank_tag::stored_type> jank_tag) { 1854 std::vector<uint32_t> prs_untyped(parent_overlay.size()); 1855 for (uint32_t i = 0; i < parent_overlay.size(); ++i) { 1856 prs_untyped[i] = parent_overlay[i].row_number(); 1857 } 1858 return std::unique_ptr<ActualFrameTimelineSliceTable>(new ActualFrameTimelineSliceTable( 1859 parent.string_pool(), parent, RowMap(std::move(prs_untyped)), 1860 std::move(display_frame_token), std::move(surface_frame_token), std::move(upid), std::move(layer_name), std::move(present_type), std::move(on_time_finish), std::move(gpu_composition), std::move(jank_type), std::move(jank_severity_type), std::move(prediction_type), std::move(jank_tag))); 1861 } 1862 id()1863 const IdColumn<ActualFrameTimelineSliceTable::Id>& id() const { 1864 return static_cast<const ColumnType::id&>(columns()[ColumnIndex::id]); 1865 } type()1866 const TypedColumn<StringPool::Id>& type() const { 1867 return static_cast<const ColumnType::type&>(columns()[ColumnIndex::type]); 1868 } ts()1869 const TypedColumn<int64_t>& ts() const { 1870 return static_cast<const ColumnType::ts&>(columns()[ColumnIndex::ts]); 1871 } dur()1872 const TypedColumn<int64_t>& dur() const { 1873 return static_cast<const ColumnType::dur&>(columns()[ColumnIndex::dur]); 1874 } track_id()1875 const TypedColumn<TrackTable::Id>& track_id() const { 1876 return static_cast<const ColumnType::track_id&>(columns()[ColumnIndex::track_id]); 1877 } category()1878 const TypedColumn<std::optional<StringPool::Id>>& category() const { 1879 return static_cast<const ColumnType::category&>(columns()[ColumnIndex::category]); 1880 } name()1881 const TypedColumn<std::optional<StringPool::Id>>& name() const { 1882 return static_cast<const ColumnType::name&>(columns()[ColumnIndex::name]); 1883 } depth()1884 const TypedColumn<uint32_t>& depth() const { 1885 return static_cast<const ColumnType::depth&>(columns()[ColumnIndex::depth]); 1886 } stack_id()1887 const TypedColumn<int64_t>& stack_id() const { 1888 return static_cast<const ColumnType::stack_id&>(columns()[ColumnIndex::stack_id]); 1889 } parent_stack_id()1890 const TypedColumn<int64_t>& parent_stack_id() const { 1891 return static_cast<const ColumnType::parent_stack_id&>(columns()[ColumnIndex::parent_stack_id]); 1892 } parent_id()1893 const TypedColumn<std::optional<ActualFrameTimelineSliceTable::Id>>& parent_id() const { 1894 return static_cast<const ColumnType::parent_id&>(columns()[ColumnIndex::parent_id]); 1895 } arg_set_id()1896 const TypedColumn<uint32_t>& arg_set_id() const { 1897 return static_cast<const ColumnType::arg_set_id&>(columns()[ColumnIndex::arg_set_id]); 1898 } thread_ts()1899 const TypedColumn<std::optional<int64_t>>& thread_ts() const { 1900 return static_cast<const ColumnType::thread_ts&>(columns()[ColumnIndex::thread_ts]); 1901 } thread_dur()1902 const TypedColumn<std::optional<int64_t>>& thread_dur() const { 1903 return static_cast<const ColumnType::thread_dur&>(columns()[ColumnIndex::thread_dur]); 1904 } thread_instruction_count()1905 const TypedColumn<std::optional<int64_t>>& thread_instruction_count() const { 1906 return static_cast<const ColumnType::thread_instruction_count&>(columns()[ColumnIndex::thread_instruction_count]); 1907 } thread_instruction_delta()1908 const TypedColumn<std::optional<int64_t>>& thread_instruction_delta() const { 1909 return static_cast<const ColumnType::thread_instruction_delta&>(columns()[ColumnIndex::thread_instruction_delta]); 1910 } display_frame_token()1911 const TypedColumn<int64_t>& display_frame_token() const { 1912 return static_cast<const ColumnType::display_frame_token&>(columns()[ColumnIndex::display_frame_token]); 1913 } surface_frame_token()1914 const TypedColumn<int64_t>& surface_frame_token() const { 1915 return static_cast<const ColumnType::surface_frame_token&>(columns()[ColumnIndex::surface_frame_token]); 1916 } upid()1917 const TypedColumn<uint32_t>& upid() const { 1918 return static_cast<const ColumnType::upid&>(columns()[ColumnIndex::upid]); 1919 } layer_name()1920 const TypedColumn<StringPool::Id>& layer_name() const { 1921 return static_cast<const ColumnType::layer_name&>(columns()[ColumnIndex::layer_name]); 1922 } present_type()1923 const TypedColumn<StringPool::Id>& present_type() const { 1924 return static_cast<const ColumnType::present_type&>(columns()[ColumnIndex::present_type]); 1925 } on_time_finish()1926 const TypedColumn<int32_t>& on_time_finish() const { 1927 return static_cast<const ColumnType::on_time_finish&>(columns()[ColumnIndex::on_time_finish]); 1928 } gpu_composition()1929 const TypedColumn<int32_t>& gpu_composition() const { 1930 return static_cast<const ColumnType::gpu_composition&>(columns()[ColumnIndex::gpu_composition]); 1931 } jank_type()1932 const TypedColumn<StringPool::Id>& jank_type() const { 1933 return static_cast<const ColumnType::jank_type&>(columns()[ColumnIndex::jank_type]); 1934 } jank_severity_type()1935 const TypedColumn<StringPool::Id>& jank_severity_type() const { 1936 return static_cast<const ColumnType::jank_severity_type&>(columns()[ColumnIndex::jank_severity_type]); 1937 } prediction_type()1938 const TypedColumn<StringPool::Id>& prediction_type() const { 1939 return static_cast<const ColumnType::prediction_type&>(columns()[ColumnIndex::prediction_type]); 1940 } jank_tag()1941 const TypedColumn<StringPool::Id>& jank_tag() const { 1942 return static_cast<const ColumnType::jank_tag&>(columns()[ColumnIndex::jank_tag]); 1943 } 1944 mutable_ts()1945 TypedColumn<int64_t>* mutable_ts() { 1946 return static_cast<ColumnType::ts*>( 1947 GetColumn(ColumnIndex::ts)); 1948 } mutable_dur()1949 TypedColumn<int64_t>* mutable_dur() { 1950 return static_cast<ColumnType::dur*>( 1951 GetColumn(ColumnIndex::dur)); 1952 } mutable_track_id()1953 TypedColumn<TrackTable::Id>* mutable_track_id() { 1954 return static_cast<ColumnType::track_id*>( 1955 GetColumn(ColumnIndex::track_id)); 1956 } mutable_category()1957 TypedColumn<std::optional<StringPool::Id>>* mutable_category() { 1958 return static_cast<ColumnType::category*>( 1959 GetColumn(ColumnIndex::category)); 1960 } mutable_name()1961 TypedColumn<std::optional<StringPool::Id>>* mutable_name() { 1962 return static_cast<ColumnType::name*>( 1963 GetColumn(ColumnIndex::name)); 1964 } mutable_depth()1965 TypedColumn<uint32_t>* mutable_depth() { 1966 return static_cast<ColumnType::depth*>( 1967 GetColumn(ColumnIndex::depth)); 1968 } mutable_stack_id()1969 TypedColumn<int64_t>* mutable_stack_id() { 1970 return static_cast<ColumnType::stack_id*>( 1971 GetColumn(ColumnIndex::stack_id)); 1972 } mutable_parent_stack_id()1973 TypedColumn<int64_t>* mutable_parent_stack_id() { 1974 return static_cast<ColumnType::parent_stack_id*>( 1975 GetColumn(ColumnIndex::parent_stack_id)); 1976 } mutable_parent_id()1977 TypedColumn<std::optional<ActualFrameTimelineSliceTable::Id>>* mutable_parent_id() { 1978 return static_cast<ColumnType::parent_id*>( 1979 GetColumn(ColumnIndex::parent_id)); 1980 } mutable_arg_set_id()1981 TypedColumn<uint32_t>* mutable_arg_set_id() { 1982 return static_cast<ColumnType::arg_set_id*>( 1983 GetColumn(ColumnIndex::arg_set_id)); 1984 } mutable_thread_ts()1985 TypedColumn<std::optional<int64_t>>* mutable_thread_ts() { 1986 return static_cast<ColumnType::thread_ts*>( 1987 GetColumn(ColumnIndex::thread_ts)); 1988 } mutable_thread_dur()1989 TypedColumn<std::optional<int64_t>>* mutable_thread_dur() { 1990 return static_cast<ColumnType::thread_dur*>( 1991 GetColumn(ColumnIndex::thread_dur)); 1992 } mutable_thread_instruction_count()1993 TypedColumn<std::optional<int64_t>>* mutable_thread_instruction_count() { 1994 return static_cast<ColumnType::thread_instruction_count*>( 1995 GetColumn(ColumnIndex::thread_instruction_count)); 1996 } mutable_thread_instruction_delta()1997 TypedColumn<std::optional<int64_t>>* mutable_thread_instruction_delta() { 1998 return static_cast<ColumnType::thread_instruction_delta*>( 1999 GetColumn(ColumnIndex::thread_instruction_delta)); 2000 } mutable_display_frame_token()2001 TypedColumn<int64_t>* mutable_display_frame_token() { 2002 return static_cast<ColumnType::display_frame_token*>( 2003 GetColumn(ColumnIndex::display_frame_token)); 2004 } mutable_surface_frame_token()2005 TypedColumn<int64_t>* mutable_surface_frame_token() { 2006 return static_cast<ColumnType::surface_frame_token*>( 2007 GetColumn(ColumnIndex::surface_frame_token)); 2008 } mutable_upid()2009 TypedColumn<uint32_t>* mutable_upid() { 2010 return static_cast<ColumnType::upid*>( 2011 GetColumn(ColumnIndex::upid)); 2012 } mutable_layer_name()2013 TypedColumn<StringPool::Id>* mutable_layer_name() { 2014 return static_cast<ColumnType::layer_name*>( 2015 GetColumn(ColumnIndex::layer_name)); 2016 } mutable_present_type()2017 TypedColumn<StringPool::Id>* mutable_present_type() { 2018 return static_cast<ColumnType::present_type*>( 2019 GetColumn(ColumnIndex::present_type)); 2020 } mutable_on_time_finish()2021 TypedColumn<int32_t>* mutable_on_time_finish() { 2022 return static_cast<ColumnType::on_time_finish*>( 2023 GetColumn(ColumnIndex::on_time_finish)); 2024 } mutable_gpu_composition()2025 TypedColumn<int32_t>* mutable_gpu_composition() { 2026 return static_cast<ColumnType::gpu_composition*>( 2027 GetColumn(ColumnIndex::gpu_composition)); 2028 } mutable_jank_type()2029 TypedColumn<StringPool::Id>* mutable_jank_type() { 2030 return static_cast<ColumnType::jank_type*>( 2031 GetColumn(ColumnIndex::jank_type)); 2032 } mutable_jank_severity_type()2033 TypedColumn<StringPool::Id>* mutable_jank_severity_type() { 2034 return static_cast<ColumnType::jank_severity_type*>( 2035 GetColumn(ColumnIndex::jank_severity_type)); 2036 } mutable_prediction_type()2037 TypedColumn<StringPool::Id>* mutable_prediction_type() { 2038 return static_cast<ColumnType::prediction_type*>( 2039 GetColumn(ColumnIndex::prediction_type)); 2040 } mutable_jank_tag()2041 TypedColumn<StringPool::Id>* mutable_jank_tag() { 2042 return static_cast<ColumnType::jank_tag*>( 2043 GetColumn(ColumnIndex::jank_tag)); 2044 } 2045 2046 private: ActualFrameTimelineSliceTable(StringPool * pool,const SliceTable & parent,const RowMap & parent_overlay,ColumnStorage<ColumnType::display_frame_token::stored_type> display_frame_token,ColumnStorage<ColumnType::surface_frame_token::stored_type> surface_frame_token,ColumnStorage<ColumnType::upid::stored_type> upid,ColumnStorage<ColumnType::layer_name::stored_type> layer_name,ColumnStorage<ColumnType::present_type::stored_type> present_type,ColumnStorage<ColumnType::on_time_finish::stored_type> on_time_finish,ColumnStorage<ColumnType::gpu_composition::stored_type> gpu_composition,ColumnStorage<ColumnType::jank_type::stored_type> jank_type,ColumnStorage<ColumnType::jank_severity_type::stored_type> jank_severity_type,ColumnStorage<ColumnType::prediction_type::stored_type> prediction_type,ColumnStorage<ColumnType::jank_tag::stored_type> jank_tag)2047 ActualFrameTimelineSliceTable(StringPool* pool, 2048 const SliceTable& parent, 2049 const RowMap& parent_overlay, 2050 ColumnStorage<ColumnType::display_frame_token::stored_type> display_frame_token 2051 , ColumnStorage<ColumnType::surface_frame_token::stored_type> surface_frame_token 2052 , ColumnStorage<ColumnType::upid::stored_type> upid 2053 , ColumnStorage<ColumnType::layer_name::stored_type> layer_name 2054 , ColumnStorage<ColumnType::present_type::stored_type> present_type 2055 , ColumnStorage<ColumnType::on_time_finish::stored_type> on_time_finish 2056 , ColumnStorage<ColumnType::gpu_composition::stored_type> gpu_composition 2057 , ColumnStorage<ColumnType::jank_type::stored_type> jank_type 2058 , ColumnStorage<ColumnType::jank_severity_type::stored_type> jank_severity_type 2059 , ColumnStorage<ColumnType::prediction_type::stored_type> prediction_type 2060 , ColumnStorage<ColumnType::jank_tag::stored_type> jank_tag) 2061 : macros_internal::MacroTable( 2062 pool, 2063 GetColumns(this, &parent), 2064 parent, 2065 parent_overlay), 2066 const_parent_(&parent) 2067 , 2068 display_frame_token_storage_layer_( 2069 new column::NumericStorage<ColumnType::display_frame_token::non_optional_stored_type>( 2070 &display_frame_token_.vector(), 2071 ColumnTypeHelper<ColumnType::display_frame_token::stored_type>::ToColumnType(), 2072 false)), 2073 surface_frame_token_storage_layer_( 2074 new column::NumericStorage<ColumnType::surface_frame_token::non_optional_stored_type>( 2075 &surface_frame_token_.vector(), 2076 ColumnTypeHelper<ColumnType::surface_frame_token::stored_type>::ToColumnType(), 2077 false)), 2078 upid_storage_layer_( 2079 new column::NumericStorage<ColumnType::upid::non_optional_stored_type>( 2080 &upid_.vector(), 2081 ColumnTypeHelper<ColumnType::upid::stored_type>::ToColumnType(), 2082 false)), 2083 layer_name_storage_layer_( 2084 new column::StringStorage(string_pool(), &layer_name_.vector())), 2085 present_type_storage_layer_( 2086 new column::StringStorage(string_pool(), &present_type_.vector())), 2087 on_time_finish_storage_layer_( 2088 new column::NumericStorage<ColumnType::on_time_finish::non_optional_stored_type>( 2089 &on_time_finish_.vector(), 2090 ColumnTypeHelper<ColumnType::on_time_finish::stored_type>::ToColumnType(), 2091 false)), 2092 gpu_composition_storage_layer_( 2093 new column::NumericStorage<ColumnType::gpu_composition::non_optional_stored_type>( 2094 &gpu_composition_.vector(), 2095 ColumnTypeHelper<ColumnType::gpu_composition::stored_type>::ToColumnType(), 2096 false)), 2097 jank_type_storage_layer_( 2098 new column::StringStorage(string_pool(), &jank_type_.vector())), 2099 jank_severity_type_storage_layer_( 2100 new column::StringStorage(string_pool(), &jank_severity_type_.vector())), 2101 prediction_type_storage_layer_( 2102 new column::StringStorage(string_pool(), &prediction_type_.vector())), 2103 jank_tag_storage_layer_( 2104 new column::StringStorage(string_pool(), &jank_tag_.vector())) 2105 { 2106 static_assert( 2107 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::display_frame_token::stored_type>( 2108 ColumnFlag::display_frame_token), 2109 "Column type and flag combination is not valid"); 2110 static_assert( 2111 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::surface_frame_token::stored_type>( 2112 ColumnFlag::surface_frame_token), 2113 "Column type and flag combination is not valid"); 2114 static_assert( 2115 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::upid::stored_type>( 2116 ColumnFlag::upid), 2117 "Column type and flag combination is not valid"); 2118 static_assert( 2119 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::layer_name::stored_type>( 2120 ColumnFlag::layer_name), 2121 "Column type and flag combination is not valid"); 2122 static_assert( 2123 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::present_type::stored_type>( 2124 ColumnFlag::present_type), 2125 "Column type and flag combination is not valid"); 2126 static_assert( 2127 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::on_time_finish::stored_type>( 2128 ColumnFlag::on_time_finish), 2129 "Column type and flag combination is not valid"); 2130 static_assert( 2131 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::gpu_composition::stored_type>( 2132 ColumnFlag::gpu_composition), 2133 "Column type and flag combination is not valid"); 2134 static_assert( 2135 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::jank_type::stored_type>( 2136 ColumnFlag::jank_type), 2137 "Column type and flag combination is not valid"); 2138 static_assert( 2139 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::jank_severity_type::stored_type>( 2140 ColumnFlag::jank_severity_type), 2141 "Column type and flag combination is not valid"); 2142 static_assert( 2143 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::prediction_type::stored_type>( 2144 ColumnFlag::prediction_type), 2145 "Column type and flag combination is not valid"); 2146 static_assert( 2147 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::jank_tag::stored_type>( 2148 ColumnFlag::jank_tag), 2149 "Column type and flag combination is not valid"); 2150 PERFETTO_DCHECK(display_frame_token.size() == parent_overlay.size()); 2151 display_frame_token_ = std::move(display_frame_token); 2152 PERFETTO_DCHECK(surface_frame_token.size() == parent_overlay.size()); 2153 surface_frame_token_ = std::move(surface_frame_token); 2154 PERFETTO_DCHECK(upid.size() == parent_overlay.size()); 2155 upid_ = std::move(upid); 2156 PERFETTO_DCHECK(layer_name.size() == parent_overlay.size()); 2157 layer_name_ = std::move(layer_name); 2158 PERFETTO_DCHECK(present_type.size() == parent_overlay.size()); 2159 present_type_ = std::move(present_type); 2160 PERFETTO_DCHECK(on_time_finish.size() == parent_overlay.size()); 2161 on_time_finish_ = std::move(on_time_finish); 2162 PERFETTO_DCHECK(gpu_composition.size() == parent_overlay.size()); 2163 gpu_composition_ = std::move(gpu_composition); 2164 PERFETTO_DCHECK(jank_type.size() == parent_overlay.size()); 2165 jank_type_ = std::move(jank_type); 2166 PERFETTO_DCHECK(jank_severity_type.size() == parent_overlay.size()); 2167 jank_severity_type_ = std::move(jank_severity_type); 2168 PERFETTO_DCHECK(prediction_type.size() == parent_overlay.size()); 2169 prediction_type_ = std::move(prediction_type); 2170 PERFETTO_DCHECK(jank_tag.size() == parent_overlay.size()); 2171 jank_tag_ = std::move(jank_tag); 2172 2173 std::vector<RefPtr<column::OverlayLayer>> overlay_layers(OverlayCount(&parent) + 1); 2174 for (uint32_t i = 0; i < overlay_layers.size(); ++i) { 2175 if (overlays()[i].row_map().IsIndexVector()) { 2176 overlay_layers[i].reset(new column::ArrangementOverlay( 2177 overlays()[i].row_map().GetIfIndexVector(), 2178 column::DataLayerChain::Indices::State::kNonmonotonic)); 2179 } else if (overlays()[i].row_map().IsBitVector()) { 2180 overlay_layers[i].reset(new column::SelectorOverlay( 2181 overlays()[i].row_map().GetIfBitVector())); 2182 } else if (overlays()[i].row_map().IsRange()) { 2183 overlay_layers[i].reset(new column::RangeOverlay( 2184 overlays()[i].row_map().GetIfIRange())); 2185 } 2186 } 2187 2188 OnConstructionCompleted( 2189 {const_parent_->storage_layers()[ColumnIndex::id],const_parent_->storage_layers()[ColumnIndex::type],const_parent_->storage_layers()[ColumnIndex::ts],const_parent_->storage_layers()[ColumnIndex::dur],const_parent_->storage_layers()[ColumnIndex::track_id],const_parent_->storage_layers()[ColumnIndex::category],const_parent_->storage_layers()[ColumnIndex::name],const_parent_->storage_layers()[ColumnIndex::depth],const_parent_->storage_layers()[ColumnIndex::stack_id],const_parent_->storage_layers()[ColumnIndex::parent_stack_id],const_parent_->storage_layers()[ColumnIndex::parent_id],const_parent_->storage_layers()[ColumnIndex::arg_set_id],const_parent_->storage_layers()[ColumnIndex::thread_ts],const_parent_->storage_layers()[ColumnIndex::thread_dur],const_parent_->storage_layers()[ColumnIndex::thread_instruction_count],const_parent_->storage_layers()[ColumnIndex::thread_instruction_delta],display_frame_token_storage_layer_,surface_frame_token_storage_layer_,upid_storage_layer_,layer_name_storage_layer_,present_type_storage_layer_,on_time_finish_storage_layer_,gpu_composition_storage_layer_,jank_type_storage_layer_,jank_severity_type_storage_layer_,prediction_type_storage_layer_,jank_tag_storage_layer_}, {{},{},{},{},{},{},{},{},{},{},const_parent_->null_layers()[ColumnIndex::parent_id],{},const_parent_->null_layers()[ColumnIndex::thread_ts],const_parent_->null_layers()[ColumnIndex::thread_dur],const_parent_->null_layers()[ColumnIndex::thread_instruction_count],const_parent_->null_layers()[ColumnIndex::thread_instruction_delta],{},{},{},{},{},{},{},{},{},{},{}}, std::move(overlay_layers)); 2190 } 2191 SliceTable* parent_ = nullptr; 2192 const SliceTable* const_parent_ = nullptr; 2193 ColumnStorage<ColumnType::display_frame_token::stored_type> display_frame_token_; 2194 ColumnStorage<ColumnType::surface_frame_token::stored_type> surface_frame_token_; 2195 ColumnStorage<ColumnType::upid::stored_type> upid_; 2196 ColumnStorage<ColumnType::layer_name::stored_type> layer_name_; 2197 ColumnStorage<ColumnType::present_type::stored_type> present_type_; 2198 ColumnStorage<ColumnType::on_time_finish::stored_type> on_time_finish_; 2199 ColumnStorage<ColumnType::gpu_composition::stored_type> gpu_composition_; 2200 ColumnStorage<ColumnType::jank_type::stored_type> jank_type_; 2201 ColumnStorage<ColumnType::jank_severity_type::stored_type> jank_severity_type_; 2202 ColumnStorage<ColumnType::prediction_type::stored_type> prediction_type_; 2203 ColumnStorage<ColumnType::jank_tag::stored_type> jank_tag_; 2204 2205 RefPtr<column::StorageLayer> display_frame_token_storage_layer_; 2206 RefPtr<column::StorageLayer> surface_frame_token_storage_layer_; 2207 RefPtr<column::StorageLayer> upid_storage_layer_; 2208 RefPtr<column::StorageLayer> layer_name_storage_layer_; 2209 RefPtr<column::StorageLayer> present_type_storage_layer_; 2210 RefPtr<column::StorageLayer> on_time_finish_storage_layer_; 2211 RefPtr<column::StorageLayer> gpu_composition_storage_layer_; 2212 RefPtr<column::StorageLayer> jank_type_storage_layer_; 2213 RefPtr<column::StorageLayer> jank_severity_type_storage_layer_; 2214 RefPtr<column::StorageLayer> prediction_type_storage_layer_; 2215 RefPtr<column::StorageLayer> jank_tag_storage_layer_; 2216 2217 2218 }; 2219 2220 2221 class AndroidNetworkPacketsTable : public macros_internal::MacroTable { 2222 public: 2223 static constexpr uint32_t kColumnCount = 30; 2224 2225 using Id = SliceTable::Id; 2226 2227 struct ColumnIndex { 2228 static constexpr uint32_t id = 0; 2229 static constexpr uint32_t type = 1; 2230 static constexpr uint32_t ts = 2; 2231 static constexpr uint32_t dur = 3; 2232 static constexpr uint32_t track_id = 4; 2233 static constexpr uint32_t category = 5; 2234 static constexpr uint32_t name = 6; 2235 static constexpr uint32_t depth = 7; 2236 static constexpr uint32_t stack_id = 8; 2237 static constexpr uint32_t parent_stack_id = 9; 2238 static constexpr uint32_t parent_id = 10; 2239 static constexpr uint32_t arg_set_id = 11; 2240 static constexpr uint32_t thread_ts = 12; 2241 static constexpr uint32_t thread_dur = 13; 2242 static constexpr uint32_t thread_instruction_count = 14; 2243 static constexpr uint32_t thread_instruction_delta = 15; 2244 static constexpr uint32_t iface = 16; 2245 static constexpr uint32_t direction = 17; 2246 static constexpr uint32_t packet_transport = 18; 2247 static constexpr uint32_t packet_length = 19; 2248 static constexpr uint32_t packet_count = 20; 2249 static constexpr uint32_t socket_tag = 21; 2250 static constexpr uint32_t socket_tag_str = 22; 2251 static constexpr uint32_t socket_uid = 23; 2252 static constexpr uint32_t local_port = 24; 2253 static constexpr uint32_t remote_port = 25; 2254 static constexpr uint32_t packet_icmp_type = 26; 2255 static constexpr uint32_t packet_icmp_code = 27; 2256 static constexpr uint32_t packet_tcp_flags = 28; 2257 static constexpr uint32_t packet_tcp_flags_str = 29; 2258 }; 2259 struct ColumnType { 2260 using id = IdColumn<AndroidNetworkPacketsTable::Id>; 2261 using type = TypedColumn<StringPool::Id>; 2262 using ts = TypedColumn<int64_t>; 2263 using dur = TypedColumn<int64_t>; 2264 using track_id = TypedColumn<TrackTable::Id>; 2265 using category = TypedColumn<std::optional<StringPool::Id>>; 2266 using name = TypedColumn<std::optional<StringPool::Id>>; 2267 using depth = TypedColumn<uint32_t>; 2268 using stack_id = TypedColumn<int64_t>; 2269 using parent_stack_id = TypedColumn<int64_t>; 2270 using parent_id = TypedColumn<std::optional<AndroidNetworkPacketsTable::Id>>; 2271 using arg_set_id = TypedColumn<uint32_t>; 2272 using thread_ts = TypedColumn<std::optional<int64_t>>; 2273 using thread_dur = TypedColumn<std::optional<int64_t>>; 2274 using thread_instruction_count = TypedColumn<std::optional<int64_t>>; 2275 using thread_instruction_delta = TypedColumn<std::optional<int64_t>>; 2276 using iface = TypedColumn<StringPool::Id>; 2277 using direction = TypedColumn<StringPool::Id>; 2278 using packet_transport = TypedColumn<StringPool::Id>; 2279 using packet_length = TypedColumn<int64_t>; 2280 using packet_count = TypedColumn<int64_t>; 2281 using socket_tag = TypedColumn<uint32_t>; 2282 using socket_tag_str = TypedColumn<StringPool::Id>; 2283 using socket_uid = TypedColumn<uint32_t>; 2284 using local_port = TypedColumn<std::optional<uint32_t>>; 2285 using remote_port = TypedColumn<std::optional<uint32_t>>; 2286 using packet_icmp_type = TypedColumn<std::optional<uint32_t>>; 2287 using packet_icmp_code = TypedColumn<std::optional<uint32_t>>; 2288 using packet_tcp_flags = TypedColumn<std::optional<uint32_t>>; 2289 using packet_tcp_flags_str = TypedColumn<std::optional<StringPool::Id>>; 2290 }; 2291 struct Row : public SliceTable::Row { 2292 Row(int64_t in_ts = {}, 2293 int64_t in_dur = {}, 2294 TrackTable::Id in_track_id = {}, 2295 std::optional<StringPool::Id> in_category = {}, 2296 std::optional<StringPool::Id> in_name = {}, 2297 uint32_t in_depth = {}, 2298 int64_t in_stack_id = {}, 2299 int64_t in_parent_stack_id = {}, 2300 std::optional<AndroidNetworkPacketsTable::Id> in_parent_id = {}, 2301 uint32_t in_arg_set_id = {}, 2302 std::optional<int64_t> in_thread_ts = {}, 2303 std::optional<int64_t> in_thread_dur = {}, 2304 std::optional<int64_t> in_thread_instruction_count = {}, 2305 std::optional<int64_t> in_thread_instruction_delta = {}, 2306 StringPool::Id in_iface = {}, 2307 StringPool::Id in_direction = {}, 2308 StringPool::Id in_packet_transport = {}, 2309 int64_t in_packet_length = {}, 2310 int64_t in_packet_count = {}, 2311 uint32_t in_socket_tag = {}, 2312 StringPool::Id in_socket_tag_str = {}, 2313 uint32_t in_socket_uid = {}, 2314 std::optional<uint32_t> in_local_port = {}, 2315 std::optional<uint32_t> in_remote_port = {}, 2316 std::optional<uint32_t> in_packet_icmp_type = {}, 2317 std::optional<uint32_t> in_packet_icmp_code = {}, 2318 std::optional<uint32_t> in_packet_tcp_flags = {}, 2319 std::optional<StringPool::Id> in_packet_tcp_flags_str = {}, 2320 std::nullptr_t = nullptr) RowRow2321 : SliceTable::Row(in_ts, in_dur, in_track_id, in_category, in_name, in_depth, in_stack_id, in_parent_stack_id, in_parent_id, in_arg_set_id, in_thread_ts, in_thread_dur, in_thread_instruction_count, in_thread_instruction_delta), 2322 iface(in_iface), 2323 direction(in_direction), 2324 packet_transport(in_packet_transport), 2325 packet_length(in_packet_length), 2326 packet_count(in_packet_count), 2327 socket_tag(in_socket_tag), 2328 socket_tag_str(in_socket_tag_str), 2329 socket_uid(in_socket_uid), 2330 local_port(in_local_port), 2331 remote_port(in_remote_port), 2332 packet_icmp_type(in_packet_icmp_type), 2333 packet_icmp_code(in_packet_icmp_code), 2334 packet_tcp_flags(in_packet_tcp_flags), 2335 packet_tcp_flags_str(in_packet_tcp_flags_str) { 2336 type_ = "__intrinsic_android_network_packets"; 2337 } 2338 StringPool::Id iface; 2339 StringPool::Id direction; 2340 StringPool::Id packet_transport; 2341 int64_t packet_length; 2342 int64_t packet_count; 2343 uint32_t socket_tag; 2344 StringPool::Id socket_tag_str; 2345 uint32_t socket_uid; 2346 std::optional<uint32_t> local_port; 2347 std::optional<uint32_t> remote_port; 2348 std::optional<uint32_t> packet_icmp_type; 2349 std::optional<uint32_t> packet_icmp_code; 2350 std::optional<uint32_t> packet_tcp_flags; 2351 std::optional<StringPool::Id> packet_tcp_flags_str; 2352 2353 bool operator==(const AndroidNetworkPacketsTable::Row& other) const { 2354 return type() == other.type() && ColumnType::ts::Equals(ts, other.ts) && 2355 ColumnType::dur::Equals(dur, other.dur) && 2356 ColumnType::track_id::Equals(track_id, other.track_id) && 2357 ColumnType::category::Equals(category, other.category) && 2358 ColumnType::name::Equals(name, other.name) && 2359 ColumnType::depth::Equals(depth, other.depth) && 2360 ColumnType::stack_id::Equals(stack_id, other.stack_id) && 2361 ColumnType::parent_stack_id::Equals(parent_stack_id, other.parent_stack_id) && 2362 ColumnType::parent_id::Equals(parent_id, other.parent_id) && 2363 ColumnType::arg_set_id::Equals(arg_set_id, other.arg_set_id) && 2364 ColumnType::thread_ts::Equals(thread_ts, other.thread_ts) && 2365 ColumnType::thread_dur::Equals(thread_dur, other.thread_dur) && 2366 ColumnType::thread_instruction_count::Equals(thread_instruction_count, other.thread_instruction_count) && 2367 ColumnType::thread_instruction_delta::Equals(thread_instruction_delta, other.thread_instruction_delta) && 2368 ColumnType::iface::Equals(iface, other.iface) && 2369 ColumnType::direction::Equals(direction, other.direction) && 2370 ColumnType::packet_transport::Equals(packet_transport, other.packet_transport) && 2371 ColumnType::packet_length::Equals(packet_length, other.packet_length) && 2372 ColumnType::packet_count::Equals(packet_count, other.packet_count) && 2373 ColumnType::socket_tag::Equals(socket_tag, other.socket_tag) && 2374 ColumnType::socket_tag_str::Equals(socket_tag_str, other.socket_tag_str) && 2375 ColumnType::socket_uid::Equals(socket_uid, other.socket_uid) && 2376 ColumnType::local_port::Equals(local_port, other.local_port) && 2377 ColumnType::remote_port::Equals(remote_port, other.remote_port) && 2378 ColumnType::packet_icmp_type::Equals(packet_icmp_type, other.packet_icmp_type) && 2379 ColumnType::packet_icmp_code::Equals(packet_icmp_code, other.packet_icmp_code) && 2380 ColumnType::packet_tcp_flags::Equals(packet_tcp_flags, other.packet_tcp_flags) && 2381 ColumnType::packet_tcp_flags_str::Equals(packet_tcp_flags_str, other.packet_tcp_flags_str); 2382 } 2383 }; 2384 struct ColumnFlag { 2385 static constexpr uint32_t iface = ColumnType::iface::default_flags(); 2386 static constexpr uint32_t direction = ColumnType::direction::default_flags(); 2387 static constexpr uint32_t packet_transport = ColumnType::packet_transport::default_flags(); 2388 static constexpr uint32_t packet_length = ColumnType::packet_length::default_flags(); 2389 static constexpr uint32_t packet_count = ColumnType::packet_count::default_flags(); 2390 static constexpr uint32_t socket_tag = ColumnType::socket_tag::default_flags(); 2391 static constexpr uint32_t socket_tag_str = ColumnType::socket_tag_str::default_flags(); 2392 static constexpr uint32_t socket_uid = ColumnType::socket_uid::default_flags(); 2393 static constexpr uint32_t local_port = ColumnType::local_port::default_flags(); 2394 static constexpr uint32_t remote_port = ColumnType::remote_port::default_flags(); 2395 static constexpr uint32_t packet_icmp_type = ColumnType::packet_icmp_type::default_flags(); 2396 static constexpr uint32_t packet_icmp_code = ColumnType::packet_icmp_code::default_flags(); 2397 static constexpr uint32_t packet_tcp_flags = ColumnType::packet_tcp_flags::default_flags(); 2398 static constexpr uint32_t packet_tcp_flags_str = ColumnType::packet_tcp_flags_str::default_flags(); 2399 }; 2400 2401 class RowNumber; 2402 class ConstRowReference; 2403 class RowReference; 2404 2405 class RowNumber : public macros_internal::AbstractRowNumber< 2406 AndroidNetworkPacketsTable, ConstRowReference, RowReference> { 2407 public: RowNumber(uint32_t row_number)2408 explicit RowNumber(uint32_t row_number) 2409 : AbstractRowNumber(row_number) {} 2410 }; 2411 static_assert(std::is_trivially_destructible_v<RowNumber>, 2412 "Inheritance used without trivial destruction"); 2413 2414 class ConstRowReference : public macros_internal::AbstractConstRowReference< 2415 AndroidNetworkPacketsTable, RowNumber> { 2416 public: ConstRowReference(const AndroidNetworkPacketsTable * table,uint32_t row_number)2417 ConstRowReference(const AndroidNetworkPacketsTable* table, uint32_t row_number) 2418 : AbstractConstRowReference(table, row_number) {} 2419 id()2420 ColumnType::id::type id() const { 2421 return table()->id()[row_number_]; 2422 } type()2423 ColumnType::type::type type() const { 2424 return table()->type()[row_number_]; 2425 } ts()2426 ColumnType::ts::type ts() const { 2427 return table()->ts()[row_number_]; 2428 } dur()2429 ColumnType::dur::type dur() const { 2430 return table()->dur()[row_number_]; 2431 } track_id()2432 ColumnType::track_id::type track_id() const { 2433 return table()->track_id()[row_number_]; 2434 } category()2435 ColumnType::category::type category() const { 2436 return table()->category()[row_number_]; 2437 } name()2438 ColumnType::name::type name() const { 2439 return table()->name()[row_number_]; 2440 } depth()2441 ColumnType::depth::type depth() const { 2442 return table()->depth()[row_number_]; 2443 } stack_id()2444 ColumnType::stack_id::type stack_id() const { 2445 return table()->stack_id()[row_number_]; 2446 } parent_stack_id()2447 ColumnType::parent_stack_id::type parent_stack_id() const { 2448 return table()->parent_stack_id()[row_number_]; 2449 } parent_id()2450 ColumnType::parent_id::type parent_id() const { 2451 return table()->parent_id()[row_number_]; 2452 } arg_set_id()2453 ColumnType::arg_set_id::type arg_set_id() const { 2454 return table()->arg_set_id()[row_number_]; 2455 } thread_ts()2456 ColumnType::thread_ts::type thread_ts() const { 2457 return table()->thread_ts()[row_number_]; 2458 } thread_dur()2459 ColumnType::thread_dur::type thread_dur() const { 2460 return table()->thread_dur()[row_number_]; 2461 } thread_instruction_count()2462 ColumnType::thread_instruction_count::type thread_instruction_count() const { 2463 return table()->thread_instruction_count()[row_number_]; 2464 } thread_instruction_delta()2465 ColumnType::thread_instruction_delta::type thread_instruction_delta() const { 2466 return table()->thread_instruction_delta()[row_number_]; 2467 } iface()2468 ColumnType::iface::type iface() const { 2469 return table()->iface()[row_number_]; 2470 } direction()2471 ColumnType::direction::type direction() const { 2472 return table()->direction()[row_number_]; 2473 } packet_transport()2474 ColumnType::packet_transport::type packet_transport() const { 2475 return table()->packet_transport()[row_number_]; 2476 } packet_length()2477 ColumnType::packet_length::type packet_length() const { 2478 return table()->packet_length()[row_number_]; 2479 } packet_count()2480 ColumnType::packet_count::type packet_count() const { 2481 return table()->packet_count()[row_number_]; 2482 } socket_tag()2483 ColumnType::socket_tag::type socket_tag() const { 2484 return table()->socket_tag()[row_number_]; 2485 } socket_tag_str()2486 ColumnType::socket_tag_str::type socket_tag_str() const { 2487 return table()->socket_tag_str()[row_number_]; 2488 } socket_uid()2489 ColumnType::socket_uid::type socket_uid() const { 2490 return table()->socket_uid()[row_number_]; 2491 } local_port()2492 ColumnType::local_port::type local_port() const { 2493 return table()->local_port()[row_number_]; 2494 } remote_port()2495 ColumnType::remote_port::type remote_port() const { 2496 return table()->remote_port()[row_number_]; 2497 } packet_icmp_type()2498 ColumnType::packet_icmp_type::type packet_icmp_type() const { 2499 return table()->packet_icmp_type()[row_number_]; 2500 } packet_icmp_code()2501 ColumnType::packet_icmp_code::type packet_icmp_code() const { 2502 return table()->packet_icmp_code()[row_number_]; 2503 } packet_tcp_flags()2504 ColumnType::packet_tcp_flags::type packet_tcp_flags() const { 2505 return table()->packet_tcp_flags()[row_number_]; 2506 } packet_tcp_flags_str()2507 ColumnType::packet_tcp_flags_str::type packet_tcp_flags_str() const { 2508 return table()->packet_tcp_flags_str()[row_number_]; 2509 } 2510 }; 2511 static_assert(std::is_trivially_destructible_v<ConstRowReference>, 2512 "Inheritance used without trivial destruction"); 2513 class RowReference : public ConstRowReference { 2514 public: RowReference(const AndroidNetworkPacketsTable * table,uint32_t row_number)2515 RowReference(const AndroidNetworkPacketsTable* table, uint32_t row_number) 2516 : ConstRowReference(table, row_number) {} 2517 set_ts(ColumnType::ts::non_optional_type v)2518 void set_ts( 2519 ColumnType::ts::non_optional_type v) { 2520 return mutable_table()->mutable_ts()->Set(row_number_, v); 2521 } set_dur(ColumnType::dur::non_optional_type v)2522 void set_dur( 2523 ColumnType::dur::non_optional_type v) { 2524 return mutable_table()->mutable_dur()->Set(row_number_, v); 2525 } set_track_id(ColumnType::track_id::non_optional_type v)2526 void set_track_id( 2527 ColumnType::track_id::non_optional_type v) { 2528 return mutable_table()->mutable_track_id()->Set(row_number_, v); 2529 } set_category(ColumnType::category::non_optional_type v)2530 void set_category( 2531 ColumnType::category::non_optional_type v) { 2532 return mutable_table()->mutable_category()->Set(row_number_, v); 2533 } set_name(ColumnType::name::non_optional_type v)2534 void set_name( 2535 ColumnType::name::non_optional_type v) { 2536 return mutable_table()->mutable_name()->Set(row_number_, v); 2537 } set_depth(ColumnType::depth::non_optional_type v)2538 void set_depth( 2539 ColumnType::depth::non_optional_type v) { 2540 return mutable_table()->mutable_depth()->Set(row_number_, v); 2541 } set_stack_id(ColumnType::stack_id::non_optional_type v)2542 void set_stack_id( 2543 ColumnType::stack_id::non_optional_type v) { 2544 return mutable_table()->mutable_stack_id()->Set(row_number_, v); 2545 } set_parent_stack_id(ColumnType::parent_stack_id::non_optional_type v)2546 void set_parent_stack_id( 2547 ColumnType::parent_stack_id::non_optional_type v) { 2548 return mutable_table()->mutable_parent_stack_id()->Set(row_number_, v); 2549 } set_parent_id(ColumnType::parent_id::non_optional_type v)2550 void set_parent_id( 2551 ColumnType::parent_id::non_optional_type v) { 2552 return mutable_table()->mutable_parent_id()->Set(row_number_, v); 2553 } set_arg_set_id(ColumnType::arg_set_id::non_optional_type v)2554 void set_arg_set_id( 2555 ColumnType::arg_set_id::non_optional_type v) { 2556 return mutable_table()->mutable_arg_set_id()->Set(row_number_, v); 2557 } set_thread_ts(ColumnType::thread_ts::non_optional_type v)2558 void set_thread_ts( 2559 ColumnType::thread_ts::non_optional_type v) { 2560 return mutable_table()->mutable_thread_ts()->Set(row_number_, v); 2561 } set_thread_dur(ColumnType::thread_dur::non_optional_type v)2562 void set_thread_dur( 2563 ColumnType::thread_dur::non_optional_type v) { 2564 return mutable_table()->mutable_thread_dur()->Set(row_number_, v); 2565 } set_thread_instruction_count(ColumnType::thread_instruction_count::non_optional_type v)2566 void set_thread_instruction_count( 2567 ColumnType::thread_instruction_count::non_optional_type v) { 2568 return mutable_table()->mutable_thread_instruction_count()->Set(row_number_, v); 2569 } set_thread_instruction_delta(ColumnType::thread_instruction_delta::non_optional_type v)2570 void set_thread_instruction_delta( 2571 ColumnType::thread_instruction_delta::non_optional_type v) { 2572 return mutable_table()->mutable_thread_instruction_delta()->Set(row_number_, v); 2573 } set_iface(ColumnType::iface::non_optional_type v)2574 void set_iface( 2575 ColumnType::iface::non_optional_type v) { 2576 return mutable_table()->mutable_iface()->Set(row_number_, v); 2577 } set_direction(ColumnType::direction::non_optional_type v)2578 void set_direction( 2579 ColumnType::direction::non_optional_type v) { 2580 return mutable_table()->mutable_direction()->Set(row_number_, v); 2581 } set_packet_transport(ColumnType::packet_transport::non_optional_type v)2582 void set_packet_transport( 2583 ColumnType::packet_transport::non_optional_type v) { 2584 return mutable_table()->mutable_packet_transport()->Set(row_number_, v); 2585 } set_packet_length(ColumnType::packet_length::non_optional_type v)2586 void set_packet_length( 2587 ColumnType::packet_length::non_optional_type v) { 2588 return mutable_table()->mutable_packet_length()->Set(row_number_, v); 2589 } set_packet_count(ColumnType::packet_count::non_optional_type v)2590 void set_packet_count( 2591 ColumnType::packet_count::non_optional_type v) { 2592 return mutable_table()->mutable_packet_count()->Set(row_number_, v); 2593 } set_socket_tag(ColumnType::socket_tag::non_optional_type v)2594 void set_socket_tag( 2595 ColumnType::socket_tag::non_optional_type v) { 2596 return mutable_table()->mutable_socket_tag()->Set(row_number_, v); 2597 } set_socket_tag_str(ColumnType::socket_tag_str::non_optional_type v)2598 void set_socket_tag_str( 2599 ColumnType::socket_tag_str::non_optional_type v) { 2600 return mutable_table()->mutable_socket_tag_str()->Set(row_number_, v); 2601 } set_socket_uid(ColumnType::socket_uid::non_optional_type v)2602 void set_socket_uid( 2603 ColumnType::socket_uid::non_optional_type v) { 2604 return mutable_table()->mutable_socket_uid()->Set(row_number_, v); 2605 } set_local_port(ColumnType::local_port::non_optional_type v)2606 void set_local_port( 2607 ColumnType::local_port::non_optional_type v) { 2608 return mutable_table()->mutable_local_port()->Set(row_number_, v); 2609 } set_remote_port(ColumnType::remote_port::non_optional_type v)2610