原文:
WPF性能調試系列 – Ants Performance ProfilerWPF性能調試系列文章:
WPF頁面渲染優化:Application Timeline WPF頁面業務加載優化:Ants Performance ProfilerWPF記憶體優化:Ants Memory 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記憶體性能檢測工具。