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

CPU usage 100% in Linux (ubuntu 20.04) #5192

Closed
sakya opened this issue Dec 19, 2020 · 9 comments
Closed

CPU usage 100% in Linux (ubuntu 20.04) #5192

sakya opened this issue Dec 19, 2020 · 9 comments

Comments

@sakya
Copy link

sakya commented Dec 19, 2020

CPU usage 100% in Linux (ubuntu 20.04)
The project XamlControlsGallery under Ubuntu 20.04 and using Avalonia 0.10.0-rc1 has a CPU usage of 100%

To Reproduce
Steps to reproduce the behavior:

  1. Download the XamlControlsGallery source code
  2. Update reference to Avalonia 0.10.0-rc1
  3. Run

Expected behavior
The app shouldn't use 100% of CPU

Screenshots
image

image

Desktop:

  • OS: Linux Ubuntu 20.04
  • Version 0.10.0-rc1
@danwalmsley
Copy link
Member

Does your system have a gpu or is it relying on software rendering?

@sakya
Copy link
Author

sakya commented Dec 19, 2020

I'm using a GeForce GTX 760M (Xorg)
image

@sakya
Copy link
Author

sakya commented Dec 19, 2020

Driver version
NVIDIA-SMI 450.80.02 Driver Version: 450.80.02 CUDA Version: 11.0

@devel0
Copy link
Contributor

devel0 commented Dec 25, 2020

I experienced same problem using 0.10.0-preview5 and nvidia gtx 1050ti but using latest 0.10.0-rc1 problem solved.

Seen now that sakya already used 0.10.0-rc1, please try to cleanup bin and obj rm -fr obj bin and try to rebuilt just to ensure you using rc1 version. If problem still there may related to other parts of avalonia involved by your project that doesn't repro with my case. Other thing to try is to upgrade dotnet to net5.0

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Avalonia.Desktop" Version="0.10.0-rc1" />
  </ItemGroup>

</Project>

or try with older version such as 0.10.0-preview2 to verify if exists other version that doesn't cause the problem.

@sakya
Copy link
Author

sakya commented Dec 26, 2020

Hi, I cleaned the build, changed to net5.0 but the cpu is always 100%
This seems really related to Linux because the same project run on Windows on a Celeron J1900 with Intel integrated graphics uses 2/5% of CPU.

XamlControlsGallery-master.zip

@devel0
Copy link
Contributor

devel0 commented Dec 26, 2020

Thanks, It's ok its related to known bug ( #2012 ) if you comment out this cpu goes ok

      <!-- <ProgressBar IsIndeterminate="True" Margin="0 40" /> -->

btw for my project where I not used progress bar I had that problem of cpu when using the previous 0.10.0-preview5 while 0.10.0-rc1 solve, so seems there are some progress fixating the issue of high cpu usage on x11 excluding in fact the progressbar when indeterminate mode.

@sakya
Copy link
Author

sakya commented Dec 27, 2020

You're right, many thanks!
I had this problem with a different project. In my project I don't have any indeterminate progress bar but I was able to fix the issue.
I have a spinner with an animation set to INFINITE. The spinner is shown or hidden...well when it's hidden it seems that the animation runs and uses 100% of the CPU.
I solved the issue by stopping and starting the animation when i show/hide the spinner.
So it seems that on Linux animations run even on hidden elements, while on Windows not?

EDIT: or are animations just a lot heavier on Linux?

@kekekeks
Copy link
Member

CPU usage is probably caused by triggering the render timer more frequently. Everything else should be the same for all platforms.

@sakya
Copy link
Author

sakya commented Dec 27, 2020

Ok, many thanks for the help!

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

4 participants