开发者

PerformanceProgressBar eats 50% of CPU even when invisible

I am using the PerformanceProgressBar control from the Silverlight Toolkit for Windows Phone. I am observing 开发者_如何学运维that once a page with a PerformanceProgressBar is shown, the CPU in the emulator goes to 50% and stays there even after the IsIndedeterminate / Visibility / Enabled properties have been disabled.

Has anyone else observed this?

Not sure whether this is an emulator behavior only or it happens on the phone as well.

Thanks in advance.


When using the PerformanceProgressbar you should not only change the visibility state, but change the IsIndeterminate property accordingly. If you make the bar visible set IsIndeterminate to true, if you hide it, set IsIndeterminate to false. That should solve your problem.


How are you measuring the emulator CPU? Are you just measuring your PC CPU when running the emulator? If so, this is not a reliable measure of the real performance. A much better way t gauge the performance of your application is to enable the frame rate counters. Look specifically at the render (or compositor) thread and UI thread frame rates. The performance progress bar should not have an impact on the UI thread frame rate, because it is designed so that it can be updated via the render / compositor thread.


Any Storyboard-based animation (PerformanceProgressBar incl.) must necesarily perform badly as it is run on a privileged thread. If you want to know more or read about the alternatives, look here.

For fast info look at the table at the very end of the article. PerfProgressBar really takes away ~50% of the CPU, which is notably better than standard ProgressBar (>60%), but a lot worse than the other possibilities.

But: The numbers refer to the device. In case of the emulator the loss is much lower. At least in my concrete case. In general, I would not take performance numbers measured on the emulator too seriously.

Benchmark application described in the article is part of the Resco Mobile Forms Toolkit samples. That app uses this code for PerformanceProgressBar:

<ProgressBar Style="{StaticResource PerformanceProgressBar}"
    Width="250" Margin="0" Padding="10"
    IsIndeterminate="{Binding ElementName=PerfProgressCheckBox, Path=IsChecked}"
    Visibility="{Binding ElementName=PerfProgressCheckBox, Path=IsChecked, Converter={StaticResource TrueVis}}" />

I can assure you that PerfProgressBar does not take any CPU while inactive. This holds true both on the device and emulator. I would look for a problem in your code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜