1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef SRC_TRACE_PROCESSOR_PERFETTO_SQL_INTRINSICS_TABLE_FUNCTIONS_TABLE_INFO_H_ 18 #define SRC_TRACE_PROCESSOR_PERFETTO_SQL_INTRINSICS_TABLE_FUNCTIONS_TABLE_INFO_H_ 19 20 #include <cstdint> 21 #include <memory> 22 #include <optional> 23 #include <string> 24 #include <vector> 25 26 #include "perfetto/ext/base/status_or.h" 27 #include "perfetto/trace_processor/basic_types.h" 28 #include "src/trace_processor/containers/string_pool.h" 29 #include "src/trace_processor/db/table.h" 30 #include "src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.h" 31 #include "src/trace_processor/perfetto_sql/intrinsics/table_functions/static_table_function.h" 32 33 namespace perfetto::trace_processor { 34 35 class TraceProcessorContext; 36 37 class TableInfo : public StaticTableFunction { 38 public: 39 explicit TableInfo(StringPool*, const PerfettoSqlEngine*); 40 41 Table::Schema CreateSchema() override; 42 std::string TableName() override; 43 uint32_t EstimateRowCount() override; 44 base::StatusOr<std::unique_ptr<Table>> ComputeTable( 45 const std::vector<SqlValue>& arguments) override; 46 47 private: 48 StringPool* string_pool_ = nullptr; 49 const PerfettoSqlEngine* engine_ = nullptr; 50 }; 51 52 } // namespace perfetto::trace_processor 53 54 #endif // SRC_TRACE_PROCESSOR_PERFETTO_SQL_INTRINSICS_TABLE_FUNCTIONS_TABLE_INFO_H_ 55