Linux Javafx8图形上性能下降的问题

Linux Javafx8图形上性能下降的问题,java,linux,opengl,Java,Linux,Opengl,我在这里找到了一些关于Javafx8在Windows和Linux以及某些应用程序上的图形性能的热门文章。我尝试了一个-Dprism.vsync=false的建议,这似乎不会影响结果。为了消除它成为我的代码的可能性,我所做的是编写一个简单的air-gappable应用程序,它只向GraphicsContext2D提供宽度值为0到画布高度之间的随机高度的数据。虽然我让它在一夜之间运行,但我将尝试显示每个图形周期的衰减metod调用时间,即“ 这确实更好,但在Windows上并不完美。Linux环境是

我在这里找到了一些关于Javafx8在Windows和Linux以及某些应用程序上的图形性能的热门文章。我尝试了一个-Dprism.vsync=false的建议,这似乎不会影响结果。为了消除它成为我的代码的可能性,我所做的是编写一个简单的air-gappable应用程序,它只向GraphicsContext2D提供宽度值为0到画布高度之间的随机高度的数据。虽然我让它在一夜之间运行,但我将尝试显示每个图形周期的衰减metod调用时间,即“

这确实更好,但在Windows上并不完美。Linux环境是Ubuntu 14.04最新版本。Java是1.8.0_77

我不知道这是Javafx8问题还是Linux或Linix X.Org问题

-详细数据为:

Prism pipeline init order: es2 sw 
Using java-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
Loading ES2 native library ... prism_es2
    succeeded.
GLFactory using com.sun.prism.es2.X11GLFactory
(X) Got class = class com.sun.prism.es2.ES2Pipeline
Initialized prism pipeline: com.sun.prism.es2.ES2Pipeline
Maximum supported texture size: 16384
Maximum texture size clamped to 4096
Non power of two texture support = true
Maximum number of vertex attributes = 16
Maximum number of uniform vertex components = 16384
Maximum number of uniform fragment components = 16384
Maximum number of varying components = 128
Maximum number of texture units usable in a vertex shader = 16
Maximum number of texture units usable in a fragment shader = 16
Graphics Vendor: X.Org
       Renderer: Gallium 0.4 on AMD OLAND
        Version: 3.0 Mesa 10.5.9
 vsync: true vpipe: true
ES2ResourceFactory: Prism - createStockShader: FillPgram_Color.frag
ES2ResourceFactory: Prism - createStockShader: Solid_TextureRGB.frag
ES2ResourceFactory: Prism - createStockShader: Solid_Color.frag
ES2ResourceFactory: Prism - createStockShader: Mask_TextureSuper.frag
new alphas
ES2ResourceFactory: Prism - createStockShader: Texture_Color.frag
ES2ResourceFactory: Prism - createStockShader: Texture_LinearGradient_PAD.frag
ES2ResourceFactory: Prism - createStockShader: Solid_TextureFirstPassLCD.frag
ES2ResourceFactory: Prism - createStockShader: Solid_TextureSecondPassLCD.frag
new alphas
无论我给它多少时间运行,以小时或晚上为单位,应用程序的cpu(用jconsole或jvisualvm衡量)永远不会运行,比如说,大约23%。top报告的cpu超过50%。最初cpu为6.6%,在10分钟内稳定增加到23%左右,但系统的响应性非常好。经过一个晚上ng或夜晚,整个系统都慢得可怜。终止应用程序可能会将整个系统锁定一两分钟。整个Java堆的大小明显保持在50MB以下。在GC上,它会下降到20。我正在等待一个以帧为单位的X轴生成的图,其中我每100ms生成一个新帧。可以看到slugishne显示中的ss,在视觉上要慢得多,但我不知道生成时间是否不同。Y轴在使用中,因为毫秒也被证明是正确的。我已经意识到两件事: 1) Java9具有一个新的Marlin渲染器 2) Ubuntu 16.04采用了新的视频驱动程序,在本例中是AMD,我相信内核在图形性能方面也有改进。由于jvisualvm不使用lambda表达式,我做了堆转储,离线查看,没有发现任何特别值得注意的地方。我不相信我的应用程序中速度减慢的原因。我请注意,Xorg的运行速度约为50%+/-并且具有大约652K(652232)的virt占用空间

在完整的应用程序中,不仅顶部有示波器类型的显示器,而且还有瀑布(热图)下面。我可以单独使用其中一个来重现系统降级,但我想让一个应用程序足够小,能够重现我看到的内容,而不会让无关的应用程序代码混淆问题。同样,vsync的设置似乎没有任何效果

根据top的说法,目前java进程使用了90%的cpu,而jvirtualvm表示该进程使用了22-23%的cpu,考虑到它的启动率为6%,仍然很高

今天早上(因为我昨晚写完了这篇文章),系统被完全锁定,中断被禁用(没有num-lock或caps-lock)

在3.5小时的测试中,我看到,从顶部看,java的cpu略低于100%,XOrg的cpu增长缓慢。现在是42%。我的测试应用程序中的堆在13MB左右见底。我不知道为什么它从6%增长到23%(根据visualvm,但根据顶部,它上升到了大约100%。然而visualvm显示cpu和堆是平的。 如有任何观察、建议、了解我这边可能存在的问题或正在进行的治疗,我们将不胜感激

谢谢, 沃尔特

这将驱动显示器

ByteBuffer intBuffer = ByteBuffer.allocate(4);
while (PanadapterView.running) {
    short height = spectrumView.getController().getHeight();
    short width = spectrumView.getController().getWidth();
    try {
        Thread.sleep(100);
        if (height * width != 0) {
            short data[] = new short[width];
            for (int i = 0; i < width; i++) {
                data[i] = (short)(height - (Math.random()* height));
            }
            milliStart = System.nanoTime();
            controller.onSpectrumDataReady(null, data);
            milliDuration = (int)(System.nanoTime()-milliStart);
            milliDuration += 500;
            milliDuration /=1000;
            intBuffer.asIntBuffer().put(milliDuration);
            if (output != null) {
                int written = output.write(intBuffer);
            }
            intBuffer.clear();
            if (cnt++ % 5000 == 0) {
                if (output != null) {
                    output.force(false);
                }
            }
        }
    } catch (InterruptedException | IOException ex) {
        PanadapterView.running = false;
    }
}
if (output != null) {
    output.close();
}
bytebufferintbuffer=ByteBuffer.allocate(4);
while(PanadapterView.running){
短高度=spectrumView.getController().getHeight();
短宽度=spectrumView.getController().getWidth();
试一试{
睡眠(100);
如果(高度*宽度!=0){
短数据[]=新短[宽度];
对于(int i=0;i
}

这将绘制画布

    public void onSpectrumDataReady(Panadapter targetPan, short[] data) {
        Platform.runLater(() -> {
            int start = 0;
            double offset = spectrum.getHeight();
            double canvasWidth = spectrum.getWidth();
            double canvasHeight = spectrum.getHeight();
            assert (data.length == canvasWidth);
            GraphicsContext gc = spectrum.getGraphicsContext2D();
            gc.beginPath();
            gc.clearRect(0, 0, canvasWidth, canvasHeight);
//            gc.save();
            gc.setLineWidth(1);
            gc.setStroke(Color.WHITESMOKE);
            gc.moveTo(start, (double) data[0]);
            for (int i = start; i < data.length; i++) {
                gc.lineTo((double) i, (double) data[i]);
            }
            gc.stroke();
//            gc.closePath();
        });
    }
spectrumdataready上的公共void(Panadapter targetPan,short[]数据){
Platform.runLater(()->{
int start=0;
双偏移=spectrum.getHeight();
double canvasWidth=spectrum.getWidth();
双画布高度=spectrum.getHeight();
断言(data.length==画布宽度);
GraphicsContext gc=spectrum.getGraphicsContext2D();
gc.beginPath();
gc.clearRect(0,0,画布宽度,画布高度);
//gc.save();
gc.设置线宽(1);
gc.设定行程(颜色:白烟);
gc.moveTo(开始,(双)数据[0]);
for(int i=start;i
我刚刚停止了应用程序。一旦我做了Xorg,cpu就下降到了。3%。这是图表,Y轴是美国的挂钟时间

运行7 1/2小时后,以下表示绘制整个帧的挂钟持续时间。我应该指出,以下表示方法持续时间的1分钟滚动平均值

我确实在Windows7上运行了一夜相同的测试,但它在绘图中没有可见的脱胶,这是缩小到prism.orde