0

我正在寻找在 Fiddler 中测量服务调用响应时间的方法,因此它包括流程的所有阶段(创建请求、将其序列化为 xml、发送、获取响应、反序列化它)。像这样:

var start = DateTime.Now;
// client is auto-generated C# SoapHttpClientProtocol proxy for WCF service
var response = client.GetWebMethod();
var finish = DateTime.Now;
var elapsed = (finish - start).TotalMilliseconds;

文档建议使用 ClientDoneRequest 和 ClientDoneResponse 计时器之间的差异:

var elapsed = (oSession.Timers.ClientDoneResponse - Session.Timers.ClientDoneRequest).TotalMilliseconds;

结果我得到了大约 100% 的差异,而且 Fiddler 的值令人惊讶地小了两倍(反之亦然,因为它的代理必须有一些传递请求的开销)。
这更像是我正在寻找 ClientDoneResponse - Client* Begin *Request here,但在我的情况下,这两个计时器(ClientStartRequest 和 ClientDoneRequest)的值绝对相等。任何想法如何在 Fiddler 中获得至少近似接近的数字?提前致谢。
编辑
尝试过的 ClientBeginRequest,它根本不起作用。

4

1 回答 1

1

In your code, you're using DateTime.Now, which is limited to the Windows clock resolution (15.7ms). For higher precision, you should use the Stopwatch class instead.

I don't understand enough about what you're trying to measure with Fiddler's timers. ClientDoneResponse - ClientBeginRequest measures the time between the client sending the first TCP/IP packet to Fiddler and the time of Fiddler sending the final TCP/IP packet to the client.

于 2013-10-01T13:25:05.517 回答