Which one is more precise: ros::WallTime::now() OR clock_gettime? [closed]
Hi
I want to measure the time it takes from navfn to generate a path:
begin_ = ros::WallTime::now();
navfn.makePlan(start,goal,plan);
end_ = ros::WallTime::now();
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time2);
navfn.makePlan(start,goal,plan);
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time3);
time1=diff(time2,time3);
double run_time = (time1.tv_nsec)*1e-6; // milliseconds
double execution_time = (end_ - begin_).toNSec() * 1e-6;
ROS_INFO_STREAM("Exectution time (ms) using ROS WallTime: " << execution_time);
ROS_INFO_STREAM("Run time (ms) using C++ clock_gettime: " << run_time);
Both given results in ms, but which one is more precise?
This is the output:
I'm closing your question, as it does not follow the support guidelines, specifically: do not post screenshots of terminals.
There would be no need, as it's all text.
Simply copy-paste it into your question and make sure to format it correctly (use the Preformatted Text button, the one with
101010
on it).You do not need to post a new question, just edit your current one. Use the
edit
button/link to do that.After you've replaced the screenshot with the actual text, we can re-open your question.