XChart icon indicating copy to clipboard operation
XChart copied to clipboard

CPU usage with real time xy chart and lots of points

Open landret opened this issue 3 years ago • 3 comments

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 real time chart with 12 data

CPU and memory

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()

methods and cpu

Would there be a way to decrease this load?

landret avatar Jan 30 '21 01:01 landret

Good question. Undoubtedly for sure! :) This is a really good analysis.

timmolter avatar Feb 02 '21 20:02 timmolter

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.

mccartney avatar Feb 16 '21 09:02 mccartney

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?

landret avatar Jul 07 '21 22:07 landret