def __init__(self, request, response): self.request = request self.response = response self.page_ref = '' self.ts_start = request.ts_connect ended_datetime = datetime.fromtimestamp(response.ts_end) # calculate other timings self.time_blocked = -1 self.time_dnsing = -1 if request.dns_start_ts != -1: dns_sec = request.ts_connect - request.dns_start_ts if dns_sec < 0: logging.warning("url=%s connct=%f dns=%f", request.url, request.ts_connect, request.dns_start_ts) else: self.ts_start = request.dns_start_ts self.time_dnsing = int(dns_sec * 1000) self.started_datetime = datetime.fromtimestamp(self.ts_start) self.time_connecting = ms_from_dpkt_time( request.ts_start - request.ts_connect) self.time_sending = \ ms_from_dpkt_time(request.ts_end - request.ts_start) self.time_waiting = \ ms_from_dpkt_time(response.ts_start - request.ts_end) self.time_receiving = \ ms_from_dpkt_time(response.ts_end - response.ts_start) self.total_time = ms_from_timedelta( ended_datetime - self.started_datetime )
def __init__(self, request, response): self.request = request self.response = response self.page_ref = '' self.ts_start = int(request.ts_connect * 1000) self.startedDateTime = datetime.fromtimestamp(request.ts_connect) endedDateTime = datetime.fromtimestamp(response.ts_end) self.total_time = ms_from_timedelta( endedDateTime - self.startedDateTime # plus connection time, someday ) # calculate other timings self.time_blocked = -1 self.time_dnsing = -1 self.time_connecting = ms_from_dpkt_time(request.ts_start - request.ts_connect) self.time_sending = \ ms_from_dpkt_time(request.ts_end - request.ts_start) self.time_waiting = \ ms_from_dpkt_time(response.ts_start - request.ts_end) self.time_receiving = \ ms_from_dpkt_time(response.ts_end - response.ts_start) # check if timing calculations are consistent if self.time_sending + self.time_waiting + self.time_receiving != self.total_time: pass
def __init__(self, request, response): self.request = request self.response = response self.page_ref = '' self.ts_start = request.ts_connect ended_datetime = datetime.fromtimestamp(response.ts_end) # calculate other timings self.time_blocked = -1 self.time_dnsing = -1 if request.dns_start_ts != -1: self.ts_start = request.dns_start_ts dns_sec = request.ts_connect - request.dns_start_ts if dns_sec < 0: logging.error("url=%s connct=%f dns=%f", request.url, request.ts_connect, request.dns_start_ts) else: self.time_dnsing = int(dns_sec * 1000) self.started_datetime = datetime.fromtimestamp(self.ts_start) self.time_connecting = ms_from_dpkt_time(request.ts_start - request.ts_connect) self.time_sending = \ ms_from_dpkt_time(request.ts_end - request.ts_start) self.time_waiting = \ ms_from_dpkt_time(response.ts_start - request.ts_end) self.time_receiving = \ ms_from_dpkt_time(response.ts_end - response.ts_start) self.total_time = ms_from_timedelta(ended_datetime - self.started_datetime)
def __init__(self, request, response): self.request = request self.response = response self.pageref = None self.ts_start = int(request.ts_connect * 1000) self.startedDateTime = datetime.utcfromtimestamp(request.ts_connect) # calculate other timings self.time_blocked = -1 self.time_dnsing = -1 self.time_connecting = (ms_from_dpkt_time(request.ts_start - request.ts_connect)) self.time_sending = (ms_from_dpkt_time(request.ts_end - request.ts_start)) if response is not None: self.time_waiting = (ms_from_dpkt_time(response.ts_start - request.ts_end)) self.time_receiving = (ms_from_dpkt_time(response.ts_end - response.ts_start)) endedDateTime = datetime.utcfromtimestamp(response.ts_end) self.total_time = ms_from_timedelta(endedDateTime - self.startedDateTime) else: # this can happen if the request never gets a response self.time_waiting = -1 self.time_receiving = -1 self.total_time = -1
def __init__(self, request, response): self.request = request self.response = response self.pageref = None self.ts_start = int(request.ts_connect*1000) self.startedDateTime = datetime.utcfromtimestamp(request.ts_connect) # calculate other timings self.time_blocked = -1 self.time_dnsing = -1 self.time_connecting = ( ms_from_dpkt_time(request.ts_start - request.ts_connect)) self.time_sending = ( ms_from_dpkt_time(request.ts_end - request.ts_start)) if response is not None: self.time_waiting = ( ms_from_dpkt_time(response.ts_start - request.ts_end)) self.time_receiving = ( ms_from_dpkt_time(response.ts_end - response.ts_start)) endedDateTime = datetime.utcfromtimestamp(response.ts_end) self.total_time = ms_from_timedelta( endedDateTime - self.startedDateTime ) else: # this can happen if the request never gets a response self.time_waiting = -1 self.time_receiving = -1 self.total_time = -1
def __init__(self, request, response): self.request = request self.response = response self.pageref = None self.ts_start = int(request.ts_connect * 1000) self.startedDateTime = datetime.fromtimestamp(request.ts_connect) endedDateTime = datetime.fromtimestamp(response.ts_end) self.total_time = ms_from_timedelta(endedDateTime - self.startedDateTime) # plus connection time, someday # calculate other timings self.time_blocked = -1 self.time_dnsing = -1 self.time_connecting = ms_from_dpkt_time(request.ts_start - request.ts_connect) self.time_sending = ms_from_dpkt_time(request.ts_end - request.ts_start) self.time_waiting = ms_from_dpkt_time(response.ts_start - request.ts_end) self.time_receiving = ms_from_dpkt_time(response.ts_end - response.ts_start) # check if timing calculations are consistent if self.time_sending + self.time_waiting + self.time_receiving != self.total_time: pass
def __init__(self, request, response): self.request = request self.response = response self.page_ref = "" self.ts_start = int(request.ts_connect * 1000) self.startedDateTime = datetime.fromtimestamp(request.ts_connect) endedDateTime = datetime.fromtimestamp(response.ts_end) self.total_time = ms_from_timedelta(endedDateTime - self.startedDateTime) # plus connection time, someday # calculate other timings self.time_blocked = -1 self.time_dnsing = -1 if request.dns_start_ts != -1: self.started_datetime = datetime.fromtimestamp(request.ts_connect) dns_sec = request.ts_connect - request.dns_start_ts if dns_sec < 0: logging.error("url=%s connct=%f dns=%f", request.url, request.ts_connect, request.dns_start_ts) self.time_dnsing = int(dns_sec * 1000) self.time_connecting = ms_from_dpkt_time(request.ts_start - request.ts_connect) self.time_sending = ms_from_dpkt_time(request.ts_end - request.ts_start) self.time_waiting = ms_from_dpkt_time(response.ts_start - request.ts_end) self.time_receiving = ms_from_dpkt_time(response.ts_end - response.ts_start) # check if timing calculations are consistent if self.time_sending + self.time_waiting + self.time_receiving != self.total_time: pass