WPF性能調試系列文章:
WPF頁面渲染優化:Application Timeline
WPF頁面業務加載優化:Ants Performance Profiler
Ants Performance Profiler
Ant Performance Profiler是RedGate旗下強大的性能調優產品, 可以用於分析.NET Winform、webform以及Windows服務。使用在這里主要用來監測wpf 應用程序業務端執行所消耗的時間及性能影響。
下載安裝Ants Performance Profiler
從RedGate官網下載,下載地址為http://www.red-gate.com/products/dotnet-development/ants-performance-profiler/
模擬分析應用程序
打開Ants Performance Profiler,通過菜單File -> New Profiling Session...(Ctrl+N)打開新的監測會話,在可監測程序類型中選擇.Net executable。
Profiling Mode:設置對於應用程序監測的方式
Line-level and method-level timings; all methods inc. framework:最詳細代碼級監控,包含framework內部的代碼。
Method-level timings; all methods inc. framework:較為詳細方法級監控,包含framework內部的代碼。
Line-level and method-level timings; only methods with source:一般代碼級監控,只包含項目內代碼的監控。
Method-level timings; only methods with source:較少方法級監控,指包含項目內代碼的監控。
Sample method-level timings:實例級監控。
開始執行后,wpf應用會打開執行,當需要檢測的頁面加載完成后可以關閉wpf應用,等待分析結果會顯示如下圖:
注:此工具針對的是頁面邏輯的監控,對於xaml加載的監測可通過Application Timeline
業務邏輯代碼級分析結果
查看代碼執行時間就可以分析出業務代碼的瓶頸,對於高請求和高耗時的代碼進行具體優化。
上面是RedGate的performance profiler的使用方法,主要用於檢測頁面業務邏輯性能瓶頸。接下來會介紹到RedGate另一個神級產品MemoryProfiler內存性能檢測工具。