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

yarpmotorgui using 80% of the CPU #2955

Open
xEnVrE opened this issue Mar 9, 2023 · 7 comments
Open

yarpmotorgui using 80% of the CPU #2955

xEnVrE opened this issue Mar 9, 2023 · 7 comments

Comments

@xEnVrE
Copy link
Contributor

xEnVrE commented Mar 9, 2023

Describe the bug
Today I noticed that the laptop fan was spinning quite a lot and the only substantial executable running was the yarpmotorgui.

Screenshot from 2023-03-09 18-38-39

From the screen it seems that the yarpmotorgui is using almost 90% of the CPU.

To Reproduce
Open the yarpmotorgui and wait a bit.

Expected behavior
That the yarpmotorgui do not consume that amount of CPU.

Screenshots
See above.

Configuration

  • OS: Ubuntu 22.04
  • yarp version:
    • commit 81917f6d0d980fc9d4ad396c5fb07f7908cfb7f9             
      Author: robotology-bot (Tag Repository Action) <robotology@iit.it>              
      Date:   Mon Mar 6 10:39:18 2023 +0000
              YARP 3.8.0

cc @randaz81 @traversaro

@traversaro
Copy link
Member

Where you doing something particular with the yarpmotorgui or it was just open?

@xEnVrE
Copy link
Contributor Author

xEnVrE commented Mar 9, 2023

It was just open.

@traversaro
Copy link
Member

traversaro commented Mar 9, 2023

If you are able to reproduce on a physical Linux/Intel machine (no virtualization or WSL2), it may be worth to collect some trace, for example via magic-trace ( https://github.com/janestreet/magic-trace), it should be sufficient to run:

magic-trace run `which yarpmotorgui`

and upload (or inspect yourself) the resulting trace.fxt file.

@xEnVrE
Copy link
Contributor Author

xEnVrE commented Mar 9, 2023

I will do it tomorrow, it was happening on a plain Linux machine.

@traversaro
Copy link
Member

Note that I always used magic-trace attach-pid, but magic-trace run should also work fine, but if something is unexpcted you can also use magic-trace attach-pid.

@PeterBowman
Copy link
Member

PeterBowman commented Mar 10, 2023

Hello, I can reproduce this on YARP version 3.8.0+3-20230306.4+git282a223a7 and Ubuntu 20.04. Here is my trace: trace.zip. I used the run command, but previously I had to set /proc/sys/kernel/perf_event_paranoid to -1 (was 4).

(...) it should be sufficient to run:

magic-trace run `which yarpmotorgui`

There is a window prompt that shows up right after launching yarpmotorgui that allows me to select which parts I want to control. CPU usage is negligible in this step, but it rockets up to 100% once the main window is opened.

Edit: I can test this app's behavior both on the Gazebo simulator and on a fake implementation of the real robot (which just returns true from almost every motor interface method and does nothing else). The former makes the nodes enter position control and exhibes the CPU usage issue, the latter stays in NOT_CONFIGURED mode and looks fine in terms of resource consumption.

@PeterBowman
Copy link
Member

PeterBowman commented Apr 3, 2023

I checked the CPU usage on the latest commits in the src/yarpmotorgui/ tree. It looks like 54c1a6f is the culprit (more precisely, the additions in sliderWithTarget.cpp). Also, a segfault is produced on exit.

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

No branches or pull requests

3 participants