0

I've been using oxyplot for a month now and I'm pretty happy with what it delivers. I'm getting data from an oscilloscope and, after a fast processing, I'm plotting it in real time to a graph.

However, if I compare my application CPU usage to the one provided by the oscilloscope manufacturer, I'm loading a lot more the CPU. Maybe they're using some gpu-based plotter, but I think I can reduce my CPU usage with some modifications.

I'm capturing 10.000 samples per second and adding it to a LineSeries. I'm not plotting all that data, I'm decimating it to a constant number of points, let's say 80 points for a 20 secs measure, so I have 4 points/sec while totally zoomed out and a bit more detail if I zoom in to a specific range.

With the aid of ReSharper, I've noticed that the application is calling a lot of times (I've 6 different plots) the IsValidPoint method (something like 400.000.000 times), which is taking a lot of time.

I think the problem is that, when I add new points to the series, it checks for every point if it is a valid point, instead of the added values only.

Also, it spends a lot of time in the MeasureText/DrawText method.

My question is: is there a way to override those methods and to adapt it to my needs? I'm adding 10.000 new values each second, but the first ones remain the same, so there's no need for re-validate them. Also, the text shown doesn't change.

Thank you in advance for any advice you can give me. Have a good day!

lyurealm
  • 113
  • 4
  • How often do you refresh the plot? I mean if the plot is refreshed upon every data entry it would use more CPU cycle per your description(16 plots, 4 input/sec).. Try refresh once or twice per second and see if that help. Also try to truncate old plot data not displayed would help also. – Peter Jul 02 '16 at 14:38
  • Thank you for your answer, Peter! In fact, it's only one input wich turns out into 4 different data analysis. I'm updating it 4 times per second, I use "lock" on each plot model, I add the data, and then InvalidatePlot() on all the models. What I try to get is only 200.000 "IsValidPoint" method calls in each PlotModel. For that, I have to rewrite the IsValidPoint method so it "remembers" what it has checked before, since once added, it won't change. I think at this moment, each time I add new data to a serie, it applies IsValidPoint on every point, and thus I get the 400.000.000 calls. – lyurealm Jul 03 '16 at 20:23

0 Answers0