Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Jazzy]: rqt_bag playback uses too much CPU time #157

Open
clalancette opened this issue May 9, 2024 · 0 comments
Open

[Jazzy]: rqt_bag playback uses too much CPU time #157

clalancette opened this issue May 9, 2024 · 0 comments

Comments

@clalancette
Copy link

When playing back a bag (clicking on the "Play" button after loading a bag), rqt_bag will use 75-100% of a core to do the playback.

The reason this happens is fairly straightforward. The BagTimeline class uses a 3 millisecond timer to play data back. That ends up calling on_idle, which calls _step_playahead, which, in the case of normal playback, calls step_fixed.

Among other things, step_fixed ends up setting the playhead of the timeline frame. This one line of code hides a lot of complexity, since playhead is a property.

Essentially the reason we use so much CPU time is that set_playhead is very expensive; in my testing, it uses between 1.75 and 2 millseconds. Since that is a large fraction of the 3 millisecond timer callback, we end up using a lot of CPU time.

The solution is to try to drastically reduce the cost of calls to _set_playhead, which will allow us to use less CPU time and possibly to even increase the timer callback to 1 milliseconds instead of 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant