开发者

Measure performance of WPF rendering

I have ListBox. ItemsSource of this control is binded to ObservableCollectio开发者_如何学运维n. I want to measure time which starts when I changed ObservableCollection and ends when user saw updated content in the ListBox.

The main problem here is how to determine this moment when control is rendered. I need to do it in the code to write measured time into log. Any suggestions?


You want to look into the WPF Performance Suite. From MSDN:

The Windows SDK includes a suite of performance profiling tools for Windows Presentation Foundation (WPF) applications called the WPF Performance Suite. The WPF Performance Suite enables you to analyze the run-time behavior of your WPF applications and determine performance optimizations that you can apply. The WPF Performance Suite includes performance profiling tools called Perforator and Visual Profiler.

If you're looking to measure just the time in a particular body of code (essentially in your source code) - you're going to need to look at a performance profiler. RedGate sells a profiler I like - but there are others. Doing this directly in your code so that you can log it yourself will be difficult. You could certainly capture the timing information - but that will itself skew the results.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜