chromium/third_party/perfetto/src/trace_processor/perfetto_sql/intrinsics/functions/graph_scan.cc

/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "src/trace_processor/perfetto_sql/intrinsics/functions/graph_scan.h"

#include <algorithm>
#include <cinttypes>
#include <cstdint>
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <variant>
#include <vector>

#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/status_or.h"
#include "perfetto/ext/base/string_utils.h"
#include "src/trace_processor/containers/string_pool.h"
#include "src/trace_processor/db/runtime_table.h"
#include "src/trace_processor/perfetto_sql/engine/function_util.h"
#include "src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.h"
#include "src/trace_processor/perfetto_sql/intrinsics/types/array.h"
#include "src/trace_processor/perfetto_sql/intrinsics/types/node.h"
#include "src/trace_processor/perfetto_sql/intrinsics/types/row_dataframe.h"
#include "src/trace_processor/perfetto_sql/intrinsics/types/value.h"
#include "src/trace_processor/sqlite/bindings/sqlite_bind.h"
#include "src/trace_processor/sqlite/bindings/sqlite_column.h"
#include "src/trace_processor/sqlite/bindings/sqlite_function.h"
#include "src/trace_processor/sqlite/bindings/sqlite_result.h"
#include "src/trace_processor/sqlite/bindings/sqlite_stmt.h"
#include "src/trace_processor/sqlite/bindings/sqlite_type.h"
#include "src/trace_processor/sqlite/bindings/sqlite_value.h"
#include "src/trace_processor/sqlite/sql_source.h"
#include "src/trace_processor/sqlite/sqlite_engine.h"
#include "src/trace_processor/sqlite/sqlite_utils.h"
#include "src/trace_processor/util/status_macros.h"

namespace perfetto::trace_processor {
namespace {

base::Status InitToOutputAndStepTable(const perfetto_sql::RowDataframe& inits,
                                      const perfetto_sql::Graph& graph,
                                      RuntimeTable::Builder& step,
                                      uint32_t& step_row_count,
                                      RuntimeTable::Builder& out,
                                      uint32_t& out_row_count) {}

base::Status SqliteToOutputAndStepTable(SqliteEngine::PreparedStatement& stmt,
                                        const perfetto_sql::Graph& graph,
                                        RuntimeTable::Builder& step,
                                        uint32_t& step_row_count,
                                        RuntimeTable::Builder& out,
                                        uint32_t& out_row_count) {}

base::StatusOr<SqliteEngine::PreparedStatement> PrepareStatement(
    PerfettoSqlEngine& engine,
    const std::vector<std::string>& cols,
    const std::string& sql) {}

struct NodeState {};

struct DepthTable {};

struct GraphAggregatingScanner {};

std::vector<uint32_t> GraphAggregatingScanner::InitializeStateFromMaxNode() {}

uint32_t GraphAggregatingScanner::DfsAndComputeMaxDepth(
    std::vector<uint32_t> stack) {}

base::Status GraphAggregatingScanner::PushDownAggregates(
    SqliteEngine::PreparedStatement& agg_stmt,
    uint32_t agg_col_count,
    RuntimeTable::Builder& res,
    uint32_t& res_row_count) {}

base::Status GraphAggregatingScanner::PushDownStartingAggregates(
    RuntimeTable::Builder& res,
    uint32_t& res_row_count) {}

base::StatusOr<std::unique_ptr<RuntimeTable>> GraphAggregatingScanner::Run() {}

struct GraphAggregatingScan : public SqliteFunction<GraphAggregatingScan> {};

struct GraphScan : public SqliteFunction<GraphScan> {};

}  // namespace

base::Status RegisterGraphScanFunctions(PerfettoSqlEngine& engine,
                                        StringPool* pool) {}

}  // namespace perfetto::trace_processor