CPU Usage JavaFX

孤街浪徒 提交于 2019-12-11 12:21:26

问题


I got some problems by using JFX Applications. On my local developing system(Linux) my application got a cpu usage about 0-2%. When I install and run my application on the customer windows vm system, the cpu usage is much higher, about 50-70%. This phenomenon occurs only on a VM System. If i run the application on a local windows system everything runs fine. Therefore i guess it is related to the vm graphic adapter and his configuration. But the customer says there is no graphic adapter configuration available. I researched similar performance problems and I tried some JVM options like:

-Dprism.order=es2,es1,sw,j2d
-Dsun.java2d.opengl=true
-Dprism.vsync=false
-Dprism.forceGPU=true

The option -Dprism.order=es2,es1,sw,j2d reduced the usage under 25%. Still to high but i dont know what else can i do?

Edit: Thanks for the reply. When in run the app without -Dprism.order=es2,es1,sw,j2d i got follwoing message and 70% cpu usage:

D3DPipelineManager: Created D3D9Ex device Direct3D initialization succeeded (X) Got class = class com.sun.prism.d3d.D3DPipeline Initialized prism pipeline: com.sun.prism.d3d.D3DPipeline 

When i run the app with the option i got following message and 20% cpu usage:

Prism pipeline name = com.sun.prism.sw.SWPipeline (X) Got class = class com.sun.prism.sw.SWPipeline Initialized prism pipeline: com.sun.prism.sw.SWPipeline 

回答1:


According to the JavaFX architecture, if the rendering engine cannot find suitable hardware accelerated pipeline, it falls back to software rendering, which is CPU intensive. Since it is a VM system that's having the issue, it is possible that either graphics drivers are not properly installed and/or outdated and/or not supported by JavaFX. Similar thing goes for DirectX libraries, as this is the technology JavaFX uses on Windows. Another thing to check would be if the VM configuration itself allows hardware acceleration (this is usually defined when the configuration is created).

So, steps to take:

  1. Check VM configuration
  2. Update JDK
  3. Update graphics drivers (typically supplied by the VM software provider)
  4. Update DirectX

Having done that, you should be able to track down the issue, or at least narrow down things affecting the performance



来源:https://stackoverflow.com/questions/33628584/cpu-usage-javafx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!