1 #ifndef SRC_TRACE_PROCESSOR_TABLES_MEMORY_TABLES_PY_H_ 2 #define SRC_TRACE_PROCESSOR_TABLES_MEMORY_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 MemorySnapshotTable : public macros_internal::MacroTable { 42 public: 43 static constexpr uint32_t kColumnCount = 5; 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 timestamp = 2; 56 static constexpr uint32_t track_id = 3; 57 static constexpr uint32_t detail_level = 4; 58 }; 59 struct ColumnType { 60 using id = IdColumn<MemorySnapshotTable::Id>; 61 using type = TypedColumn<StringPool::Id>; 62 using timestamp = TypedColumn<int64_t>; 63 using track_id = TypedColumn<TrackTable::Id>; 64 using detail_level = TypedColumn<StringPool::Id>; 65 }; 66 struct Row : public macros_internal::RootParentTable::Row { 67 Row(int64_t in_timestamp = {}, 68 TrackTable::Id in_track_id = {}, 69 StringPool::Id in_detail_level = {}, 70 std::nullptr_t = nullptr) RowRow71 : macros_internal::RootParentTable::Row(), 72 timestamp(in_timestamp), 73 track_id(in_track_id), 74 detail_level(in_detail_level) { 75 type_ = "memory_snapshot"; 76 } 77 int64_t timestamp; 78 TrackTable::Id track_id; 79 StringPool::Id detail_level; 80 81 bool operator==(const MemorySnapshotTable::Row& other) const { 82 return type() == other.type() && ColumnType::timestamp::Equals(timestamp, other.timestamp) && 83 ColumnType::track_id::Equals(track_id, other.track_id) && 84 ColumnType::detail_level::Equals(detail_level, other.detail_level); 85 } 86 }; 87 struct ColumnFlag { 88 static constexpr uint32_t timestamp = ColumnType::timestamp::default_flags(); 89 static constexpr uint32_t track_id = ColumnType::track_id::default_flags(); 90 static constexpr uint32_t detail_level = ColumnType::detail_level::default_flags(); 91 }; 92 93 class RowNumber; 94 class ConstRowReference; 95 class RowReference; 96 97 class RowNumber : public macros_internal::AbstractRowNumber< 98 MemorySnapshotTable, ConstRowReference, RowReference> { 99 public: RowNumber(uint32_t row_number)100 explicit RowNumber(uint32_t row_number) 101 : AbstractRowNumber(row_number) {} 102 }; 103 static_assert(std::is_trivially_destructible_v<RowNumber>, 104 "Inheritance used without trivial destruction"); 105 106 class ConstRowReference : public macros_internal::AbstractConstRowReference< 107 MemorySnapshotTable, RowNumber> { 108 public: ConstRowReference(const MemorySnapshotTable * table,uint32_t row_number)109 ConstRowReference(const MemorySnapshotTable* table, uint32_t row_number) 110 : AbstractConstRowReference(table, row_number) {} 111 id()112 ColumnType::id::type id() const { 113 return table()->id()[row_number_]; 114 } type()115 ColumnType::type::type type() const { 116 return table()->type()[row_number_]; 117 } timestamp()118 ColumnType::timestamp::type timestamp() const { 119 return table()->timestamp()[row_number_]; 120 } track_id()121 ColumnType::track_id::type track_id() const { 122 return table()->track_id()[row_number_]; 123 } detail_level()124 ColumnType::detail_level::type detail_level() const { 125 return table()->detail_level()[row_number_]; 126 } 127 }; 128 static_assert(std::is_trivially_destructible_v<ConstRowReference>, 129 "Inheritance used without trivial destruction"); 130 class RowReference : public ConstRowReference { 131 public: RowReference(const MemorySnapshotTable * table,uint32_t row_number)132 RowReference(const MemorySnapshotTable* table, uint32_t row_number) 133 : ConstRowReference(table, row_number) {} 134 set_timestamp(ColumnType::timestamp::non_optional_type v)135 void set_timestamp( 136 ColumnType::timestamp::non_optional_type v) { 137 return mutable_table()->mutable_timestamp()->Set(row_number_, v); 138 } set_track_id(ColumnType::track_id::non_optional_type v)139 void set_track_id( 140 ColumnType::track_id::non_optional_type v) { 141 return mutable_table()->mutable_track_id()->Set(row_number_, v); 142 } set_detail_level(ColumnType::detail_level::non_optional_type v)143 void set_detail_level( 144 ColumnType::detail_level::non_optional_type v) { 145 return mutable_table()->mutable_detail_level()->Set(row_number_, v); 146 } 147 148 private: mutable_table()149 MemorySnapshotTable* mutable_table() const { 150 return const_cast<MemorySnapshotTable*>(table()); 151 } 152 }; 153 static_assert(std::is_trivially_destructible_v<RowReference>, 154 "Inheritance used without trivial destruction"); 155 156 class ConstIterator; 157 class ConstIterator : public macros_internal::AbstractConstIterator< 158 ConstIterator, MemorySnapshotTable, RowNumber, ConstRowReference> { 159 public: id()160 ColumnType::id::type id() const { 161 const auto& col = table()->id(); 162 return col.GetAtIdx( 163 iterator_.StorageIndexForColumn(col.index_in_table())); 164 } type()165 ColumnType::type::type type() const { 166 const auto& col = table()->type(); 167 return col.GetAtIdx( 168 iterator_.StorageIndexForColumn(col.index_in_table())); 169 } timestamp()170 ColumnType::timestamp::type timestamp() const { 171 const auto& col = table()->timestamp(); 172 return col.GetAtIdx( 173 iterator_.StorageIndexForColumn(col.index_in_table())); 174 } track_id()175 ColumnType::track_id::type track_id() const { 176 const auto& col = table()->track_id(); 177 return col.GetAtIdx( 178 iterator_.StorageIndexForColumn(col.index_in_table())); 179 } detail_level()180 ColumnType::detail_level::type detail_level() const { 181 const auto& col = table()->detail_level(); 182 return col.GetAtIdx( 183 iterator_.StorageIndexForColumn(col.index_in_table())); 184 } 185 186 protected: ConstIterator(const MemorySnapshotTable * table,Table::Iterator iterator)187 explicit ConstIterator(const MemorySnapshotTable* table, 188 Table::Iterator iterator) 189 : AbstractConstIterator(table, std::move(iterator)) {} 190 CurrentRowNumber()191 uint32_t CurrentRowNumber() const { 192 return iterator_.StorageIndexForLastOverlay(); 193 } 194 195 private: 196 friend class MemorySnapshotTable; 197 friend class macros_internal::AbstractConstIterator< 198 ConstIterator, MemorySnapshotTable, RowNumber, ConstRowReference>; 199 }; 200 class Iterator : public ConstIterator { 201 public: row_reference()202 RowReference row_reference() const { 203 return {const_cast<MemorySnapshotTable*>(table()), CurrentRowNumber()}; 204 } 205 206 private: 207 friend class MemorySnapshotTable; 208 Iterator(MemorySnapshotTable * table,Table::Iterator iterator)209 explicit Iterator(MemorySnapshotTable* table, Table::Iterator iterator) 210 : ConstIterator(table, std::move(iterator)) {} 211 }; 212 213 struct IdAndRow { 214 Id id; 215 uint32_t row; 216 RowReference row_reference; 217 RowNumber row_number; 218 }; 219 GetColumns(MemorySnapshotTable * self,const macros_internal::MacroTable * parent)220 static std::vector<ColumnLegacy> GetColumns( 221 MemorySnapshotTable* self, 222 const macros_internal::MacroTable* parent) { 223 std::vector<ColumnLegacy> columns = 224 CopyColumnsFromParentOrAddRootColumns(self, parent); 225 uint32_t olay_idx = OverlayCount(parent); 226 AddColumnToVector(columns, "timestamp", &self->timestamp_, ColumnFlag::timestamp, 227 static_cast<uint32_t>(columns.size()), olay_idx); 228 AddColumnToVector(columns, "track_id", &self->track_id_, ColumnFlag::track_id, 229 static_cast<uint32_t>(columns.size()), olay_idx); 230 AddColumnToVector(columns, "detail_level", &self->detail_level_, ColumnFlag::detail_level, 231 static_cast<uint32_t>(columns.size()), olay_idx); 232 return columns; 233 } 234 MemorySnapshotTable(StringPool * pool)235 PERFETTO_NO_INLINE explicit MemorySnapshotTable(StringPool* pool) 236 : macros_internal::MacroTable( 237 pool, 238 GetColumns(this, nullptr), 239 nullptr), 240 timestamp_(ColumnStorage<ColumnType::timestamp::stored_type>::Create<false>()), 241 track_id_(ColumnStorage<ColumnType::track_id::stored_type>::Create<false>()), 242 detail_level_(ColumnStorage<ColumnType::detail_level::stored_type>::Create<false>()) 243 , 244 id_storage_layer_(new column::IdStorage()), 245 type_storage_layer_( 246 new column::StringStorage(string_pool(), &type_.vector())), 247 timestamp_storage_layer_( 248 new column::NumericStorage<ColumnType::timestamp::non_optional_stored_type>( 249 ×tamp_.vector(), 250 ColumnTypeHelper<ColumnType::timestamp::stored_type>::ToColumnType(), 251 false)), 252 track_id_storage_layer_( 253 new column::NumericStorage<ColumnType::track_id::non_optional_stored_type>( 254 &track_id_.vector(), 255 ColumnTypeHelper<ColumnType::track_id::stored_type>::ToColumnType(), 256 false)), 257 detail_level_storage_layer_( 258 new column::StringStorage(string_pool(), &detail_level_.vector())) 259 { 260 static_assert( 261 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::timestamp::stored_type>( 262 ColumnFlag::timestamp), 263 "Column type and flag combination is not valid"); 264 static_assert( 265 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::track_id::stored_type>( 266 ColumnFlag::track_id), 267 "Column type and flag combination is not valid"); 268 static_assert( 269 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::detail_level::stored_type>( 270 ColumnFlag::detail_level), 271 "Column type and flag combination is not valid"); 272 OnConstructionCompletedRegularConstructor( 273 {id_storage_layer_,type_storage_layer_,timestamp_storage_layer_,track_id_storage_layer_,detail_level_storage_layer_}, 274 {{},{},{},{},{}}); 275 } 276 ~MemorySnapshotTable() override; 277 Name()278 static const char* Name() { return "memory_snapshot"; } 279 ComputeStaticSchema()280 static Table::Schema ComputeStaticSchema() { 281 Table::Schema schema; 282 schema.columns.emplace_back(Table::Schema::Column{ 283 "id", SqlValue::Type::kLong, true, true, false, false}); 284 schema.columns.emplace_back(Table::Schema::Column{ 285 "type", SqlValue::Type::kString, false, false, false, false}); 286 schema.columns.emplace_back(Table::Schema::Column{ 287 "timestamp", ColumnType::timestamp::SqlValueType(), false, 288 false, 289 false, 290 false}); 291 schema.columns.emplace_back(Table::Schema::Column{ 292 "track_id", ColumnType::track_id::SqlValueType(), false, 293 false, 294 false, 295 false}); 296 schema.columns.emplace_back(Table::Schema::Column{ 297 "detail_level", ColumnType::detail_level::SqlValueType(), false, 298 false, 299 false, 300 false}); 301 return schema; 302 } 303 IterateRows()304 ConstIterator IterateRows() const { 305 return ConstIterator(this, Table::IterateRows()); 306 } 307 IterateRows()308 Iterator IterateRows() { return Iterator(this, Table::IterateRows()); } 309 FilterToIterator(const Query & q)310 ConstIterator FilterToIterator(const Query& q) const { 311 return ConstIterator(this, QueryToIterator(q)); 312 } 313 FilterToIterator(const Query & q)314 Iterator FilterToIterator(const Query& q) { 315 return Iterator(this, QueryToIterator(q)); 316 } 317 ShrinkToFit()318 void ShrinkToFit() { 319 type_.ShrinkToFit(); 320 timestamp_.ShrinkToFit(); 321 track_id_.ShrinkToFit(); 322 detail_level_.ShrinkToFit(); 323 } 324 325 ConstRowReference operator[](uint32_t r) const { 326 return ConstRowReference(this, r); 327 } 328 RowReference operator[](uint32_t r) { return RowReference(this, r); } 329 ConstRowReference operator[](RowNumber r) const { 330 return ConstRowReference(this, r.row_number()); 331 } 332 RowReference operator[](RowNumber r) { 333 return RowReference(this, r.row_number()); 334 } 335 FindById(Id find_id)336 std::optional<ConstRowReference> FindById(Id find_id) const { 337 std::optional<uint32_t> row = id().IndexOf(find_id); 338 return row ? std::make_optional(ConstRowReference(this, *row)) 339 : std::nullopt; 340 } 341 FindById(Id find_id)342 std::optional<RowReference> FindById(Id find_id) { 343 std::optional<uint32_t> row = id().IndexOf(find_id); 344 return row ? std::make_optional(RowReference(this, *row)) : std::nullopt; 345 } 346 Insert(const Row & row)347 IdAndRow Insert(const Row& row) { 348 uint32_t row_number = row_count(); 349 Id id = Id{row_number}; 350 type_.Append(string_pool()->InternString(row.type())); 351 mutable_timestamp()->Append(row.timestamp); 352 mutable_track_id()->Append(row.track_id); 353 mutable_detail_level()->Append(row.detail_level); 354 UpdateSelfOverlayAfterInsert(); 355 return IdAndRow{id, row_number, RowReference(this, row_number), 356 RowNumber(row_number)}; 357 } 358 359 360 id()361 const IdColumn<MemorySnapshotTable::Id>& id() const { 362 return static_cast<const ColumnType::id&>(columns()[ColumnIndex::id]); 363 } type()364 const TypedColumn<StringPool::Id>& type() const { 365 return static_cast<const ColumnType::type&>(columns()[ColumnIndex::type]); 366 } timestamp()367 const TypedColumn<int64_t>& timestamp() const { 368 return static_cast<const ColumnType::timestamp&>(columns()[ColumnIndex::timestamp]); 369 } track_id()370 const TypedColumn<TrackTable::Id>& track_id() const { 371 return static_cast<const ColumnType::track_id&>(columns()[ColumnIndex::track_id]); 372 } detail_level()373 const TypedColumn<StringPool::Id>& detail_level() const { 374 return static_cast<const ColumnType::detail_level&>(columns()[ColumnIndex::detail_level]); 375 } 376 mutable_timestamp()377 TypedColumn<int64_t>* mutable_timestamp() { 378 return static_cast<ColumnType::timestamp*>( 379 GetColumn(ColumnIndex::timestamp)); 380 } mutable_track_id()381 TypedColumn<TrackTable::Id>* mutable_track_id() { 382 return static_cast<ColumnType::track_id*>( 383 GetColumn(ColumnIndex::track_id)); 384 } mutable_detail_level()385 TypedColumn<StringPool::Id>* mutable_detail_level() { 386 return static_cast<ColumnType::detail_level*>( 387 GetColumn(ColumnIndex::detail_level)); 388 } 389 390 private: 391 392 393 ColumnStorage<ColumnType::timestamp::stored_type> timestamp_; 394 ColumnStorage<ColumnType::track_id::stored_type> track_id_; 395 ColumnStorage<ColumnType::detail_level::stored_type> detail_level_; 396 397 RefPtr<column::StorageLayer> id_storage_layer_; 398 RefPtr<column::StorageLayer> type_storage_layer_; 399 RefPtr<column::StorageLayer> timestamp_storage_layer_; 400 RefPtr<column::StorageLayer> track_id_storage_layer_; 401 RefPtr<column::StorageLayer> detail_level_storage_layer_; 402 403 404 }; 405 406 407 class ProcessMemorySnapshotTable : public macros_internal::MacroTable { 408 public: 409 static constexpr uint32_t kColumnCount = 4; 410 411 struct Id : public BaseId { 412 Id() = default; IdId413 explicit constexpr Id(uint32_t v) : BaseId(v) {} 414 }; 415 static_assert(std::is_trivially_destructible_v<Id>, 416 "Inheritance used without trivial destruction"); 417 418 struct ColumnIndex { 419 static constexpr uint32_t id = 0; 420 static constexpr uint32_t type = 1; 421 static constexpr uint32_t snapshot_id = 2; 422 static constexpr uint32_t upid = 3; 423 }; 424 struct ColumnType { 425 using id = IdColumn<ProcessMemorySnapshotTable::Id>; 426 using type = TypedColumn<StringPool::Id>; 427 using snapshot_id = TypedColumn<MemorySnapshotTable::Id>; 428 using upid = TypedColumn<uint32_t>; 429 }; 430 struct Row : public macros_internal::RootParentTable::Row { 431 Row(MemorySnapshotTable::Id in_snapshot_id = {}, 432 uint32_t in_upid = {}, 433 std::nullptr_t = nullptr) RowRow434 : macros_internal::RootParentTable::Row(), 435 snapshot_id(in_snapshot_id), 436 upid(in_upid) { 437 type_ = "process_memory_snapshot"; 438 } 439 MemorySnapshotTable::Id snapshot_id; 440 uint32_t upid; 441 442 bool operator==(const ProcessMemorySnapshotTable::Row& other) const { 443 return type() == other.type() && ColumnType::snapshot_id::Equals(snapshot_id, other.snapshot_id) && 444 ColumnType::upid::Equals(upid, other.upid); 445 } 446 }; 447 struct ColumnFlag { 448 static constexpr uint32_t snapshot_id = ColumnType::snapshot_id::default_flags(); 449 static constexpr uint32_t upid = ColumnType::upid::default_flags(); 450 }; 451 452 class RowNumber; 453 class ConstRowReference; 454 class RowReference; 455 456 class RowNumber : public macros_internal::AbstractRowNumber< 457 ProcessMemorySnapshotTable, ConstRowReference, RowReference> { 458 public: RowNumber(uint32_t row_number)459 explicit RowNumber(uint32_t row_number) 460 : AbstractRowNumber(row_number) {} 461 }; 462 static_assert(std::is_trivially_destructible_v<RowNumber>, 463 "Inheritance used without trivial destruction"); 464 465 class ConstRowReference : public macros_internal::AbstractConstRowReference< 466 ProcessMemorySnapshotTable, RowNumber> { 467 public: ConstRowReference(const ProcessMemorySnapshotTable * table,uint32_t row_number)468 ConstRowReference(const ProcessMemorySnapshotTable* table, uint32_t row_number) 469 : AbstractConstRowReference(table, row_number) {} 470 id()471 ColumnType::id::type id() const { 472 return table()->id()[row_number_]; 473 } type()474 ColumnType::type::type type() const { 475 return table()->type()[row_number_]; 476 } snapshot_id()477 ColumnType::snapshot_id::type snapshot_id() const { 478 return table()->snapshot_id()[row_number_]; 479 } upid()480 ColumnType::upid::type upid() const { 481 return table()->upid()[row_number_]; 482 } 483 }; 484 static_assert(std::is_trivially_destructible_v<ConstRowReference>, 485 "Inheritance used without trivial destruction"); 486 class RowReference : public ConstRowReference { 487 public: RowReference(const ProcessMemorySnapshotTable * table,uint32_t row_number)488 RowReference(const ProcessMemorySnapshotTable* table, uint32_t row_number) 489 : ConstRowReference(table, row_number) {} 490 set_snapshot_id(ColumnType::snapshot_id::non_optional_type v)491 void set_snapshot_id( 492 ColumnType::snapshot_id::non_optional_type v) { 493 return mutable_table()->mutable_snapshot_id()->Set(row_number_, v); 494 } set_upid(ColumnType::upid::non_optional_type v)495 void set_upid( 496 ColumnType::upid::non_optional_type v) { 497 return mutable_table()->mutable_upid()->Set(row_number_, v); 498 } 499 500 private: mutable_table()501 ProcessMemorySnapshotTable* mutable_table() const { 502 return const_cast<ProcessMemorySnapshotTable*>(table()); 503 } 504 }; 505 static_assert(std::is_trivially_destructible_v<RowReference>, 506 "Inheritance used without trivial destruction"); 507 508 class ConstIterator; 509 class ConstIterator : public macros_internal::AbstractConstIterator< 510 ConstIterator, ProcessMemorySnapshotTable, RowNumber, ConstRowReference> { 511 public: id()512 ColumnType::id::type id() const { 513 const auto& col = table()->id(); 514 return col.GetAtIdx( 515 iterator_.StorageIndexForColumn(col.index_in_table())); 516 } type()517 ColumnType::type::type type() const { 518 const auto& col = table()->type(); 519 return col.GetAtIdx( 520 iterator_.StorageIndexForColumn(col.index_in_table())); 521 } snapshot_id()522 ColumnType::snapshot_id::type snapshot_id() const { 523 const auto& col = table()->snapshot_id(); 524 return col.GetAtIdx( 525 iterator_.StorageIndexForColumn(col.index_in_table())); 526 } upid()527 ColumnType::upid::type upid() const { 528 const auto& col = table()->upid(); 529 return col.GetAtIdx( 530 iterator_.StorageIndexForColumn(col.index_in_table())); 531 } 532 533 protected: ConstIterator(const ProcessMemorySnapshotTable * table,Table::Iterator iterator)534 explicit ConstIterator(const ProcessMemorySnapshotTable* table, 535 Table::Iterator iterator) 536 : AbstractConstIterator(table, std::move(iterator)) {} 537 CurrentRowNumber()538 uint32_t CurrentRowNumber() const { 539 return iterator_.StorageIndexForLastOverlay(); 540 } 541 542 private: 543 friend class ProcessMemorySnapshotTable; 544 friend class macros_internal::AbstractConstIterator< 545 ConstIterator, ProcessMemorySnapshotTable, RowNumber, ConstRowReference>; 546 }; 547 class Iterator : public ConstIterator { 548 public: row_reference()549 RowReference row_reference() const { 550 return {const_cast<ProcessMemorySnapshotTable*>(table()), CurrentRowNumber()}; 551 } 552 553 private: 554 friend class ProcessMemorySnapshotTable; 555 Iterator(ProcessMemorySnapshotTable * table,Table::Iterator iterator)556 explicit Iterator(ProcessMemorySnapshotTable* table, Table::Iterator iterator) 557 : ConstIterator(table, std::move(iterator)) {} 558 }; 559 560 struct IdAndRow { 561 Id id; 562 uint32_t row; 563 RowReference row_reference; 564 RowNumber row_number; 565 }; 566 GetColumns(ProcessMemorySnapshotTable * self,const macros_internal::MacroTable * parent)567 static std::vector<ColumnLegacy> GetColumns( 568 ProcessMemorySnapshotTable* self, 569 const macros_internal::MacroTable* parent) { 570 std::vector<ColumnLegacy> columns = 571 CopyColumnsFromParentOrAddRootColumns(self, parent); 572 uint32_t olay_idx = OverlayCount(parent); 573 AddColumnToVector(columns, "snapshot_id", &self->snapshot_id_, ColumnFlag::snapshot_id, 574 static_cast<uint32_t>(columns.size()), olay_idx); 575 AddColumnToVector(columns, "upid", &self->upid_, ColumnFlag::upid, 576 static_cast<uint32_t>(columns.size()), olay_idx); 577 return columns; 578 } 579 ProcessMemorySnapshotTable(StringPool * pool)580 PERFETTO_NO_INLINE explicit ProcessMemorySnapshotTable(StringPool* pool) 581 : macros_internal::MacroTable( 582 pool, 583 GetColumns(this, nullptr), 584 nullptr), 585 snapshot_id_(ColumnStorage<ColumnType::snapshot_id::stored_type>::Create<false>()), 586 upid_(ColumnStorage<ColumnType::upid::stored_type>::Create<false>()) 587 , 588 id_storage_layer_(new column::IdStorage()), 589 type_storage_layer_( 590 new column::StringStorage(string_pool(), &type_.vector())), 591 snapshot_id_storage_layer_( 592 new column::NumericStorage<ColumnType::snapshot_id::non_optional_stored_type>( 593 &snapshot_id_.vector(), 594 ColumnTypeHelper<ColumnType::snapshot_id::stored_type>::ToColumnType(), 595 false)), 596 upid_storage_layer_( 597 new column::NumericStorage<ColumnType::upid::non_optional_stored_type>( 598 &upid_.vector(), 599 ColumnTypeHelper<ColumnType::upid::stored_type>::ToColumnType(), 600 false)) 601 { 602 static_assert( 603 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::snapshot_id::stored_type>( 604 ColumnFlag::snapshot_id), 605 "Column type and flag combination is not valid"); 606 static_assert( 607 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::upid::stored_type>( 608 ColumnFlag::upid), 609 "Column type and flag combination is not valid"); 610 OnConstructionCompletedRegularConstructor( 611 {id_storage_layer_,type_storage_layer_,snapshot_id_storage_layer_,upid_storage_layer_}, 612 {{},{},{},{}}); 613 } 614 ~ProcessMemorySnapshotTable() override; 615 Name()616 static const char* Name() { return "process_memory_snapshot"; } 617 ComputeStaticSchema()618 static Table::Schema ComputeStaticSchema() { 619 Table::Schema schema; 620 schema.columns.emplace_back(Table::Schema::Column{ 621 "id", SqlValue::Type::kLong, true, true, false, false}); 622 schema.columns.emplace_back(Table::Schema::Column{ 623 "type", SqlValue::Type::kString, false, false, false, false}); 624 schema.columns.emplace_back(Table::Schema::Column{ 625 "snapshot_id", ColumnType::snapshot_id::SqlValueType(), false, 626 false, 627 false, 628 false}); 629 schema.columns.emplace_back(Table::Schema::Column{ 630 "upid", ColumnType::upid::SqlValueType(), false, 631 false, 632 false, 633 false}); 634 return schema; 635 } 636 IterateRows()637 ConstIterator IterateRows() const { 638 return ConstIterator(this, Table::IterateRows()); 639 } 640 IterateRows()641 Iterator IterateRows() { return Iterator(this, Table::IterateRows()); } 642 FilterToIterator(const Query & q)643 ConstIterator FilterToIterator(const Query& q) const { 644 return ConstIterator(this, QueryToIterator(q)); 645 } 646 FilterToIterator(const Query & q)647 Iterator FilterToIterator(const Query& q) { 648 return Iterator(this, QueryToIterator(q)); 649 } 650 ShrinkToFit()651 void ShrinkToFit() { 652 type_.ShrinkToFit(); 653 snapshot_id_.ShrinkToFit(); 654 upid_.ShrinkToFit(); 655 } 656 657 ConstRowReference operator[](uint32_t r) const { 658 return ConstRowReference(this, r); 659 } 660 RowReference operator[](uint32_t r) { return RowReference(this, r); } 661 ConstRowReference operator[](RowNumber r) const { 662 return ConstRowReference(this, r.row_number()); 663 } 664 RowReference operator[](RowNumber r) { 665 return RowReference(this, r.row_number()); 666 } 667 FindById(Id find_id)668 std::optional<ConstRowReference> FindById(Id find_id) const { 669 std::optional<uint32_t> row = id().IndexOf(find_id); 670 return row ? std::make_optional(ConstRowReference(this, *row)) 671 : std::nullopt; 672 } 673 FindById(Id find_id)674 std::optional<RowReference> FindById(Id find_id) { 675 std::optional<uint32_t> row = id().IndexOf(find_id); 676 return row ? std::make_optional(RowReference(this, *row)) : std::nullopt; 677 } 678 Insert(const Row & row)679 IdAndRow Insert(const Row& row) { 680 uint32_t row_number = row_count(); 681 Id id = Id{row_number}; 682 type_.Append(string_pool()->InternString(row.type())); 683 mutable_snapshot_id()->Append(row.snapshot_id); 684 mutable_upid()->Append(row.upid); 685 UpdateSelfOverlayAfterInsert(); 686 return IdAndRow{id, row_number, RowReference(this, row_number), 687 RowNumber(row_number)}; 688 } 689 690 691 id()692 const IdColumn<ProcessMemorySnapshotTable::Id>& id() const { 693 return static_cast<const ColumnType::id&>(columns()[ColumnIndex::id]); 694 } type()695 const TypedColumn<StringPool::Id>& type() const { 696 return static_cast<const ColumnType::type&>(columns()[ColumnIndex::type]); 697 } snapshot_id()698 const TypedColumn<MemorySnapshotTable::Id>& snapshot_id() const { 699 return static_cast<const ColumnType::snapshot_id&>(columns()[ColumnIndex::snapshot_id]); 700 } upid()701 const TypedColumn<uint32_t>& upid() const { 702 return static_cast<const ColumnType::upid&>(columns()[ColumnIndex::upid]); 703 } 704 mutable_snapshot_id()705 TypedColumn<MemorySnapshotTable::Id>* mutable_snapshot_id() { 706 return static_cast<ColumnType::snapshot_id*>( 707 GetColumn(ColumnIndex::snapshot_id)); 708 } mutable_upid()709 TypedColumn<uint32_t>* mutable_upid() { 710 return static_cast<ColumnType::upid*>( 711 GetColumn(ColumnIndex::upid)); 712 } 713 714 private: 715 716 717 ColumnStorage<ColumnType::snapshot_id::stored_type> snapshot_id_; 718 ColumnStorage<ColumnType::upid::stored_type> upid_; 719 720 RefPtr<column::StorageLayer> id_storage_layer_; 721 RefPtr<column::StorageLayer> type_storage_layer_; 722 RefPtr<column::StorageLayer> snapshot_id_storage_layer_; 723 RefPtr<column::StorageLayer> upid_storage_layer_; 724 725 726 }; 727 728 729 class MemorySnapshotNodeTable : public macros_internal::MacroTable { 730 public: 731 static constexpr uint32_t kColumnCount = 8; 732 733 struct Id : public BaseId { 734 Id() = default; IdId735 explicit constexpr Id(uint32_t v) : BaseId(v) {} 736 }; 737 static_assert(std::is_trivially_destructible_v<Id>, 738 "Inheritance used without trivial destruction"); 739 740 struct ColumnIndex { 741 static constexpr uint32_t id = 0; 742 static constexpr uint32_t type = 1; 743 static constexpr uint32_t process_snapshot_id = 2; 744 static constexpr uint32_t parent_node_id = 3; 745 static constexpr uint32_t path = 4; 746 static constexpr uint32_t size = 5; 747 static constexpr uint32_t effective_size = 6; 748 static constexpr uint32_t arg_set_id = 7; 749 }; 750 struct ColumnType { 751 using id = IdColumn<MemorySnapshotNodeTable::Id>; 752 using type = TypedColumn<StringPool::Id>; 753 using process_snapshot_id = TypedColumn<ProcessMemorySnapshotTable::Id>; 754 using parent_node_id = TypedColumn<std::optional<MemorySnapshotNodeTable::Id>>; 755 using path = TypedColumn<StringPool::Id>; 756 using size = TypedColumn<int64_t>; 757 using effective_size = TypedColumn<int64_t>; 758 using arg_set_id = TypedColumn<std::optional<uint32_t>>; 759 }; 760 struct Row : public macros_internal::RootParentTable::Row { 761 Row(ProcessMemorySnapshotTable::Id in_process_snapshot_id = {}, 762 std::optional<MemorySnapshotNodeTable::Id> in_parent_node_id = {}, 763 StringPool::Id in_path = {}, 764 int64_t in_size = {}, 765 int64_t in_effective_size = {}, 766 std::optional<uint32_t> in_arg_set_id = {}, 767 std::nullptr_t = nullptr) RowRow768 : macros_internal::RootParentTable::Row(), 769 process_snapshot_id(in_process_snapshot_id), 770 parent_node_id(in_parent_node_id), 771 path(in_path), 772 size(in_size), 773 effective_size(in_effective_size), 774 arg_set_id(in_arg_set_id) { 775 type_ = "memory_snapshot_node"; 776 } 777 ProcessMemorySnapshotTable::Id process_snapshot_id; 778 std::optional<MemorySnapshotNodeTable::Id> parent_node_id; 779 StringPool::Id path; 780 int64_t size; 781 int64_t effective_size; 782 std::optional<uint32_t> arg_set_id; 783 784 bool operator==(const MemorySnapshotNodeTable::Row& other) const { 785 return type() == other.type() && ColumnType::process_snapshot_id::Equals(process_snapshot_id, other.process_snapshot_id) && 786 ColumnType::parent_node_id::Equals(parent_node_id, other.parent_node_id) && 787 ColumnType::path::Equals(path, other.path) && 788 ColumnType::size::Equals(size, other.size) && 789 ColumnType::effective_size::Equals(effective_size, other.effective_size) && 790 ColumnType::arg_set_id::Equals(arg_set_id, other.arg_set_id); 791 } 792 }; 793 struct ColumnFlag { 794 static constexpr uint32_t process_snapshot_id = ColumnType::process_snapshot_id::default_flags(); 795 static constexpr uint32_t parent_node_id = ColumnType::parent_node_id::default_flags(); 796 static constexpr uint32_t path = ColumnType::path::default_flags(); 797 static constexpr uint32_t size = ColumnType::size::default_flags(); 798 static constexpr uint32_t effective_size = ColumnType::effective_size::default_flags(); 799 static constexpr uint32_t arg_set_id = ColumnType::arg_set_id::default_flags(); 800 }; 801 802 class RowNumber; 803 class ConstRowReference; 804 class RowReference; 805 806 class RowNumber : public macros_internal::AbstractRowNumber< 807 MemorySnapshotNodeTable, ConstRowReference, RowReference> { 808 public: RowNumber(uint32_t row_number)809 explicit RowNumber(uint32_t row_number) 810 : AbstractRowNumber(row_number) {} 811 }; 812 static_assert(std::is_trivially_destructible_v<RowNumber>, 813 "Inheritance used without trivial destruction"); 814 815 class ConstRowReference : public macros_internal::AbstractConstRowReference< 816 MemorySnapshotNodeTable, RowNumber> { 817 public: ConstRowReference(const MemorySnapshotNodeTable * table,uint32_t row_number)818 ConstRowReference(const MemorySnapshotNodeTable* table, uint32_t row_number) 819 : AbstractConstRowReference(table, row_number) {} 820 id()821 ColumnType::id::type id() const { 822 return table()->id()[row_number_]; 823 } type()824 ColumnType::type::type type() const { 825 return table()->type()[row_number_]; 826 } process_snapshot_id()827 ColumnType::process_snapshot_id::type process_snapshot_id() const { 828 return table()->process_snapshot_id()[row_number_]; 829 } parent_node_id()830 ColumnType::parent_node_id::type parent_node_id() const { 831 return table()->parent_node_id()[row_number_]; 832 } path()833 ColumnType::path::type path() const { 834 return table()->path()[row_number_]; 835 } size()836 ColumnType::size::type size() const { 837 return table()->size()[row_number_]; 838 } effective_size()839 ColumnType::effective_size::type effective_size() const { 840 return table()->effective_size()[row_number_]; 841 } arg_set_id()842 ColumnType::arg_set_id::type arg_set_id() const { 843 return table()->arg_set_id()[row_number_]; 844 } 845 }; 846 static_assert(std::is_trivially_destructible_v<ConstRowReference>, 847 "Inheritance used without trivial destruction"); 848 class RowReference : public ConstRowReference { 849 public: RowReference(const MemorySnapshotNodeTable * table,uint32_t row_number)850 RowReference(const MemorySnapshotNodeTable* table, uint32_t row_number) 851 : ConstRowReference(table, row_number) {} 852 set_process_snapshot_id(ColumnType::process_snapshot_id::non_optional_type v)853 void set_process_snapshot_id( 854 ColumnType::process_snapshot_id::non_optional_type v) { 855 return mutable_table()->mutable_process_snapshot_id()->Set(row_number_, v); 856 } set_parent_node_id(ColumnType::parent_node_id::non_optional_type v)857 void set_parent_node_id( 858 ColumnType::parent_node_id::non_optional_type v) { 859 return mutable_table()->mutable_parent_node_id()->Set(row_number_, v); 860 } set_path(ColumnType::path::non_optional_type v)861 void set_path( 862 ColumnType::path::non_optional_type v) { 863 return mutable_table()->mutable_path()->Set(row_number_, v); 864 } set_size(ColumnType::size::non_optional_type v)865 void set_size( 866 ColumnType::size::non_optional_type v) { 867 return mutable_table()->mutable_size()->Set(row_number_, v); 868 } set_effective_size(ColumnType::effective_size::non_optional_type v)869 void set_effective_size( 870 ColumnType::effective_size::non_optional_type v) { 871 return mutable_table()->mutable_effective_size()->Set(row_number_, v); 872 } set_arg_set_id(ColumnType::arg_set_id::non_optional_type v)873 void set_arg_set_id( 874 ColumnType::arg_set_id::non_optional_type v) { 875 return mutable_table()->mutable_arg_set_id()->Set(row_number_, v); 876 } 877 878 private: mutable_table()879 MemorySnapshotNodeTable* mutable_table() const { 880 return const_cast<MemorySnapshotNodeTable*>(table()); 881 } 882 }; 883 static_assert(std::is_trivially_destructible_v<RowReference>, 884 "Inheritance used without trivial destruction"); 885 886 class ConstIterator; 887 class ConstIterator : public macros_internal::AbstractConstIterator< 888 ConstIterator, MemorySnapshotNodeTable, RowNumber, ConstRowReference> { 889 public: id()890 ColumnType::id::type id() const { 891 const auto& col = table()->id(); 892 return col.GetAtIdx( 893 iterator_.StorageIndexForColumn(col.index_in_table())); 894 } type()895 ColumnType::type::type type() const { 896 const auto& col = table()->type(); 897 return col.GetAtIdx( 898 iterator_.StorageIndexForColumn(col.index_in_table())); 899 } process_snapshot_id()900 ColumnType::process_snapshot_id::type process_snapshot_id() const { 901 const auto& col = table()->process_snapshot_id(); 902 return col.GetAtIdx( 903 iterator_.StorageIndexForColumn(col.index_in_table())); 904 } parent_node_id()905 ColumnType::parent_node_id::type parent_node_id() const { 906 const auto& col = table()->parent_node_id(); 907 return col.GetAtIdx( 908 iterator_.StorageIndexForColumn(col.index_in_table())); 909 } path()910 ColumnType::path::type path() const { 911 const auto& col = table()->path(); 912 return col.GetAtIdx( 913 iterator_.StorageIndexForColumn(col.index_in_table())); 914 } size()915 ColumnType::size::type size() const { 916 const auto& col = table()->size(); 917 return col.GetAtIdx( 918 iterator_.StorageIndexForColumn(col.index_in_table())); 919 } effective_size()920 ColumnType::effective_size::type effective_size() const { 921 const auto& col = table()->effective_size(); 922 return col.GetAtIdx( 923 iterator_.StorageIndexForColumn(col.index_in_table())); 924 } arg_set_id()925 ColumnType::arg_set_id::type arg_set_id() const { 926 const auto& col = table()->arg_set_id(); 927 return col.GetAtIdx( 928 iterator_.StorageIndexForColumn(col.index_in_table())); 929 } 930 931 protected: ConstIterator(const MemorySnapshotNodeTable * table,Table::Iterator iterator)932 explicit ConstIterator(const MemorySnapshotNodeTable* table, 933 Table::Iterator iterator) 934 : AbstractConstIterator(table, std::move(iterator)) {} 935 CurrentRowNumber()936 uint32_t CurrentRowNumber() const { 937 return iterator_.StorageIndexForLastOverlay(); 938 } 939 940 private: 941 friend class MemorySnapshotNodeTable; 942 friend class macros_internal::AbstractConstIterator< 943 ConstIterator, MemorySnapshotNodeTable, RowNumber, ConstRowReference>; 944 }; 945 class Iterator : public ConstIterator { 946 public: row_reference()947 RowReference row_reference() const { 948 return {const_cast<MemorySnapshotNodeTable*>(table()), CurrentRowNumber()}; 949 } 950 951 private: 952 friend class MemorySnapshotNodeTable; 953 Iterator(MemorySnapshotNodeTable * table,Table::Iterator iterator)954 explicit Iterator(MemorySnapshotNodeTable* table, Table::Iterator iterator) 955 : ConstIterator(table, std::move(iterator)) {} 956 }; 957 958 struct IdAndRow { 959 Id id; 960 uint32_t row; 961 RowReference row_reference; 962 RowNumber row_number; 963 }; 964 GetColumns(MemorySnapshotNodeTable * self,const macros_internal::MacroTable * parent)965 static std::vector<ColumnLegacy> GetColumns( 966 MemorySnapshotNodeTable* self, 967 const macros_internal::MacroTable* parent) { 968 std::vector<ColumnLegacy> columns = 969 CopyColumnsFromParentOrAddRootColumns(self, parent); 970 uint32_t olay_idx = OverlayCount(parent); 971 AddColumnToVector(columns, "process_snapshot_id", &self->process_snapshot_id_, ColumnFlag::process_snapshot_id, 972 static_cast<uint32_t>(columns.size()), olay_idx); 973 AddColumnToVector(columns, "parent_node_id", &self->parent_node_id_, ColumnFlag::parent_node_id, 974 static_cast<uint32_t>(columns.size()), olay_idx); 975 AddColumnToVector(columns, "path", &self->path_, ColumnFlag::path, 976 static_cast<uint32_t>(columns.size()), olay_idx); 977 AddColumnToVector(columns, "size", &self->size_, ColumnFlag::size, 978 static_cast<uint32_t>(columns.size()), olay_idx); 979 AddColumnToVector(columns, "effective_size", &self->effective_size_, ColumnFlag::effective_size, 980 static_cast<uint32_t>(columns.size()), olay_idx); 981 AddColumnToVector(columns, "arg_set_id", &self->arg_set_id_, ColumnFlag::arg_set_id, 982 static_cast<uint32_t>(columns.size()), olay_idx); 983 return columns; 984 } 985 MemorySnapshotNodeTable(StringPool * pool)986 PERFETTO_NO_INLINE explicit MemorySnapshotNodeTable(StringPool* pool) 987 : macros_internal::MacroTable( 988 pool, 989 GetColumns(this, nullptr), 990 nullptr), 991 process_snapshot_id_(ColumnStorage<ColumnType::process_snapshot_id::stored_type>::Create<false>()), 992 parent_node_id_(ColumnStorage<ColumnType::parent_node_id::stored_type>::Create<false>()), 993 path_(ColumnStorage<ColumnType::path::stored_type>::Create<false>()), 994 size_(ColumnStorage<ColumnType::size::stored_type>::Create<false>()), 995 effective_size_(ColumnStorage<ColumnType::effective_size::stored_type>::Create<false>()), 996 arg_set_id_(ColumnStorage<ColumnType::arg_set_id::stored_type>::Create<false>()) 997 , 998 id_storage_layer_(new column::IdStorage()), 999 type_storage_layer_( 1000 new column::StringStorage(string_pool(), &type_.vector())), 1001 process_snapshot_id_storage_layer_( 1002 new column::NumericStorage<ColumnType::process_snapshot_id::non_optional_stored_type>( 1003 &process_snapshot_id_.vector(), 1004 ColumnTypeHelper<ColumnType::process_snapshot_id::stored_type>::ToColumnType(), 1005 false)), 1006 parent_node_id_storage_layer_( 1007 new column::NumericStorage<ColumnType::parent_node_id::non_optional_stored_type>( 1008 &parent_node_id_.non_null_vector(), 1009 ColumnTypeHelper<ColumnType::parent_node_id::stored_type>::ToColumnType(), 1010 false)), 1011 path_storage_layer_( 1012 new column::StringStorage(string_pool(), &path_.vector())), 1013 size_storage_layer_( 1014 new column::NumericStorage<ColumnType::size::non_optional_stored_type>( 1015 &size_.vector(), 1016 ColumnTypeHelper<ColumnType::size::stored_type>::ToColumnType(), 1017 false)), 1018 effective_size_storage_layer_( 1019 new column::NumericStorage<ColumnType::effective_size::non_optional_stored_type>( 1020 &effective_size_.vector(), 1021 ColumnTypeHelper<ColumnType::effective_size::stored_type>::ToColumnType(), 1022 false)), 1023 arg_set_id_storage_layer_( 1024 new column::NumericStorage<ColumnType::arg_set_id::non_optional_stored_type>( 1025 &arg_set_id_.non_null_vector(), 1026 ColumnTypeHelper<ColumnType::arg_set_id::stored_type>::ToColumnType(), 1027 false)) 1028 , 1029 parent_node_id_null_layer_(new column::NullOverlay(parent_node_id_.bv())), 1030 arg_set_id_null_layer_(new column::NullOverlay(arg_set_id_.bv())) { 1031 static_assert( 1032 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::process_snapshot_id::stored_type>( 1033 ColumnFlag::process_snapshot_id), 1034 "Column type and flag combination is not valid"); 1035 static_assert( 1036 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::parent_node_id::stored_type>( 1037 ColumnFlag::parent_node_id), 1038 "Column type and flag combination is not valid"); 1039 static_assert( 1040 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::path::stored_type>( 1041 ColumnFlag::path), 1042 "Column type and flag combination is not valid"); 1043 static_assert( 1044 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::size::stored_type>( 1045 ColumnFlag::size), 1046 "Column type and flag combination is not valid"); 1047 static_assert( 1048 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::effective_size::stored_type>( 1049 ColumnFlag::effective_size), 1050 "Column type and flag combination is not valid"); 1051 static_assert( 1052 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::arg_set_id::stored_type>( 1053 ColumnFlag::arg_set_id), 1054 "Column type and flag combination is not valid"); 1055 OnConstructionCompletedRegularConstructor( 1056 {id_storage_layer_,type_storage_layer_,process_snapshot_id_storage_layer_,parent_node_id_storage_layer_,path_storage_layer_,size_storage_layer_,effective_size_storage_layer_,arg_set_id_storage_layer_}, 1057 {{},{},{},parent_node_id_null_layer_,{},{},{},arg_set_id_null_layer_}); 1058 } 1059 ~MemorySnapshotNodeTable() override; 1060 Name()1061 static const char* Name() { return "memory_snapshot_node"; } 1062 ComputeStaticSchema()1063 static Table::Schema ComputeStaticSchema() { 1064 Table::Schema schema; 1065 schema.columns.emplace_back(Table::Schema::Column{ 1066 "id", SqlValue::Type::kLong, true, true, false, false}); 1067 schema.columns.emplace_back(Table::Schema::Column{ 1068 "type", SqlValue::Type::kString, false, false, false, false}); 1069 schema.columns.emplace_back(Table::Schema::Column{ 1070 "process_snapshot_id", ColumnType::process_snapshot_id::SqlValueType(), false, 1071 false, 1072 false, 1073 false}); 1074 schema.columns.emplace_back(Table::Schema::Column{ 1075 "parent_node_id", ColumnType::parent_node_id::SqlValueType(), false, 1076 false, 1077 false, 1078 false}); 1079 schema.columns.emplace_back(Table::Schema::Column{ 1080 "path", ColumnType::path::SqlValueType(), false, 1081 false, 1082 false, 1083 false}); 1084 schema.columns.emplace_back(Table::Schema::Column{ 1085 "size", ColumnType::size::SqlValueType(), false, 1086 false, 1087 false, 1088 false}); 1089 schema.columns.emplace_back(Table::Schema::Column{ 1090 "effective_size", ColumnType::effective_size::SqlValueType(), false, 1091 false, 1092 false, 1093 false}); 1094 schema.columns.emplace_back(Table::Schema::Column{ 1095 "arg_set_id", ColumnType::arg_set_id::SqlValueType(), false, 1096 false, 1097 false, 1098 false}); 1099 return schema; 1100 } 1101 IterateRows()1102 ConstIterator IterateRows() const { 1103 return ConstIterator(this, Table::IterateRows()); 1104 } 1105 IterateRows()1106 Iterator IterateRows() { return Iterator(this, Table::IterateRows()); } 1107 FilterToIterator(const Query & q)1108 ConstIterator FilterToIterator(const Query& q) const { 1109 return ConstIterator(this, QueryToIterator(q)); 1110 } 1111 FilterToIterator(const Query & q)1112 Iterator FilterToIterator(const Query& q) { 1113 return Iterator(this, QueryToIterator(q)); 1114 } 1115 ShrinkToFit()1116 void ShrinkToFit() { 1117 type_.ShrinkToFit(); 1118 process_snapshot_id_.ShrinkToFit(); 1119 parent_node_id_.ShrinkToFit(); 1120 path_.ShrinkToFit(); 1121 size_.ShrinkToFit(); 1122 effective_size_.ShrinkToFit(); 1123 arg_set_id_.ShrinkToFit(); 1124 } 1125 1126 ConstRowReference operator[](uint32_t r) const { 1127 return ConstRowReference(this, r); 1128 } 1129 RowReference operator[](uint32_t r) { return RowReference(this, r); } 1130 ConstRowReference operator[](RowNumber r) const { 1131 return ConstRowReference(this, r.row_number()); 1132 } 1133 RowReference operator[](RowNumber r) { 1134 return RowReference(this, r.row_number()); 1135 } 1136 FindById(Id find_id)1137 std::optional<ConstRowReference> FindById(Id find_id) const { 1138 std::optional<uint32_t> row = id().IndexOf(find_id); 1139 return row ? std::make_optional(ConstRowReference(this, *row)) 1140 : std::nullopt; 1141 } 1142 FindById(Id find_id)1143 std::optional<RowReference> FindById(Id find_id) { 1144 std::optional<uint32_t> row = id().IndexOf(find_id); 1145 return row ? std::make_optional(RowReference(this, *row)) : std::nullopt; 1146 } 1147 Insert(const Row & row)1148 IdAndRow Insert(const Row& row) { 1149 uint32_t row_number = row_count(); 1150 Id id = Id{row_number}; 1151 type_.Append(string_pool()->InternString(row.type())); 1152 mutable_process_snapshot_id()->Append(row.process_snapshot_id); 1153 mutable_parent_node_id()->Append(row.parent_node_id); 1154 mutable_path()->Append(row.path); 1155 mutable_size()->Append(row.size); 1156 mutable_effective_size()->Append(row.effective_size); 1157 mutable_arg_set_id()->Append(row.arg_set_id); 1158 UpdateSelfOverlayAfterInsert(); 1159 return IdAndRow{id, row_number, RowReference(this, row_number), 1160 RowNumber(row_number)}; 1161 } 1162 1163 1164 id()1165 const IdColumn<MemorySnapshotNodeTable::Id>& id() const { 1166 return static_cast<const ColumnType::id&>(columns()[ColumnIndex::id]); 1167 } type()1168 const TypedColumn<StringPool::Id>& type() const { 1169 return static_cast<const ColumnType::type&>(columns()[ColumnIndex::type]); 1170 } process_snapshot_id()1171 const TypedColumn<ProcessMemorySnapshotTable::Id>& process_snapshot_id() const { 1172 return static_cast<const ColumnType::process_snapshot_id&>(columns()[ColumnIndex::process_snapshot_id]); 1173 } parent_node_id()1174 const TypedColumn<std::optional<MemorySnapshotNodeTable::Id>>& parent_node_id() const { 1175 return static_cast<const ColumnType::parent_node_id&>(columns()[ColumnIndex::parent_node_id]); 1176 } path()1177 const TypedColumn<StringPool::Id>& path() const { 1178 return static_cast<const ColumnType::path&>(columns()[ColumnIndex::path]); 1179 } size()1180 const TypedColumn<int64_t>& size() const { 1181 return static_cast<const ColumnType::size&>(columns()[ColumnIndex::size]); 1182 } effective_size()1183 const TypedColumn<int64_t>& effective_size() const { 1184 return static_cast<const ColumnType::effective_size&>(columns()[ColumnIndex::effective_size]); 1185 } arg_set_id()1186 const TypedColumn<std::optional<uint32_t>>& arg_set_id() const { 1187 return static_cast<const ColumnType::arg_set_id&>(columns()[ColumnIndex::arg_set_id]); 1188 } 1189 mutable_process_snapshot_id()1190 TypedColumn<ProcessMemorySnapshotTable::Id>* mutable_process_snapshot_id() { 1191 return static_cast<ColumnType::process_snapshot_id*>( 1192 GetColumn(ColumnIndex::process_snapshot_id)); 1193 } mutable_parent_node_id()1194 TypedColumn<std::optional<MemorySnapshotNodeTable::Id>>* mutable_parent_node_id() { 1195 return static_cast<ColumnType::parent_node_id*>( 1196 GetColumn(ColumnIndex::parent_node_id)); 1197 } mutable_path()1198 TypedColumn<StringPool::Id>* mutable_path() { 1199 return static_cast<ColumnType::path*>( 1200 GetColumn(ColumnIndex::path)); 1201 } mutable_size()1202 TypedColumn<int64_t>* mutable_size() { 1203 return static_cast<ColumnType::size*>( 1204 GetColumn(ColumnIndex::size)); 1205 } mutable_effective_size()1206 TypedColumn<int64_t>* mutable_effective_size() { 1207 return static_cast<ColumnType::effective_size*>( 1208 GetColumn(ColumnIndex::effective_size)); 1209 } mutable_arg_set_id()1210 TypedColumn<std::optional<uint32_t>>* mutable_arg_set_id() { 1211 return static_cast<ColumnType::arg_set_id*>( 1212 GetColumn(ColumnIndex::arg_set_id)); 1213 } 1214 1215 private: 1216 1217 1218 ColumnStorage<ColumnType::process_snapshot_id::stored_type> process_snapshot_id_; 1219 ColumnStorage<ColumnType::parent_node_id::stored_type> parent_node_id_; 1220 ColumnStorage<ColumnType::path::stored_type> path_; 1221 ColumnStorage<ColumnType::size::stored_type> size_; 1222 ColumnStorage<ColumnType::effective_size::stored_type> effective_size_; 1223 ColumnStorage<ColumnType::arg_set_id::stored_type> arg_set_id_; 1224 1225 RefPtr<column::StorageLayer> id_storage_layer_; 1226 RefPtr<column::StorageLayer> type_storage_layer_; 1227 RefPtr<column::StorageLayer> process_snapshot_id_storage_layer_; 1228 RefPtr<column::StorageLayer> parent_node_id_storage_layer_; 1229 RefPtr<column::StorageLayer> path_storage_layer_; 1230 RefPtr<column::StorageLayer> size_storage_layer_; 1231 RefPtr<column::StorageLayer> effective_size_storage_layer_; 1232 RefPtr<column::StorageLayer> arg_set_id_storage_layer_; 1233 1234 RefPtr<column::OverlayLayer> parent_node_id_null_layer_; 1235 RefPtr<column::OverlayLayer> arg_set_id_null_layer_; 1236 }; 1237 1238 1239 class MemorySnapshotEdgeTable : public macros_internal::MacroTable { 1240 public: 1241 static constexpr uint32_t kColumnCount = 5; 1242 1243 struct Id : public BaseId { 1244 Id() = default; IdId1245 explicit constexpr Id(uint32_t v) : BaseId(v) {} 1246 }; 1247 static_assert(std::is_trivially_destructible_v<Id>, 1248 "Inheritance used without trivial destruction"); 1249 1250 struct ColumnIndex { 1251 static constexpr uint32_t id = 0; 1252 static constexpr uint32_t type = 1; 1253 static constexpr uint32_t source_node_id = 2; 1254 static constexpr uint32_t target_node_id = 3; 1255 static constexpr uint32_t importance = 4; 1256 }; 1257 struct ColumnType { 1258 using id = IdColumn<MemorySnapshotEdgeTable::Id>; 1259 using type = TypedColumn<StringPool::Id>; 1260 using source_node_id = TypedColumn<MemorySnapshotNodeTable::Id>; 1261 using target_node_id = TypedColumn<MemorySnapshotNodeTable::Id>; 1262 using importance = TypedColumn<uint32_t>; 1263 }; 1264 struct Row : public macros_internal::RootParentTable::Row { 1265 Row(MemorySnapshotNodeTable::Id in_source_node_id = {}, 1266 MemorySnapshotNodeTable::Id in_target_node_id = {}, 1267 uint32_t in_importance = {}, 1268 std::nullptr_t = nullptr) RowRow1269 : macros_internal::RootParentTable::Row(), 1270 source_node_id(in_source_node_id), 1271 target_node_id(in_target_node_id), 1272 importance(in_importance) { 1273 type_ = "memory_snapshot_edge"; 1274 } 1275 MemorySnapshotNodeTable::Id source_node_id; 1276 MemorySnapshotNodeTable::Id target_node_id; 1277 uint32_t importance; 1278 1279 bool operator==(const MemorySnapshotEdgeTable::Row& other) const { 1280 return type() == other.type() && ColumnType::source_node_id::Equals(source_node_id, other.source_node_id) && 1281 ColumnType::target_node_id::Equals(target_node_id, other.target_node_id) && 1282 ColumnType::importance::Equals(importance, other.importance); 1283 } 1284 }; 1285 struct ColumnFlag { 1286 static constexpr uint32_t source_node_id = ColumnType::source_node_id::default_flags(); 1287 static constexpr uint32_t target_node_id = ColumnType::target_node_id::default_flags(); 1288 static constexpr uint32_t importance = ColumnType::importance::default_flags(); 1289 }; 1290 1291 class RowNumber; 1292 class ConstRowReference; 1293 class RowReference; 1294 1295 class RowNumber : public macros_internal::AbstractRowNumber< 1296 MemorySnapshotEdgeTable, ConstRowReference, RowReference> { 1297 public: RowNumber(uint32_t row_number)1298 explicit RowNumber(uint32_t row_number) 1299 : AbstractRowNumber(row_number) {} 1300 }; 1301 static_assert(std::is_trivially_destructible_v<RowNumber>, 1302 "Inheritance used without trivial destruction"); 1303 1304 class ConstRowReference : public macros_internal::AbstractConstRowReference< 1305 MemorySnapshotEdgeTable, RowNumber> { 1306 public: ConstRowReference(const MemorySnapshotEdgeTable * table,uint32_t row_number)1307 ConstRowReference(const MemorySnapshotEdgeTable* table, uint32_t row_number) 1308 : AbstractConstRowReference(table, row_number) {} 1309 id()1310 ColumnType::id::type id() const { 1311 return table()->id()[row_number_]; 1312 } type()1313 ColumnType::type::type type() const { 1314 return table()->type()[row_number_]; 1315 } source_node_id()1316 ColumnType::source_node_id::type source_node_id() const { 1317 return table()->source_node_id()[row_number_]; 1318 } target_node_id()1319 ColumnType::target_node_id::type target_node_id() const { 1320 return table()->target_node_id()[row_number_]; 1321 } importance()1322 ColumnType::importance::type importance() const { 1323 return table()->importance()[row_number_]; 1324 } 1325 }; 1326 static_assert(std::is_trivially_destructible_v<ConstRowReference>, 1327 "Inheritance used without trivial destruction"); 1328 class RowReference : public ConstRowReference { 1329 public: RowReference(const MemorySnapshotEdgeTable * table,uint32_t row_number)1330 RowReference(const MemorySnapshotEdgeTable* table, uint32_t row_number) 1331 : ConstRowReference(table, row_number) {} 1332 set_source_node_id(ColumnType::source_node_id::non_optional_type v)1333 void set_source_node_id( 1334 ColumnType::source_node_id::non_optional_type v) { 1335 return mutable_table()->mutable_source_node_id()->Set(row_number_, v); 1336 } set_target_node_id(ColumnType::target_node_id::non_optional_type v)1337 void set_target_node_id( 1338 ColumnType::target_node_id::non_optional_type v) { 1339 return mutable_table()->mutable_target_node_id()->Set(row_number_, v); 1340 } set_importance(ColumnType::importance::non_optional_type v)1341 void set_importance( 1342 ColumnType::importance::non_optional_type v) { 1343 return mutable_table()->mutable_importance()->Set(row_number_, v); 1344 } 1345 1346 private: mutable_table()1347 MemorySnapshotEdgeTable* mutable_table() const { 1348 return const_cast<MemorySnapshotEdgeTable*>(table()); 1349 } 1350 }; 1351 static_assert(std::is_trivially_destructible_v<RowReference>, 1352 "Inheritance used without trivial destruction"); 1353 1354 class ConstIterator; 1355 class ConstIterator : public macros_internal::AbstractConstIterator< 1356 ConstIterator, MemorySnapshotEdgeTable, RowNumber, ConstRowReference> { 1357 public: id()1358 ColumnType::id::type id() const { 1359 const auto& col = table()->id(); 1360 return col.GetAtIdx( 1361 iterator_.StorageIndexForColumn(col.index_in_table())); 1362 } type()1363 ColumnType::type::type type() const { 1364 const auto& col = table()->type(); 1365 return col.GetAtIdx( 1366 iterator_.StorageIndexForColumn(col.index_in_table())); 1367 } source_node_id()1368 ColumnType::source_node_id::type source_node_id() const { 1369 const auto& col = table()->source_node_id(); 1370 return col.GetAtIdx( 1371 iterator_.StorageIndexForColumn(col.index_in_table())); 1372 } target_node_id()1373 ColumnType::target_node_id::type target_node_id() const { 1374 const auto& col = table()->target_node_id(); 1375 return col.GetAtIdx( 1376 iterator_.StorageIndexForColumn(col.index_in_table())); 1377 } importance()1378 ColumnType::importance::type importance() const { 1379 const auto& col = table()->importance(); 1380 return col.GetAtIdx( 1381 iterator_.StorageIndexForColumn(col.index_in_table())); 1382 } 1383 1384 protected: ConstIterator(const MemorySnapshotEdgeTable * table,Table::Iterator iterator)1385 explicit ConstIterator(const MemorySnapshotEdgeTable* table, 1386 Table::Iterator iterator) 1387 : AbstractConstIterator(table, std::move(iterator)) {} 1388 CurrentRowNumber()1389 uint32_t CurrentRowNumber() const { 1390 return iterator_.StorageIndexForLastOverlay(); 1391 } 1392 1393 private: 1394 friend class MemorySnapshotEdgeTable; 1395 friend class macros_internal::AbstractConstIterator< 1396 ConstIterator, MemorySnapshotEdgeTable, RowNumber, ConstRowReference>; 1397 }; 1398 class Iterator : public ConstIterator { 1399 public: row_reference()1400 RowReference row_reference() const { 1401 return {const_cast<MemorySnapshotEdgeTable*>(table()), CurrentRowNumber()}; 1402 } 1403 1404 private: 1405 friend class MemorySnapshotEdgeTable; 1406 Iterator(MemorySnapshotEdgeTable * table,Table::Iterator iterator)1407 explicit Iterator(MemorySnapshotEdgeTable* table, Table::Iterator iterator) 1408 : ConstIterator(table, std::move(iterator)) {} 1409 }; 1410 1411 struct IdAndRow { 1412 Id id; 1413 uint32_t row; 1414 RowReference row_reference; 1415 RowNumber row_number; 1416 }; 1417 GetColumns(MemorySnapshotEdgeTable * self,const macros_internal::MacroTable * parent)1418 static std::vector<ColumnLegacy> GetColumns( 1419 MemorySnapshotEdgeTable* self, 1420 const macros_internal::MacroTable* parent) { 1421 std::vector<ColumnLegacy> columns = 1422 CopyColumnsFromParentOrAddRootColumns(self, parent); 1423 uint32_t olay_idx = OverlayCount(parent); 1424 AddColumnToVector(columns, "source_node_id", &self->source_node_id_, ColumnFlag::source_node_id, 1425 static_cast<uint32_t>(columns.size()), olay_idx); 1426 AddColumnToVector(columns, "target_node_id", &self->target_node_id_, ColumnFlag::target_node_id, 1427 static_cast<uint32_t>(columns.size()), olay_idx); 1428 AddColumnToVector(columns, "importance", &self->importance_, ColumnFlag::importance, 1429 static_cast<uint32_t>(columns.size()), olay_idx); 1430 return columns; 1431 } 1432 MemorySnapshotEdgeTable(StringPool * pool)1433 PERFETTO_NO_INLINE explicit MemorySnapshotEdgeTable(StringPool* pool) 1434 : macros_internal::MacroTable( 1435 pool, 1436 GetColumns(this, nullptr), 1437 nullptr), 1438 source_node_id_(ColumnStorage<ColumnType::source_node_id::stored_type>::Create<false>()), 1439 target_node_id_(ColumnStorage<ColumnType::target_node_id::stored_type>::Create<false>()), 1440 importance_(ColumnStorage<ColumnType::importance::stored_type>::Create<false>()) 1441 , 1442 id_storage_layer_(new column::IdStorage()), 1443 type_storage_layer_( 1444 new column::StringStorage(string_pool(), &type_.vector())), 1445 source_node_id_storage_layer_( 1446 new column::NumericStorage<ColumnType::source_node_id::non_optional_stored_type>( 1447 &source_node_id_.vector(), 1448 ColumnTypeHelper<ColumnType::source_node_id::stored_type>::ToColumnType(), 1449 false)), 1450 target_node_id_storage_layer_( 1451 new column::NumericStorage<ColumnType::target_node_id::non_optional_stored_type>( 1452 &target_node_id_.vector(), 1453 ColumnTypeHelper<ColumnType::target_node_id::stored_type>::ToColumnType(), 1454 false)), 1455 importance_storage_layer_( 1456 new column::NumericStorage<ColumnType::importance::non_optional_stored_type>( 1457 &importance_.vector(), 1458 ColumnTypeHelper<ColumnType::importance::stored_type>::ToColumnType(), 1459 false)) 1460 { 1461 static_assert( 1462 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::source_node_id::stored_type>( 1463 ColumnFlag::source_node_id), 1464 "Column type and flag combination is not valid"); 1465 static_assert( 1466 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::target_node_id::stored_type>( 1467 ColumnFlag::target_node_id), 1468 "Column type and flag combination is not valid"); 1469 static_assert( 1470 ColumnLegacy::IsFlagsAndTypeValid<ColumnType::importance::stored_type>( 1471 ColumnFlag::importance), 1472 "Column type and flag combination is not valid"); 1473 OnConstructionCompletedRegularConstructor( 1474 {id_storage_layer_,type_storage_layer_,source_node_id_storage_layer_,target_node_id_storage_layer_,importance_storage_layer_}, 1475 {{},{},{},{},{}}); 1476 } 1477 ~MemorySnapshotEdgeTable() override; 1478 Name()1479 static const char* Name() { return "memory_snapshot_edge"; } 1480 ComputeStaticSchema()1481 static Table::Schema ComputeStaticSchema() { 1482 Table::Schema schema; 1483 schema.columns.emplace_back(Table::Schema::Column{ 1484 "id", SqlValue::Type::kLong, true, true, false, false}); 1485 schema.columns.emplace_back(Table::Schema::Column{ 1486 "type", SqlValue::Type::kString, false, false, false, false}); 1487 schema.columns.emplace_back(Table::Schema::Column{ 1488 "source_node_id", ColumnType::source_node_id::SqlValueType(), false, 1489 false, 1490 false, 1491 false}); 1492 schema.columns.emplace_back(Table::Schema::Column{ 1493 "target_node_id", ColumnType::target_node_id::SqlValueType(), false, 1494 false, 1495 false, 1496 false}); 1497 schema.columns.emplace_back(Table::Schema::Column{ 1498 "importance", ColumnType::importance::SqlValueType(), false, 1499 false, 1500 false, 1501 false}); 1502 return schema; 1503 } 1504 IterateRows()1505 ConstIterator IterateRows() const { 1506 return ConstIterator(this, Table::IterateRows()); 1507 } 1508 IterateRows()1509 Iterator IterateRows() { return Iterator(this, Table::IterateRows()); } 1510 FilterToIterator(const Query & q)1511 ConstIterator FilterToIterator(const Query& q) const { 1512 return ConstIterator(this, QueryToIterator(q)); 1513 } 1514 FilterToIterator(const Query & q)1515 Iterator FilterToIterator(const Query& q) { 1516 return Iterator(this, QueryToIterator(q)); 1517 } 1518 ShrinkToFit()1519 void ShrinkToFit() { 1520 type_.ShrinkToFit(); 1521 source_node_id_.ShrinkToFit(); 1522 target_node_id_.ShrinkToFit(); 1523 importance_.ShrinkToFit(); 1524 } 1525 1526 ConstRowReference operator[](uint32_t r) const { 1527 return ConstRowReference(this, r); 1528 } 1529 RowReference operator[](uint32_t r) { return RowReference(this, r); } 1530 ConstRowReference operator[](RowNumber r) const { 1531 return ConstRowReference(this, r.row_number()); 1532 } 1533 RowReference operator[](RowNumber r) { 1534 return RowReference(this, r.row_number()); 1535 } 1536 FindById(Id find_id)1537 std::optional<ConstRowReference> FindById(Id find_id) const { 1538 std::optional<uint32_t> row = id().IndexOf(find_id); 1539 return row ? std::make_optional(ConstRowReference(this, *row)) 1540 : std::nullopt; 1541 } 1542 FindById(Id find_id)1543 std::optional<RowReference> FindById(Id find_id) { 1544 std::optional<uint32_t> row = id().IndexOf(find_id); 1545 return row ? std::make_optional(RowReference(this, *row)) : std::nullopt; 1546 } 1547 Insert(const Row & row)1548 IdAndRow Insert(const Row& row) { 1549 uint32_t row_number = row_count(); 1550 Id id = Id{row_number}; 1551 type_.Append(string_pool()->InternString(row.type())); 1552 mutable_source_node_id()->Append(row.source_node_id); 1553 mutable_target_node_id()->Append(row.target_node_id); 1554 mutable_importance()->Append(row.importance); 1555 UpdateSelfOverlayAfterInsert(); 1556 return IdAndRow{id, row_number, RowReference(this, row_number), 1557 RowNumber(row_number)}; 1558 } 1559 1560 1561 id()1562 const IdColumn<MemorySnapshotEdgeTable::Id>& id() const { 1563 return static_cast<const ColumnType::id&>(columns()[ColumnIndex::id]); 1564 } type()1565 const TypedColumn<StringPool::Id>& type() const { 1566 return static_cast<const ColumnType::type&>(columns()[ColumnIndex::type]); 1567 } source_node_id()1568 const TypedColumn<MemorySnapshotNodeTable::Id>& source_node_id() const { 1569 return static_cast<const ColumnType::source_node_id&>(columns()[ColumnIndex::source_node_id]); 1570 } target_node_id()1571 const TypedColumn<MemorySnapshotNodeTable::Id>& target_node_id() const { 1572 return static_cast<const ColumnType::target_node_id&>(columns()[ColumnIndex::target_node_id]); 1573 } importance()1574 const TypedColumn<uint32_t>& importance() const { 1575 return static_cast<const ColumnType::importance&>(columns()[ColumnIndex::importance]); 1576 } 1577 mutable_source_node_id()1578 TypedColumn<MemorySnapshotNodeTable::Id>* mutable_source_node_id() { 1579 return static_cast<ColumnType::source_node_id*>( 1580 GetColumn(ColumnIndex::source_node_id)); 1581 } mutable_target_node_id()1582 TypedColumn<MemorySnapshotNodeTable::Id>* mutable_target_node_id() { 1583 return static_cast<ColumnType::target_node_id*>( 1584 GetColumn(ColumnIndex::target_node_id)); 1585 } mutable_importance()1586 TypedColumn<uint32_t>* mutable_importance() { 1587 return static_cast<ColumnType::importance*>( 1588 GetColumn(ColumnIndex::importance)); 1589 } 1590 1591 private: 1592 1593 1594 ColumnStorage<ColumnType::source_node_id::stored_type> source_node_id_; 1595 ColumnStorage<ColumnType::target_node_id::stored_type> target_node_id_; 1596 ColumnStorage<ColumnType::importance::stored_type> importance_; 1597 1598 RefPtr<column::StorageLayer> id_storage_layer_; 1599 RefPtr<column::StorageLayer> type_storage_layer_; 1600 RefPtr<column::StorageLayer> source_node_id_storage_layer_; 1601 RefPtr<column::StorageLayer> target_node_id_storage_layer_; 1602 RefPtr<column::StorageLayer> importance_storage_layer_; 1603 1604 1605 }; 1606 1607 } // namespace perfetto 1608 1609 #endif // SRC_TRACE_PROCESSOR_TABLES_MEMORY_TABLES_PY_H_ 1610