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

fix: fixed CPU overheating #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sourabhaa
Copy link
Contributor

@chimosky @srevinsaju kindly review the PR.

@chimosky
Copy link
Member

chimosky commented Jul 19, 2022

Tested 3903955 and issue still persists.

In master at the moment, there are about four pygame.display.update calls, in your change there are six calls to pygame.display.update, these updates at these intervals also contribute to the problem and I doubt they're all needed at every point they're called.

@sourabhaa
Copy link
Contributor Author

I added the pygame.display.update in checkValidMovement and changePosition to update the required portion of screen and avoid updating the entire screen after every move. Could you please let me know if there's a way to actually see the difference in utilisation of CPU while running the activity?

@chimosky
Copy link
Member

chimosky commented Jul 20, 2022

I added the pygame.display.update in checkValidMovement and changePosition to update the required portion of screen and avoid updating the entire screen after every move. Could you please let me know if there's a way to actually see the difference in utilisation of CPU while running the activity?

Adding more when the problem still exists doesn't seem like a good way to solve the problem as you're not minimizing or limiting the calls.

You'll notice your laptop heat up and your fan spins a lot more, those are the most obvious. I also look at the load average while running the activity, you can view your load average with top in your terminal and you'll notice the numbers go up while running the activity and you'd also notice that the command that's running the application uses a lot of CPU, I'm using a virtual machine so in my case it's virt-manager using 74% CPU and qemu-system-x86 using 25% CPU.

I didn't wait long enough for my load average to get to 1+ but the CPU is already being consumed by these applications and if you wait a couple more minutes it gets there pretty fast.

Hope that helps!
Screenshot from 2022-07-20 01-42-11

@quozl
Copy link
Contributor

quozl commented Jul 20, 2022 via email

@sourabhaa
Copy link
Contributor Author

currently, befdafe measure CPU utilisation of 27%. I tested the CPU utilisation of other activities and found it is 25% to 35% on an average. is it the desired usage?

@quozl
Copy link
Contributor

quozl commented Jul 21, 2022 via email

@sourabhaa
Copy link
Contributor Author

it was around 40%-45%.

@quozl
Copy link
Contributor

quozl commented Jul 22, 2022 via email

@chimosky
Copy link
Member

it was around 40%-45%.

Do you know your next steps moving forward?

@sourabhaa
Copy link
Contributor Author

The activity is now running with 25 to 30% of CPU utilisation, I'm not sure with other approaches to further optimise it. Could you please suggest how to go about it?

@quozl
Copy link
Contributor

quozl commented Jul 25, 2022 via email

@chimosky
Copy link
Member

The activity is now running with 25 to 30% of CPU utilisation, I'm not sure with other approaches to further optimise it. Could you please suggest how to go about it?

In addition to what @quozl has said, I think you should also look at ways to reduce update calls as that's another factor that's causing the CPU overheating, dirty rectangle accumulation might work for this as suggested earlier.

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

Successfully merging this pull request may close these issues.

3 participants