parameters: (trace)
return_statement: return (dns_requests_count, dns_cost)
docstring: Returns the number and cost of DNS requests for a trace.
docstring_summary: Returns the number and cost of DNS requests for a trace.
docstring_tokens: Returns the number and cost of DNS requests for a trace .
function: def DnsRequestsAndCost(trace):
    """Returns the number and cost of DNS requests for a trace."""
    requests = trace.request_track.GetEvents()
    requests_with_dns = [r for r in requests if r.timing.dns_start != -1]
    dns_requests_count = len(requests_with_dns)
    dns_cost = sum(r.timing.dns_end - r.timing.dns_start
                   for r in requests_with_dns)
    return (dns_requests_count, dns_cost)
function_tokens: def DnsRequestsAndCost ( trace ) : requests = trace . request_track . GetEvents ( ) requests_with_dns = [ r for r in requests if r . timing . dns_start != - 1 ] dns_requests_count = len ( requests_with_dns ) dns_cost = sum ( r . timing . dns_end - r . timing . dns_start for r in requests_with_dns ) return ( dns_requests_count , dns_cost )