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

ergoCubEmotions uses more than 100% of the cpu on ergocub-head #213

Closed
GiulioRomualdi opened this issue Jan 18, 2024 · 5 comments · Fixed by #214
Closed

ergoCubEmotions uses more than 100% of the cpu on ergocub-head #213

GiulioRomualdi opened this issue Jan 18, 2024 · 5 comments · Fixed by #214
Assignees
Labels
domain-software Related to Software prj-ergocub Related to ErgoCub Project team-fix Related to Team Fix

Comments

@GiulioRomualdi
Copy link
Contributor

I noticed that ergoCubEmotions uses a really high amount of CPU on the ergocub-head.

In the following screenshot you can check the amount of used CPU (181%) only ergoCubEmotions was running on the ergocub-head
image

I was wondering if it is normal

cc @martinaxgloria

@Nicogene Nicogene added team-fix Related to Team Fix domain-software Related to Software prj-ergocub Related to ErgoCub Project labels Jan 18, 2024
@traversaro
Copy link
Member

If I remember correctly once we checked that, one problem may be that at every module update, the file are re-read (see

). Perhaps we could read the images only once in the configure, and save them as cv::Mat attributes that can be used in the updateModule?

@martinaxgloria
Copy link
Member

martinaxgloria commented Jan 22, 2024

Hi @traversaro,

thank you for your suggestion. Actually, we are reading videos and not images (the static part is a 2 sec looped video and the transitions from one expression to another too). If I remember well, opencv shows videos one frame at the time after they are opened. I don't know if it's possible to save cv::VideoCapture elements as per cv::Mat ones.

Today I tried to use the configuration image -> transition -> image and I saw from jtop that the usage is reduced to ~30% but there's a spike when the transition is called.

Moreover, the % showed by jtop should correspond to the sum of the cpu usage for each core: in fact running top with IRIX mode set to OFF, this is the cpu consumption divided by the number of cores:

image

This means that the cores should not be saturated, I don't know if you see some delays.
I'm going to understand if it's possible to prevent the videos from being reopened at each update

cc @Nicogene @GiulioRomualdi

@martinaxgloria
Copy link
Member

Sorry, I closed it by mistake.

@martinaxgloria
Copy link
Member

I opened a draft PR with the suggestions of @traversaro.

It's in draft since I have to test it on ergocub-head

cc @Nicogene @GiulioRomualdi

@Nicogene
Copy link
Member

Nicogene commented Jan 23, 2024

The @martinaxgloria fix improves significantly the performance, @GiulioRomualdi in case not sufficient feel free to reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain-software Related to Software prj-ergocub Related to ErgoCub Project team-fix Related to Team Fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants