ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Why does /clock slow down under 65% CPU load?

asked 2018-08-29 03:59:16 -0500

KenYN gravatar image

updated 2018-08-29 04:00:42 -0500

On Ubuntu 16.04, with 8 cores and lots of nodelets.

Measuring /clock with rostopic hz /clock and using rosbag play --rate xx, I see that:

--rate    CPU load    /clock
  0.5        40%       50 Hz
  1.0        65%       38 Hz
  2.0        85%        9 Hz

I know ROS doesn't claim to be real-time, but normal-speed playback shouldn't be slowing down the clock as the CPU has plenty of cycles to spare, it appears.

This affects running the program live, as we have a ros::Timer() that slows down, mucking up everything else down the chain. Using a stop-watch, at --rate 2.0 the BAG file plays back at double speed, but why isn't /clock keeping up?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-08-29 05:51:59 -0500

You're describing the CPU load of an 8 core system with a single percentage, this is a major simplification. If you view the system monitor you should see a percentage for each core, which will tell you a lot more about what's going on.

I suspect at least one maybe more single threaded processes are maxing out some of your cores, so you'll see some of them at 100% while others are lower. Maxing out a single core will only show as 12% overall CPU usage but will mean that process is no longer keeping up.

Can you re-run the test with the system monitor showing the utilization of each core and let us know what you see.

edit flag offensive delete link more

Comments

I did run with the standard System Monitor thing, and all eight cores were well-balanced and within a couple of percent of each other; I don't think we've got any one message handler that takes more than 50 ms. Tomorrow I'm going to try an explicit loop with spinOnce() and measure 0.02 ms myself.

KenYN gravatar image KenYN  ( 2018-08-29 11:11:34 -0500 )edit

BTW, I suspect that Timer callbacks are low priority and only run when all message queues are empty.

KenYN gravatar image KenYN  ( 2018-08-29 11:13:25 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-08-29 03:59:16 -0500

Seen: 357 times

Last updated: Aug 29 '18