How to run a delay test on an iPhone

I would like to run a latency test with respect to other URLs in my iPhone app, the approach would be to make an asynchronous request for the URL and measure the length of time based on when the control reaches the delegation point connectionDidFinish, is this the right approach or some alternatives available on iPhone for measuring latency?

+4
source share
2 answers

I'm not sure how you define latency. Take a look at the wiki article for some clarification.

I would comment on the response time to get a picture of the network lag, very interesting in mobile connections. I use this approach in one of the applications that I developed:

- (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse { ... self.reqStart = [NSDate date]; self.url = [[request URL] absoluteString]; NSLog(@"--> Requesting : %@", url); ... } - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)aResponse { NSLog(@"<-- Response time %fs : %@", [[NSDate date] timeIntervalSinceDate:reqStart], url); ... } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { NSLog(@"<== Request time %fs : %@", [[NSDate date] timeIntervalSinceDate:reqStart], url); ... } 

Bandwidth for simulator testing can be very useful.

+5
source

Share your Mac phone with your iPhone (plug it into Ethernet). Then use tcpdump on Mac to capture network traffic, using Wireshark to view pcap, this will give you the best view of network latency.

0
source

Source: https://habr.com/ru/post/1338118/


All Articles