This project is read-only.

CPU usage varies with size of window in your real-time PerfCounterSample

Jan 5, 2009 at 5:20 PM
Hello

Your PerfCounterSample adds new (performance) data to the chart on a timer. For my test, I made sure the time was ticking at a known interval of 50ms, because by default it is 0ms which probably means it spins as fast as it can. Anyway...

  • Starting PerfCounterSample  launches a relatively small window and  CPU is typically 0% on Task Manager under these conditions - what I expect.
  • Resizing the application window larger increases CPU to around 5-10%
  • Maximizing the window it goes up to 25-30% CPU.
It does also seem to be affected by how complicated the performance trace is (i.e. lots of spikes/steps is worse than  flat line).

My understanding of WPF is that the rendered size of the plot window should not affect the main CPU performance (just the GPU).

So why is this happening?

(BTW. I need a solution that can plot potentially 16 traces of real time data, each running at 20 Hz. I thought that by choosing a WPF oriented solution, the bandwidth for the rendering process would all be offloaded to the GPU, and hence window size would not affect main CPU performance.)



Jan 9, 2009 at 4:05 PM
Edited Jan 9, 2009 at 4:11 PM
Hello

WPF does a lot of computations both on CPU and GPU; GPU is used more when graphics card is modern - you can read about WPF's Render Tiers (http://msdn.microsoft.com/en-us/library/ms742196.aspx).

Our PerfCounterSample does not perform as many optimizations for plotted data as it could:
Performance data is added into collection neary 20 times per second, and only data for latest 30 seconds is drawn by taking only latest points from this collection, but all collection is being processed each time when data changes.
You can store only latest %number% of points in special collection, limiting total number of point.

This sample does not measure performance of the very plotting, but it measures simply your system's CPU usage. And it is natural that this usage also consists of CPU usage made by ChartPlotter itself, that's why when ChartPlotter does more computations, CPU usage grows respectively.

Also performance of DynamicDataDisplay really depends on number of points in line, and when you are maximizing window, points are filtered less than in case of small window, to reliably represent source data. To increase performance, you can use more aggressive filtering in LineChart.

We'll continue work to increase overall performance of DynamicDataDisplay. And I think that in case of making proper optimizations and filtering, you'll be able to plot 16 real-time charts.

Best regards,
Mikhail, DynamicDataDisplay Dev Team.