2011-12-02 20 views
0

因此,提琴手食譜列出了通過添加上下文菜單獲取每個會話的計時信息的方式。 It's the last sample code block under performance-testing here.使用提琴手以毫秒爲單位獲得會話時間

public static ContextAction("CopyTimers") 
function CopyTimers(oSessions: Fiddler.Session[]){ 
if (null == oSessions){ 
    MessageBox.Show("Please select sessions to copy timers for.", "Nothing to Do"); 
    return; 
} 

var s: System.Text.StringBuilder = new System.Text.StringBuilder(); 

for (var x = 0; x < oSessions.Length; x++) { 
    s.AppendFormat("{0}, {1}, {2}, {3}, {4}, {5}, {6}\r\n", 
    oSessions[x].Timers.ClientConnected, 
    oSessions[x].Timers.ClientDoneRequest, 
    //oSessions[x].Timers.ServerConnected, 
    oSessions[x].Timers.ServerGotRequest, 
    oSessions[x].Timers.ServerBeginResponse, 
    oSessions[x].Timers.ServerDoneResponse, 
    oSessions[x].Timers.ClientBeginResponse, 
    oSessions[x].Timers.ClientDoneResponse 
); 
} 
Utilities.CopyToClipboard(s.ToString()); 
MessageBox.Show("Done."); 
} 

注意我不得不註釋掉線之一,因爲劇本沒有出現,否則編譯。 (因此不得不將參數的數量更改爲AppendFormat)

不幸的是,這隻能讓時間倒數第二次。我如何在毫秒級別獲得時間?我在哪裏可以找到有關Fiddler腳本可用對象的一般信息?

在此先感謝。

+0

如果您遇到該腳本的編譯錯誤,您正在運行過時的Fiddler版本。升級到當前的。 – EricLaw

回答

1

訣竅是在Fiddler可執行文件上使用諸如Visual Studio的對象瀏覽器來瀏覽Fiddler中可用的內容。

Session類有一個timers變量,它確實返回一個System.DateTimes數組。

從這我們可以使用格式化的字符串來獲得毫秒,如ToString(「hh:mm:ss.ffff」)。

+0

或者您可以安裝FiddlerScript Editor,其中包含自己的類瀏覽器和幫助內容。 – EricLaw

相關問題