LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

the program takes up high usage percent of cpu

i want to display curves with 20000 datas per second on graph controls.
these curves are refresh 240 datas per 12ms. in order to deal with the
problem, i use an asynchronous timer control with 12ms interval. but the
program takes up almost 100% usage of the cpu. i want to descend the usage
of the cpu when my program running. how can i do?
thanks your suggestions!
0 Kudos
Message 1 of 4
(3,301 Views)
It sounds like you are drawing >80 times per second onto the graph. This is always going to be a pretty heavy drain on the system. Since this is faster than you can actually see anyway, I would buffer the data and plot it every N iterations instead of every iteration. For example, you could plot 980 points every 48ms, or 1960 points every 96ms, by buffering the data for 4 or 8 timer ticks and plotting once.

This should be a lot less expensive in terms of CPU usage.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 4
(3,301 Views)
thanks your idea. i try it and it runs very well. are other ways can deal
with the problem?
thanks !


"Chris Matthews" ????
news:506500000005000000C8BA0100-1079395200000@exchange.ni.com...
> It sounds like you are drawing >80 times per second onto the graph.
> This is always going to be a pretty heavy drain on the system. Since
> this is faster than you can actually see anyway, I would buffer the
> data and plot it every N iterations instead of every iteration. For
> example, you could plot 980 points every 48ms, or 1960 points every
> 96ms, by buffering the data for 4 or 8 timer ticks and plotting once.
>
> This should be a lot less expensive in terms of CPU usage.
>
> Best Regards,
>
> Chris Matthews
> National Instruments
0 Kudos
Message 3 of 4
(3,301 Views)
Not really. Redrawing 80 times per second is always going to be a serious drain on CPU usage. In the end, there isn't really a good reason to plot that often, since that is much faster than you can see the updates.

Chris
0 Kudos
Message 4 of 4
(3,301 Views)