{"id":2072,"date":"2014-02-27T03:20:28","date_gmt":"2014-02-27T03:20:28","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=2072"},"modified":"2014-02-27T03:20:28","modified_gmt":"2014-02-27T03:20:28","slug":"adding-export-excel-option-fiddler","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/adding-export-excel-option-fiddler\/","title":{"rendered":"Adding an &#8220;Export to Excel&#8221; Option in Fiddler"},"content":{"rendered":"<p>Fiddler (HTTP proxy for Windows) is a valuable tool for finding out what is happening in an external environment (e.g. when a client uses IE). <\/p>\n<p>It&#8217;s sometimes helpful to pull it&#8217;s data into Excel &#8211; this allows you to highlight dramatic deviations.<\/p>\n<p>The scripting API allows you to do this &#8211; drop the following code into the Fiddler script file-<\/p>\n<pre lang=\"javascript\">\npublic static ToolsAction(\"Copy Request Timings to Excel\")\nfunction DoHighlightSlowRequests() {\n  var oSessions = FiddlerApplication.UI.GetAllSessions();\n     \n  var s: String = \"\";\n  s = s +\n    \"Index\\t\" +\n    \"URL\\t\" +\n    \"Is HTTPS\\t\" +\n    \"Response Code\\t\" +\n    \"Request Bytes\\t\" +\n    \"Response Bytes\\t\" +\n         \n    \"ClientConnected\\t\" +\n    \"ClientBeginRequest\\t\" +\n    \"ClientDoneRequest\\t\" +\n         \n    \"ServerConnected\\t\" +\n    \"FiddlerBeginRequest\\t\" +\n    \"ServerGotRequest\\t\" +   \n    \"ServerBeginResponse\\t\" +\n    \"ServerDoneResponse\\t\" +\n    \"ClientBeginResponse\\t\" +\n    \"ClientDoneResponse\\t\" +\n         \n    \"DNSTime\\t\" +\n    \"GatewayDeterminationTime\\t\" +\n    \"TCPConnectTime\\t\" +\n    \"HTTPSHandshakeTime\\t\" +\n         \n    \"Request Transmission Time\\t\" +\n    \"Server Time Spent\\t\" +\n    \"Response Transmission Time\\t\" +\n    \"Transmission time (down + up)\\t\" +\n    \"Total Round Trip Time\" +\n    \"\\r\\n\";\n  for (var x:int = 0; x < oSessions.Length; x++){\n    var session = oSessions[x]\n    var timer = session.Timers\n    \/\/ use tabs intead of CSV because\n    \/\/ Excel and .NET have incompatible \n    \/\/ expectations for unicode format\n         \n    var t = oSessions[x].Timers\n    var transmissionTime = \n      new TimeSpan(t.ServerGotRequest.Ticks - \n                   t.FiddlerBeginRequest.Ticks).Milliseconds\n    var serverTimeSpent = \n      new TimeSpan(t.ServerDoneResponse.Ticks - \n                   t.ServerGotRequest.Ticks).Milliseconds \n    var responseTransmissionTime = \n      new TimeSpan(t.ServerDoneResponse.Ticks - \n                   t.ServerBeginResponse.Ticks).Milliseconds \n    var totalTransferTime = \n      transmissionTime + responseTransmissionTime\n    var roundTripTime = \n      new TimeSpan(t.ClientDoneResponse.Ticks - \n                   t.ClientBeginRequest.Ticks).Milliseconds \n         \n    var transmissionTimeStr = \n      transmissionTime < 0 ? \"\" : transmissionTime + \"\"\n    var serverTimeSpentStr =  \n      serverTimeSpent < 0 ? \"\" : serverTimeSpent + \"\"\n    var responseTransmissionTimeStr = \n      responseTransmissionTime < 0 ? \"\" : responseTransmissionTime + \"\"\n    var totalTransferTimeStr = \n      totalTransferTime < 0 ? \"\" : totalTransferTime + \"\"\n    var roundTripTimeStr =\n      roundTripTime < 0 ? \"\" : roundTripTime + \"\"\n            \n    s = s +\n        x + \"\\t\" +\n        oSessions[x].url + \"\\t\" +\n        oSessions[x].isHTTPS + \"\\t\" +\n        oSessions[x].responseCode + \"\\t\" +\n        oSessions[x].requestBodyBytes.Length + \"\\t\" +\n        oSessions[x].responseBodyBytes.Length + \"\\t\" +               \n             \n        oSessions[x].Timers.ClientConnected.Ticks + \"\\t\" +\n        oSessions[x].Timers.ClientBeginRequest.Ticks + \"\\t\" +\n        oSessions[x].Timers.ClientDoneRequest.Ticks + \"\\t\" +\n             \n        oSessions[x].Timers.ServerConnected.Ticks + \"\\t\" +\n        oSessions[x].Timers.FiddlerBeginRequest.Ticks + \"\\t\" +\n        oSessions[x].Timers.ServerGotRequest.Ticks + \"\\t\" +\n        oSessions[x].Timers.ServerBeginResponse.Ticks + \"\\t\" +\n        oSessions[x].Timers.ServerDoneResponse.Ticks + \"\\t\" +\n        oSessions[x].Timers.ClientBeginResponse.Ticks + \"\\t\" +\n        oSessions[x].Timers.ClientDoneResponse.Ticks + \"\\t\" +\n            \n        oSessions[x].Timers.DNSTime + \"\\t\" +\n        oSessions[x].Timers.GatewayDeterminationTime + \"\\t\" +\n        oSessions[x].Timers.TCPConnectTime + \"\\t\" +              \n        oSessions[x].Timers.HTTPSHandshakeTime + \"\\t\" +\n             \n        transmissionTimeStr + \"\\t\" + \n        serverTimeSpentStr + \"\\t\" + \n        responseTransmissionTimeStr + \"\\t\" + \n        totalTransferTimeStr + \"\\t\" + \n        roundTripTimeStr +\n        \"\\r\\n\";\n  }\n  System.Windows.Forms.Clipboard.SetText(\n    s.ToString(), \n    TextDataFormat.Text);     \n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Fiddler (HTTP proxy for Windows) is a valuable tool for finding out what is happening in an external environment (e.g. when a client uses IE). It&#8217;s sometimes helpful to pull it&#8217;s data into Excel &#8211; this allows you to highlight dramatic deviations. The scripting API allows you to do this &#8211; drop the following code &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/adding-export-excel-option-fiddler\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Adding an &#8220;Export to Excel&#8221; Option in Fiddler&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/2072"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=2072"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/2072\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=2072"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=2072"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=2072"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}