Skip to content

Commit

Permalink
Merge branch 'master' of github.com:WPO-Foundation/wptagent
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeenan committed Sep 24, 2018
2 parents 92d29e2 + 1d4aaf2 commit b261c47
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions internal/safari_ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,18 +493,24 @@ def process_network_event(self, event, msg):
if 'end' not in request or timestamp > request['end']:
request['end'] = timestamp
elif event == 'dataReceived':
bytesIn = 0
if 'encodedDataLength' in msg['params'] and \
msg['params']['encodedDataLength'] >= 0:
request['objectSize'] += msg['params']['encodedDataLength']
request['bytesIn'] += msg['params']['encodedDataLength']
request['transfer_size'] += msg['params']['encodedDataLength']
bytesIn = msg['params']['encodedDataLength']
request['objectSize'] += bytesIn
request['bytesIn'] += bytesIn
request['transfer_size'] += bytesIn
elif 'dataLength' in msg['params'] and msg['params']['dataLength'] >= 0:
request['objectSize'] += msg['params']['dataLength']
request['bytesIn'] += msg['params']['dataLength']
request['transfer_size'] += msg['params']['dataLength']
bytesIn = msg['params']['dataLength']
request['objectSize'] += bytesIn
request['bytesIn'] +=bytesIn
request['transfer_size'] += bytesIn
if 'dataLength' in msg['params'] and msg['params']['dataLength'] >= 0:
request['objectSizeUncompressed'] += msg['params']['dataLength']
if timestamp and 'start' in request and timestamp > request['start']:
if 'chunks' not in request:
request['chunks'] = []
request['chunks'].append({'ts': timestamp, 'bytes': bytesIn})
if 'firstByte' not in request or timestamp < request['firstByte']:
request['firstByte'] = timestamp
if 'end' not in request or timestamp > request['end']:
Expand Down Expand Up @@ -1152,6 +1158,11 @@ def process_requests(self, raw_requests):
if timing['responseStart'] >= 0:
request['ttfb_ms'] = int(round(timing['responseStart'] -
timing['requestStart']))
if 'chunks' in r:
request['chunks'] = []
for chunk in r['chunks']:
ts = (chunk['ts'] - start) * 1000.0
request['chunks'].append({'ts': ts, 'bytes': chunk['bytes']})
request['bytesIn'] = r['bytesIn']
if 'bytesOut' in r:
request['bytesOut'] = r['bytesOut']
Expand Down

0 comments on commit b261c47

Please sign in to comment.