XChart
XChart copied to clipboard
CPU usage with real time xy chart and lots of points
Hi, I am doing real time data acquisition and display data with xy chart. I noticed that the API is using quite a lot of CPU and I had to do several tricks to limit this
Here is what I get after doing the following:
- limiting the number of total displayed points to a max of 5000
- limit the xchartpanel update rate to a period of 500ms
In this example, there are 12 data, but a total of 5000 points displayed
So what the CPU consumption I get with this is pretty good: around 8% cpu. But I would like to decrease the xchartpanel update rate period down to ideally 100ms. However, dividing the period by 2 also doubles the cpu load.
Here are the methods which seem to consume most of the CPU:
- chartpart.PlotContent_XY.doPaint()
- chartpart.PlotSurface_AxesChart.paint()
- chartpart.AxisTickLabels.paint()
Would there be a way to decrease this load?
Good question. Undoubtedly for sure! :) This is a really good analysis.
Here are the methods which seem to consume most of the CPU:
I guess these are actually not self-time, but nearly the whole time is spent in AWT/the actual JVM drawing code.
Here are the methods which seem to consume most of the CPU:
I guess these are actually not self-time, but nearly the whole time is spent in AWT/the actual JVM drawing code.
If nearly the whole time is spent in AWT, maybe calls to AWT could be reduced or improved?