开发者

How to get the response time of webservice in Objective-c

Can any one let me know while consuming the webservice ,how to get the response time with that,currently im getting the soap message length using the following code

msgLength       = [NSString stringWithFormat:@"%d开发者_开发百科", [soapMessage length]];

Can any one help me in that.


You can measure round trip time on device - the time taken from when you fire the request to when it is returned.

This can be a little misleading on iPhone, because 3G connections can vary quite dramatically. If you were interested in your service's performance it would be better to do some analytics or measurement server-side.

But, if you want to measure on device you can just save the current time before you make the call, get the current time when the call is returned, and get the difference.

startDate = [NSDate date];
NSTimeInterval startTime = [startDate timeIntervalSinceNow];

...gives you the current UNIX timestamp in seconds.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜