1#ifndef ROBOTOC_UTILS_OCP_BENCHMARKER_HXX_ 
    2#define ROBOTOC_UTILS_OCP_BENCHMARKER_HXX_  
   13template <
typename OCPSolverType>
 
   14inline void CPUTime(OCPSolverType& ocp_solver, 
const double t, 
 
   15                    const Eigen::VectorXd& q, 
const Eigen::VectorXd& v, 
 
   16                    const int num_iteration) {
 
   17  std::chrono::high_resolution_clock::time_point start_clock, end_clock;
 
   18  start_clock = std::chrono::high_resolution_clock::now();
 
   19  for (
int i=0; i<num_iteration; ++i) {
 
   20    ocp_solver.updateSolution(t, q, v);
 
   22  end_clock = std::chrono::high_resolution_clock::now();
 
   23  std::chrono::duration<double, std::milli> timing = end_clock - start_clock;
 
   24  std::cout << 
"---------- OCP benchmark : CPU time ----------" << std::endl;
 
   25  std::cout << 
"total CPU time: " << timing.count() 
 
   26            << 
"[ms]" << std::endl;
 
   27  std::cout << 
"CPU time per update: " << timing.count() / num_iteration
 
   28            << 
"[ms]" << std::endl;
 
   29  std::cout << 
"-----------------------------------" << std::endl;
 
   30  std::cout << std::endl;
 
void CPUTime(OCPSolverType &ocp_solver, const double t, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const int num_iteration=1000)
Definition: ocp_benchmarker.hxx:14
 
Definition: constraint_component_base.hpp:17