Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Why are updates to CNiKnob and CNiSlide so slow?

In testing the effects on CPU usage (on my Win2k PC) I find that setting the value of a CNiKnob or CNiSlide is considerably more expensive than adding points to a CNiGraph object. (I am using SetValue() for the knob or slider and ChartXY() for the graph.) This is true even when the knob or slider is not on a visible screen, so it is not just a drawing issue.

This seems surprising to me, so I am wondering if I am doing something wrong. Are there any settings that have a big impact on the speed or efficiency with which sliders or knobs are updated? (Note that I need multithreaded access to these objects, so I am using the default constructor argument which specifies the MultipleThreadsWithCaching ThreadAccess option.)


Thanks in advance.

Wayne
0 Kudos
Message 1 of 4
(3,225 Views)
That's interesting ... could you please post a small test project that demonstrates this behavior? Thanks.

- Elton
0 Kudos
Message 2 of 4
(3,225 Views)
Elton,

I do not really have time right now to strip my app down to a test project to demonstrate the effect.

I can tell you that, when I run my app on my development PC (Win2k, 730 MHz Pentium), I get a baseline CPU usage of < 10% for about 80% of the time with occasional spikes up to ~50% usage. Adding a single slider (updating at 50 Hz) bumps the CPU usage up to about 50% for about 40% of the time. If I get up to 6 sliders, CPU usage pegs out at 100% all the time. Knobs give similar figures. In contrast, if I update a chart with 4 plots and 4 axes and a 5000 sample buffer size at a 50 Hz rate, CPU usage only goes to about 10-20% for about 50% of the time with peaks up to about 40%.

I find it surprising that a single slider or knob seems to pla
ce higher demands on my system than a chart with multiple plots. Is this what you would expect from your own testing at NI?

Wayne
0 Kudos
Message 3 of 4
(3,225 Views)
I wasn't necessarily asking for you to strip down your app to demonstrate the problem - I was thinking that you could create a new project and just add enough to it to demonstrate the problem. I tried creating a test project that had one graph, 7 knobs, and 7 sliders, and I had it plotting data every 100ms and the max I saw my CPU usage go up to was 30%.

- Elton
0 Kudos
Message 4 of 4
(3,225 Views)