在Fiddler工具面板出自定義個面板, 分析當前fiddler 請求區域所有請求
開發語言:C# + Microsoft Visual Studio 2010
先看看分析內容:總請求,總耗流,加載時間(面板最后一個請求-第一個請求),最耗時請求,最耗流請求,重復請求
代碼片段:
面板-設置按鈕,展示框等
public class UserInterface : UserControl { private TabPage tabPage; //添加一個標簽頁 用來放置控件 //private CheckBox chkb_Enabled; //用來啟用或禁用插件 private TextBox textBox_Result; //用來保存最后的結果 private Button btn_Clear; //清空按鈕 private Button btn_ClearAll; private Button btn_ClearAndStart; //清空所有按鈕 private Button btn_get_HttpData; //獲取請求信息 private Button btn_get_PerformanceData; //獲取性能信息
初始化UI,和java差不多
public void InitializeUI() //初始化UI { this.tabPage = new TabPage("不點一下嗎"); this.tabPage.AutoScroll = true; this.btn_Clear = new Button(); this.btn_Clear.Text = "Clear"; this.btn_Clear.Left = 120; this.btn_Clear.Top = 10; this.btn_ClearAll = new Button(); this.btn_ClearAll.Text = "ClearAll"; this.btn_ClearAll.Left = 20; this.btn_ClearAll.Top = 10;
fiddler回調獲取信息細節:
Session[] selectSessions = FiddlerApplication.UI.GetAllSessions(); //獲取面板的所有請求 sessionSize = selectSessions.Length; foreach (Session session in selectSessions) //遍歷 { long c = ConvertDateTimeInt(session.Timers.ClientBeginRequest); //獲取第一個請求時間 long e = ConvertDateTimeInt(session.Timers.ClientDoneResponse); long currentflow = 0;if (session.requestBodyBytes.LongLength!=null) requestSize += session.requestBodyBytes.LongLength; //獲取請求耗流大小
}
設置生成調試:保存進入fiddler/script/{文件夾}