Skip to content

Commit

Permalink
add code to calc computation time
Browse files Browse the repository at this point in the history
Signed-off-by: Takamasa Horibe <[email protected]>
  • Loading branch information
TakaHoribe committed Jan 17, 2023
1 parent 1e8961d commit f36c782
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion planning/planning_validator/src/planning_validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <motion_utils/trajectory/trajectory.hpp>
#include <tier4_autoware_utils/tier4_autoware_utils.hpp>
#include <tier4_autoware_utils/system/stop_watch.hpp>

#include <memory>
#include <string>
Expand Down Expand Up @@ -151,8 +152,17 @@ void PlanningValidator::onTrajectory(const Trajectory::ConstSharedPtr msg)

debug_pose_publisher_->clearMarkers();

validate(*current_trajectory_);
static tier4_autoware_utils::StopWatch<std::chrono::milliseconds> stopwatch;
static int count = 0;
static double total_ms = 0.0;

stopwatch.tic();
validate(*current_trajectory_);
const auto t = stopwatch.toc();
total_ms += t;
count++;
std::cerr << "time = " << t << " [ms] (total " << total_ms << " [ms], count = " << count << ", average_time = " << total_ms / count << ")" << "(traj.size = " << current_trajectory_->points.size() << ")" << std::endl;

diag_updater_.force_update();

publishTrajectory();
Expand Down

0 comments on commit f36c782

Please sign in to comment.