diff --git a/src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.cc b/src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.cc index 2f163a0c87..b0e854460b 100644 --- a/src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.cc +++ b/src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.cc @@ -322,7 +322,7 @@ PerfettoSqlEngine::ExecuteUntilLastStatement(SqlSource sql_source) { return ExecutionResult{std::move(*res), stats}; } -base::Status PerfettoSqlEngine::RegisterSqlFunction( +base::Status PerfettoSqlEngine::RegisterRuntimeFunction( bool replace, const FunctionPrototype& prototype, std::string return_type_str, @@ -348,7 +348,7 @@ base::Status PerfettoSqlEngine::RegisterSqlFunction( std::unique_ptr created_fn_ctx = CreatedFunction::MakeContext(this); ctx = created_fn_ctx.get(); - RETURN_IF_ERROR(RegisterCppFunction( + RETURN_IF_ERROR(RegisterStaticFunction( prototype.function_name.c_str(), created_argc, std::move(created_fn_ctx))); } @@ -487,7 +487,7 @@ base::StatusOr PerfettoSqlEngine::ExecuteCreateFunction( const PerfettoSqlParser& parser) { if (!cf.is_table) { RETURN_IF_ERROR( - RegisterSqlFunction(cf.replace, cf.prototype, cf.returns, cf.sql)); + RegisterRuntimeFunction(cf.replace, cf.prototype, cf.returns, cf.sql)); return RewriteToDummySql(parser.statement_sql()); } diff --git a/src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.h b/src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.h index a57a588a0d..993e9c1f6b 100644 --- a/src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.h +++ b/src/trace_processor/perfetto_sql/engine/perfetto_sql_engine.h @@ -86,10 +86,10 @@ class PerfettoSqlEngine { // |determistic|: whether this function has deterministic output given the // same set of arguments. template - base::Status RegisterCppFunction(const char* name, - int argc, - typename Function::Context* ctx, - bool deterministic = true); + base::Status RegisterStaticFunction(const char* name, + int argc, + typename Function::Context* ctx, + bool deterministic = true); // Registers a trace processor C++ function to be runnable from SQL. // @@ -98,7 +98,7 @@ class PerfettoSqlEngine { // this pointer instead of the essentially static requirement of the context // pointer above. template - base::Status RegisterCppFunction( + base::Status RegisterStaticFunction( const char* name, int argc, std::unique_ptr ctx, @@ -106,10 +106,10 @@ class PerfettoSqlEngine { // Registers a function with the prototype |prototype| which returns a value // of |return_type| and is implemented by executing the SQL statement |sql|. - base::Status RegisterSqlFunction(bool replace, - const FunctionPrototype& prototype, - std::string return_type, - SqlSource sql); + base::Status RegisterRuntimeFunction(bool replace, + const FunctionPrototype& prototype, + std::string return_type, + SqlSource sql); // Enables memoization for the given SQL function. base::Status EnableSqlFunctionMemoization(const std::string& name); @@ -227,7 +227,7 @@ void WrapSqlFunction(sqlite3_context* ctx, int argc, sqlite3_value** argv) { } // namespace perfetto_sql_internal template -base::Status PerfettoSqlEngine::RegisterCppFunction( +base::Status PerfettoSqlEngine::RegisterStaticFunction( const char* name, int argc, typename Function::Context* ctx, @@ -238,7 +238,7 @@ base::Status PerfettoSqlEngine::RegisterCppFunction( } template -base::Status PerfettoSqlEngine::RegisterCppFunction( +base::Status PerfettoSqlEngine::RegisterStaticFunction( const char* name, int argc, std::unique_ptr user_data, diff --git a/src/trace_processor/perfetto_sql/intrinsics/functions/create_function.cc b/src/trace_processor/perfetto_sql/intrinsics/functions/create_function.cc index 2bada91eef..42a6a216fd 100644 --- a/src/trace_processor/perfetto_sql/intrinsics/functions/create_function.cc +++ b/src/trace_processor/perfetto_sql/intrinsics/functions/create_function.cc @@ -76,7 +76,7 @@ base::Status CreateFunction::Run(PerfettoSqlEngine* engine, FunctionPrototype prototype; RETURN_IF_ERROR(ParsePrototype(base::StringView(prototype_str), prototype)); - return engine->RegisterSqlFunction( + return engine->RegisterRuntimeFunction( false, prototype, return_type_str, SqlSource::FromTraceProcessorImplementation(std::move(sql_defn_str))); } diff --git a/src/trace_processor/perfetto_sql/intrinsics/functions/math.cc b/src/trace_processor/perfetto_sql/intrinsics/functions/math.cc index f014fd9565..1c3a20a192 100644 --- a/src/trace_processor/perfetto_sql/intrinsics/functions/math.cc +++ b/src/trace_processor/perfetto_sql/intrinsics/functions/math.cc @@ -101,9 +101,9 @@ struct Sqrt : public SqlFunction { } // namespace base::Status RegisterMathFunctions(PerfettoSqlEngine& engine) { - RETURN_IF_ERROR(engine.RegisterCppFunction("ln", 1, nullptr, true)); - RETURN_IF_ERROR(engine.RegisterCppFunction("exp", 1, nullptr, true)); - return engine.RegisterCppFunction("sqrt", 1, nullptr, true); + RETURN_IF_ERROR(engine.RegisterStaticFunction("ln", 1, nullptr, true)); + RETURN_IF_ERROR(engine.RegisterStaticFunction("exp", 1, nullptr, true)); + return engine.RegisterStaticFunction("sqrt", 1, nullptr, true); } } // namespace perfetto::trace_processor diff --git a/src/trace_processor/perfetto_sql/intrinsics/functions/stack_functions.cc b/src/trace_processor/perfetto_sql/intrinsics/functions/stack_functions.cc index c78e6c9c78..3fa7bd0ba0 100644 --- a/src/trace_processor/perfetto_sql/intrinsics/functions/stack_functions.cc +++ b/src/trace_processor/perfetto_sql/intrinsics/functions/stack_functions.cc @@ -246,13 +246,13 @@ struct StackFromStackProfileFrameFunction : public SqlFunction { base::Status RegisterStackFunctions(PerfettoSqlEngine* engine, TraceProcessorContext* context) { - RETURN_IF_ERROR(engine->RegisterCppFunction( + RETURN_IF_ERROR(engine->RegisterStaticFunction( CatStacksFunction::kFunctionName, -1, context->storage.get())); RETURN_IF_ERROR( - engine->RegisterCppFunction( + engine->RegisterStaticFunction( StackFromStackProfileFrameFunction::kFunctionName, 1, context->storage.get())); - return engine->RegisterCppFunction( + return engine->RegisterStaticFunction( StackFromStackProfileCallsiteFunction::kFunctionName, -1, context->storage.get()); } diff --git a/src/trace_processor/trace_processor_impl.cc b/src/trace_processor/trace_processor_impl.cc index 626dd6a5d5..697553dd7f 100644 --- a/src/trace_processor/trace_processor_impl.cc +++ b/src/trace_processor/trace_processor_impl.cc @@ -119,7 +119,7 @@ void RegisterFunction(PerfettoSqlEngine* engine, int argc, Ptr context = nullptr, bool deterministic = true) { - auto status = engine->RegisterCppFunction( + auto status = engine->RegisterStaticFunction( name, argc, std::move(context), deterministic); if (!status.ok()) PERFETTO_ELOG("%s", status.c_message());