-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: master
Are you sure you want to change the base?
Conversation
Tested 3903955 and issue still persists. In master at the moment, there are about four |
I added the |
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 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. |
Can also use top(1) and "time sugar-activity3" to assess CPU utilisation. Look into Python's profiling features.
Switching from pygame.display.flip to .update is good only if you pass it a list of small rectangles to update. I've not reviewed your code or the existing code, just sharing knowledge. The key question is how often, per second, is pygame.display.update or .flip being called, and is that frame rate chosen carefully for the amount of processing needed between each update. You can instrument the code with counters and use of time.time() to calculate that during debugging.
Treat the existing code with doubt and care; sometimes it has been only briefly tested on one specific model of OLPC laptop. You now need to generalise the code for all computers.
|
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? |
What was CPU utilisation before this pull request?
|
it was around 40%-45%. |
Thanks!
|
Do you know your next steps moving forward? |
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? |
The improvement in utilisation you have already achieved is a good
start. I suggest finishing the review and getting this merged.
There may not be a return on invested time to go further with
optimisation, but if you wish to learn how to do it, read up on Python
profiling tools.
|
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. |
@chimosky @srevinsaju kindly review the PR.