user420667
user420667

Reputation: 6710

Use fiddler to get session times with milliseconds

So the fiddler cookbook lists a way of getting the timing information for each session by adding a context menu. 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.");
}

Note I had to comment out one of the lines since the script didn't appear to compile otherwise. (And consequently had to change the number of arguments to AppendFormat)

Unfortunately this only gives the times down to the second. How do I get the times at the millisecond level? Where can I find general information on what objects are available to Fiddler scripts?

Thanks in advance.

Upvotes: 0

Views: 1384

Answers (1)

user420667
user420667

Reputation: 6710

The trick is to use an object browser such as Visual Studio's on the Fiddler executable to explore what's available in Fiddler.

The Session class has a timers variable, which does indeed return an array of System.DateTimes.

From that we can use a formatted string to get the milliseconds, like ToString("hh:mm:ss.ffff").

Upvotes: 1

Related Questions