diff --git a/internal/ceres/gradient_problem_evaluator.h b/internal/ceres/gradient_problem_evaluator.h index ca49c2412..9ccd10ee4 100644 --- a/internal/ceres/gradient_problem_evaluator.h +++ b/internal/ceres/gradient_problem_evaluator.h @@ -57,11 +57,18 @@ class GradientProblemEvaluator : public Evaluator { SparseMatrix* jacobian) { CHECK(jacobian == NULL); ScopedExecutionTimer total_timer("Evaluator::Total", &execution_summary_); + // The reason we use Residual and Jacobian here even when we are + // only computing the cost and gradient has to do with the fact + // that the line search minimizer code is used by both the + // GradientProblemSolver and the main CeresSolver coder where the + // Evaluator evaluates the Jacobian, and these magic strings need + // to be consistent across the code base for the time accounting + // to work. ScopedExecutionTimer call_type_timer( - gradient == NULL ? "Evaluator::Cost" : "Evaluator::Gradient", + gradient == NULL ? "Evaluator::Residual" : "Evaluator::Jacobian", &execution_summary_); - execution_summary_.IncrementCall(gradient == NULL ? "Evaluator::Cost" - : "Evaluator::Gradient"); + execution_summary_.IncrementCall(gradient == NULL ? "Evaluator::Residual" + : "Evaluator::Jacobian"); return problem_.Evaluate(state, cost, gradient); } diff --git a/internal/ceres/gradient_problem_solver.cc b/internal/ceres/gradient_problem_solver.cc index 478818b34..ba36dd7b2 100644 --- a/internal/ceres/gradient_problem_solver.cc +++ b/internal/ceres/gradient_problem_solver.cc @@ -166,15 +166,15 @@ void GradientProblemSolver::Solve(const GradientProblemSolver::Options& options, const std::map& evaluator_time_statistics = minimizer_options.evaluator->TimeStatistics(); summary->cost_evaluation_time_in_seconds = - FindWithDefault(evaluator_time_statistics, "Evaluator::Cost", 0.0); + FindWithDefault(evaluator_time_statistics, "Evaluator::Residual", 0.0); summary->gradient_evaluation_time_in_seconds = - FindWithDefault(evaluator_time_statistics, "Evaluator::Gradient", 0.0); + FindWithDefault(evaluator_time_statistics, "Evaluator::Jacobian", 0.0); const std::map& evaluator_call_statistics = minimizer_options.evaluator->CallStatistics(); summary->num_cost_evaluations = - FindWithDefault(evaluator_call_statistics, "Evaluator::Cost", 0); + FindWithDefault(evaluator_call_statistics, "Evaluator::Residual", 0); summary->num_gradient_evaluations = - FindWithDefault(evaluator_call_statistics, "Evaluator::Gradient", 0); + FindWithDefault(evaluator_call_statistics, "Evaluator::Jacobian", 0); summary->total_time_in_seconds = WallTimeInSeconds() - start_time; }